Skip to contentSkip to conversation

ocfs2: Rename cleanups

PATCH New Mark Fasheh 2 participants 2 messages Sep 19, 2007 – Sep 20, 2007 OCFS2

lore
Share & tools
lore
#0 lore raw

PATCH 9/15 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.

---
 fs/ocfs2/dir.c   |   22 ++++++++++++++++++++++
 fs/ocfs2/dir.h   |    3 +++
 fs/ocfs2/namei.c |   53 ++++++++++++++++++++++-------------------------------
 3 files changed, 47 insertions(+), 31 deletions(-)
fs/ocfs2/dir.c +22 -0
index 4791683..31db7e3 100644
@@ -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
fs/ocfs2/dir.h +3 -0
index d03eaaa..ce48b90 100644
@@ -50,6 +50,9 @@ static inline int ocfs2_add_entry(handle_t *handle,
 				 dentry->d_name.name, dentry->d_name.len,
 				 inode, blkno, parent_fe_bh, insert_bh);
 }
+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 ocfs2_check_dir_for_entry(struct inode *dir,
 			      const char *name,
fs/ocfs2/namei.c +22 -31

92 lines not on this page · raw message

Signature · 1 line
1.5.0.6
#1 lore raw

PATCH 9/15 ocfs2: Rename cleanups

Quoted 6 lines · Mark Fasheh

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.

Signature · 10 lines
A good programming language should have features that make the
kind of people who use the phrase "software engineering" shake
their heads disapprovingly.
	- Paul Graham

Joel Becker
Principal Software Developer
Oracle
E-mail: [email protected]
Phone: (650) 506-8127