From 38760e243249f03b4c6d78ca624dd846a2681b67 Mon Sep 17 00:00:00 2001 From: Mark Fasheh Date: Tue, 11 Sep 2007 17:21:56 -0700 Subject: ocfs2: Rename cleanups ocfs2_rename() does direct manipulation of the dirent it's gotten back from a directory search. Wrap this manipulation inside of a function so that we can transparently change directory update behavior in the future. As an added bonus, this gets rid of an ugly macro. Signed-off-by: Mark Fasheh Reviewed-by: Joel Becker --- fs/ocfs2/dir.c | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) (limited to 'fs/ocfs2/dir.c') diff --git a/fs/ocfs2/dir.c b/fs/ocfs2/dir.c index 4791683a119..31db7e3881b 100644 --- a/fs/ocfs2/dir.c +++ b/fs/ocfs2/dir.c @@ -271,6 +271,28 @@ cleanup_and_exit: return ret; } +int ocfs2_update_entry(struct inode *dir, handle_t *handle, + struct buffer_head *de_bh, struct ocfs2_dir_entry *de, + struct inode *new_entry_inode) +{ + int ret; + + ret = ocfs2_journal_access(handle, dir, de_bh, + OCFS2_JOURNAL_ACCESS_WRITE); + if (ret) { + mlog_errno(ret); + goto out; + } + + de->inode = cpu_to_le64(OCFS2_I(new_entry_inode)->ip_blkno); + ocfs2_set_de_type(de, new_entry_inode->i_mode); + + ocfs2_journal_dirty(handle, de_bh); + +out: + return ret; +} + /* * ocfs2_delete_entry deletes a directory entry by merging it with the * previous entry -- cgit v1.2.3