Commit 9131dd42 authored by OGAWA Hirofumi's avatar OGAWA Hirofumi Committed by Linus Torvalds

[PATCH] fat: remove the unneeded vfat_find() in vfat_rename()

Now, vfat_rename() is using vfat_find() for sanity check.  This removes that
sanity check, the cost of sanity check is too high.
Signed-off-by: default avatarOGAWA Hirofumi <hirofumi@mail.parknet.co.jp>
Signed-off-by: default avatarAndrew Morton <akpm@osdl.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
parent 451cbaa1
...@@ -454,10 +454,10 @@ static int do_msdos_rename(struct inode *old_dir, unsigned char *old_name, ...@@ -454,10 +454,10 @@ static int do_msdos_rename(struct inode *old_dir, unsigned char *old_name,
{ {
struct buffer_head *dotdot_bh; struct buffer_head *dotdot_bh;
struct msdos_dir_entry *dotdot_de; struct msdos_dir_entry *dotdot_de;
loff_t dotdot_i_pos;
struct inode *old_inode, *new_inode; struct inode *old_inode, *new_inode;
struct fat_slot_info old_sinfo, sinfo; struct fat_slot_info old_sinfo, sinfo;
struct timespec ts; struct timespec ts;
loff_t dotdot_i_pos, new_i_pos;
int err, old_attrs, is_dir, update_dotdot, corrupt = 0; int err, old_attrs, is_dir, update_dotdot, corrupt = 0;
old_sinfo.bh = sinfo.bh = dotdot_bh = NULL; old_sinfo.bh = sinfo.bh = dotdot_bh = NULL;
...@@ -516,28 +516,24 @@ static int do_msdos_rename(struct inode *old_dir, unsigned char *old_name, ...@@ -516,28 +516,24 @@ static int do_msdos_rename(struct inode *old_dir, unsigned char *old_name,
if (new_inode) { if (new_inode) {
if (err) if (err)
goto out; goto out;
if (MSDOS_I(new_inode)->i_pos != sinfo.i_pos) {
/* WTF??? Cry and fail. */
printk(KERN_WARNING "msdos_rename: fs corrupted\n");
goto out;
}
if (is_dir) { if (is_dir) {
err = fat_dir_empty(new_inode); err = fat_dir_empty(new_inode);
if (err) if (err)
goto out; goto out;
} }
new_i_pos = MSDOS_I(new_inode)->i_pos;
fat_detach(new_inode); fat_detach(new_inode);
} else { } else {
err = msdos_add_entry(new_dir, new_name, is_dir, is_hid, 0, err = msdos_add_entry(new_dir, new_name, is_dir, is_hid, 0,
&ts, &sinfo); &ts, &sinfo);
if (err) if (err)
goto out; goto out;
new_i_pos = sinfo.i_pos;
} }
new_dir->i_version++; new_dir->i_version++;
fat_detach(old_inode); fat_detach(old_inode);
fat_attach(old_inode, sinfo.i_pos); fat_attach(old_inode, new_i_pos);
if (is_hid) if (is_hid)
MSDOS_I(old_inode)->i_attrs |= ATTR_HIDDEN; MSDOS_I(old_inode)->i_attrs |= ATTR_HIDDEN;
else else
...@@ -604,7 +600,7 @@ static int do_msdos_rename(struct inode *old_dir, unsigned char *old_name, ...@@ -604,7 +600,7 @@ static int do_msdos_rename(struct inode *old_dir, unsigned char *old_name,
fat_attach(old_inode, old_sinfo.i_pos); fat_attach(old_inode, old_sinfo.i_pos);
MSDOS_I(old_inode)->i_attrs = old_attrs; MSDOS_I(old_inode)->i_attrs = old_attrs;
if (new_inode) { if (new_inode) {
fat_attach(new_inode, sinfo.i_pos); fat_attach(new_inode, new_i_pos);
if (corrupt) if (corrupt)
corrupt |= fat_sync_inode(new_inode); corrupt |= fat_sync_inode(new_inode);
} else { } else {
......
...@@ -887,10 +887,10 @@ static int vfat_rename(struct inode *old_dir, struct dentry *old_dentry, ...@@ -887,10 +887,10 @@ static int vfat_rename(struct inode *old_dir, struct dentry *old_dentry,
{ {
struct buffer_head *dotdot_bh; struct buffer_head *dotdot_bh;
struct msdos_dir_entry *dotdot_de; struct msdos_dir_entry *dotdot_de;
loff_t dotdot_i_pos;
struct inode *old_inode, *new_inode; struct inode *old_inode, *new_inode;
struct fat_slot_info old_sinfo, sinfo; struct fat_slot_info old_sinfo, sinfo;
struct timespec ts; struct timespec ts;
loff_t dotdot_i_pos, new_i_pos;
int err, is_dir, update_dotdot, corrupt = 0; int err, is_dir, update_dotdot, corrupt = 0;
old_sinfo.bh = sinfo.bh = dotdot_bh = NULL; old_sinfo.bh = sinfo.bh = dotdot_bh = NULL;
...@@ -913,31 +913,24 @@ static int vfat_rename(struct inode *old_dir, struct dentry *old_dentry, ...@@ -913,31 +913,24 @@ static int vfat_rename(struct inode *old_dir, struct dentry *old_dentry,
ts = CURRENT_TIME_SEC; ts = CURRENT_TIME_SEC;
if (new_inode) { if (new_inode) {
err = vfat_find(new_dir, &new_dentry->d_name, &sinfo);
if (err)
goto out;
if (MSDOS_I(new_inode)->i_pos != sinfo.i_pos) {
/* WTF??? Cry and fail. */
printk(KERN_WARNING "vfat_rename: fs corrupted\n");
goto out;
}
if (is_dir) { if (is_dir) {
err = fat_dir_empty(new_inode); err = fat_dir_empty(new_inode);
if (err) if (err)
goto out; goto out;
} }
new_i_pos = MSDOS_I(new_inode)->i_pos;
fat_detach(new_inode); fat_detach(new_inode);
} else { } else {
err = vfat_add_entry(new_dir, &new_dentry->d_name, is_dir, 0, err = vfat_add_entry(new_dir, &new_dentry->d_name, is_dir, 0,
&ts, &sinfo); &ts, &sinfo);
if (err) if (err)
goto out; goto out;
new_i_pos = sinfo.i_pos;
} }
new_dir->i_version++; new_dir->i_version++;
fat_detach(old_inode); fat_detach(old_inode);
fat_attach(old_inode, sinfo.i_pos); fat_attach(old_inode, new_i_pos);
if (IS_DIRSYNC(new_dir)) { if (IS_DIRSYNC(new_dir)) {
err = fat_sync_inode(old_inode); err = fat_sync_inode(old_inode);
if (err) if (err)
...@@ -1001,7 +994,7 @@ static int vfat_rename(struct inode *old_dir, struct dentry *old_dentry, ...@@ -1001,7 +994,7 @@ static int vfat_rename(struct inode *old_dir, struct dentry *old_dentry,
fat_detach(old_inode); fat_detach(old_inode);
fat_attach(old_inode, old_sinfo.i_pos); fat_attach(old_inode, old_sinfo.i_pos);
if (new_inode) { if (new_inode) {
fat_attach(new_inode, sinfo.i_pos); fat_attach(new_inode, new_i_pos);
if (corrupt) if (corrupt)
corrupt |= fat_sync_inode(new_inode); corrupt |= fat_sync_inode(new_inode);
} else { } else {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment