summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrew Morton <akpm@osdl.org>2003-12-29 23:49:26 -0800
committerLinus Torvalds <torvalds@home.osdl.org>2003-12-29 23:49:26 -0800
commit4e2e30bb7317cea88f24684c89291eaf0f6141fc (patch)
treec743eb8479f0208329a5d4060e70a59ac511f9d9
parenta8007b5b37ba41ef0e2edaa7db430447cda124ef (diff)
[PATCH] reiserfs_rename ctime update
From: Nikita Danilov <Nikita@Namesys.COM> This patches reiserfs_rename. It adds ctime update of renamed object. It also fixes calculation of maximal possible transaction size during rename. Thanks to Alex Adriaanse <alex_a@caltech.edu> for finding this.
-rw-r--r--fs/reiserfs/namei.c24
1 files changed, 17 insertions, 7 deletions
diff --git a/fs/reiserfs/namei.c b/fs/reiserfs/namei.c
index 119ffcab6e4c..bdbe89bf99f1 100644
--- a/fs/reiserfs/namei.c
+++ b/fs/reiserfs/namei.c
@@ -1088,11 +1088,16 @@ static int reiserfs_rename (struct inode * old_dir, struct dentry *old_dentry,
int jbegin_count ;
umode_t old_inode_mode;
unsigned long savelink = 1;
+ struct timespec ctime;
- /* two balancings: old name removal, new name insertion or "save" link,
- stat data updates: old directory and new directory and maybe block
- containing ".." of renamed directory */
- jbegin_count = JOURNAL_PER_BALANCE_CNT * 3 + 3;
+ /* three balancings: (1) old name removal, (2) new name insertion
+ and (3) maybe "save" link insertion
+ stat data updates: (1) old directory,
+ (2) new directory and (3) maybe old object stat data (when it is
+ directory) and (4) maybe stat data of object to which new entry
+ pointed initially and (5) maybe block containing ".." of
+ renamed directory */
+ jbegin_count = JOURNAL_PER_BALANCE_CNT * 3 + 5;
old_inode = old_dentry->d_inode;
new_dentry_inode = new_dentry->d_inode;
@@ -1255,8 +1260,12 @@ static int reiserfs_rename (struct inode * old_dir, struct dentry *old_dentry,
mark_de_hidden (old_de.de_deh + old_de.de_entry_num);
journal_mark_dirty (&th, old_dir->i_sb, old_de.de_bh);
- old_dir->i_ctime = old_dir->i_mtime =
- new_dir->i_ctime = new_dir->i_mtime = CURRENT_TIME;
+ ctime = CURRENT_TIME;
+ old_dir->i_ctime = old_dir->i_mtime = ctime;
+ new_dir->i_ctime = new_dir->i_mtime = ctime;
+ /* thanks to Alex Adriaanse <alex_a@caltech.edu> for patch which adds ctime update of
+ renamed object */
+ old_inode->i_ctime = ctime;
if (new_dentry_inode) {
// adjust link number of the victim
@@ -1265,7 +1274,7 @@ static int reiserfs_rename (struct inode * old_dir, struct dentry *old_dentry,
} else {
new_dentry_inode->i_nlink--;
}
- new_dentry_inode->i_ctime = new_dir->i_ctime;
+ new_dentry_inode->i_ctime = ctime;
savelink = new_dentry_inode->i_nlink;
}
@@ -1298,6 +1307,7 @@ static int reiserfs_rename (struct inode * old_dir, struct dentry *old_dentry,
reiserfs_update_sd (&th, old_dir);
reiserfs_update_sd (&th, new_dir);
+ reiserfs_update_sd (&th, old_inode);
if (new_dentry_inode) {
if (savelink == 0)