aboutsummaryrefslogtreecommitdiffstats
path: root/fs
diff options
context:
space:
mode:
authorOGAWA Hirofumi <hirofumi@mail.parknet.co.jp>2005-10-30 18:03:50 -0500
committerLinus Torvalds <torvalds@g5.osdl.org>2005-10-30 20:37:32 -0500
commit9131dd4256f9598141ed374fcd47f6b4de8d2422 (patch)
tree03518a5de4f37619beb219eb2de2c48a572b99db /fs
parent451cbaa1c328082832a8fbcc427cd4416c602c5a (diff)
[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: OGAWA Hirofumi <hirofumi@mail.parknet.co.jp> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'fs')
-rw-r--r--fs/msdos/namei.c14
-rw-r--r--fs/vfat/namei.c17
2 files changed, 10 insertions, 21 deletions
diff --git a/fs/msdos/namei.c b/fs/msdos/namei.c
index 154f511c7245..626a367bcd81 100644
--- a/fs/msdos/namei.c
+++ b/fs/msdos/namei.c
@@ -454,10 +454,10 @@ static int do_msdos_rename(struct inode *old_dir, unsigned char *old_name,
454{ 454{
455 struct buffer_head *dotdot_bh; 455 struct buffer_head *dotdot_bh;
456 struct msdos_dir_entry *dotdot_de; 456 struct msdos_dir_entry *dotdot_de;
457 loff_t dotdot_i_pos;
458 struct inode *old_inode, *new_inode; 457 struct inode *old_inode, *new_inode;
459 struct fat_slot_info old_sinfo, sinfo; 458 struct fat_slot_info old_sinfo, sinfo;
460 struct timespec ts; 459 struct timespec ts;
460 loff_t dotdot_i_pos, new_i_pos;
461 int err, old_attrs, is_dir, update_dotdot, corrupt = 0; 461 int err, old_attrs, is_dir, update_dotdot, corrupt = 0;
462 462
463 old_sinfo.bh = sinfo.bh = dotdot_bh = NULL; 463 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 if (new_inode) { 516 if (new_inode) {
517 if (err) 517 if (err)
518 goto out; 518 goto out;
519 if (MSDOS_I(new_inode)->i_pos != sinfo.i_pos) {
520 /* WTF??? Cry and fail. */
521 printk(KERN_WARNING "msdos_rename: fs corrupted\n");
522 goto out;
523 }
524
525 if (is_dir) { 519 if (is_dir) {
526 err = fat_dir_empty(new_inode); 520 err = fat_dir_empty(new_inode);
527 if (err) 521 if (err)
528 goto out; 522 goto out;
529 } 523 }
524 new_i_pos = MSDOS_I(new_inode)->i_pos;
530 fat_detach(new_inode); 525 fat_detach(new_inode);
531 } else { 526 } else {
532 err = msdos_add_entry(new_dir, new_name, is_dir, is_hid, 0, 527 err = msdos_add_entry(new_dir, new_name, is_dir, is_hid, 0,
533 &ts, &sinfo); 528 &ts, &sinfo);
534 if (err) 529 if (err)
535 goto out; 530 goto out;
531 new_i_pos = sinfo.i_pos;
536 } 532 }
537 new_dir->i_version++; 533 new_dir->i_version++;
538 534
539 fat_detach(old_inode); 535 fat_detach(old_inode);
540 fat_attach(old_inode, sinfo.i_pos); 536 fat_attach(old_inode, new_i_pos);
541 if (is_hid) 537 if (is_hid)
542 MSDOS_I(old_inode)->i_attrs |= ATTR_HIDDEN; 538 MSDOS_I(old_inode)->i_attrs |= ATTR_HIDDEN;
543 else 539 else
@@ -604,7 +600,7 @@ error_inode:
604 fat_attach(old_inode, old_sinfo.i_pos); 600 fat_attach(old_inode, old_sinfo.i_pos);
605 MSDOS_I(old_inode)->i_attrs = old_attrs; 601 MSDOS_I(old_inode)->i_attrs = old_attrs;
606 if (new_inode) { 602 if (new_inode) {
607 fat_attach(new_inode, sinfo.i_pos); 603 fat_attach(new_inode, new_i_pos);
608 if (corrupt) 604 if (corrupt)
609 corrupt |= fat_sync_inode(new_inode); 605 corrupt |= fat_sync_inode(new_inode);
610 } else { 606 } else {
diff --git a/fs/vfat/namei.c b/fs/vfat/namei.c
index 467346b123d9..ef46939c0c1a 100644
--- a/fs/vfat/namei.c
+++ b/fs/vfat/namei.c
@@ -887,10 +887,10 @@ static int vfat_rename(struct inode *old_dir, struct dentry *old_dentry,
887{ 887{
888 struct buffer_head *dotdot_bh; 888 struct buffer_head *dotdot_bh;
889 struct msdos_dir_entry *dotdot_de; 889 struct msdos_dir_entry *dotdot_de;
890 loff_t dotdot_i_pos;
891 struct inode *old_inode, *new_inode; 890 struct inode *old_inode, *new_inode;
892 struct fat_slot_info old_sinfo, sinfo; 891 struct fat_slot_info old_sinfo, sinfo;
893 struct timespec ts; 892 struct timespec ts;
893 loff_t dotdot_i_pos, new_i_pos;
894 int err, is_dir, update_dotdot, corrupt = 0; 894 int err, is_dir, update_dotdot, corrupt = 0;
895 895
896 old_sinfo.bh = sinfo.bh = dotdot_bh = NULL; 896 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 913
914 ts = CURRENT_TIME_SEC; 914 ts = CURRENT_TIME_SEC;
915 if (new_inode) { 915 if (new_inode) {
916 err = vfat_find(new_dir, &new_dentry->d_name, &sinfo);
917 if (err)
918 goto out;
919 if (MSDOS_I(new_inode)->i_pos != sinfo.i_pos) {
920 /* WTF??? Cry and fail. */
921 printk(KERN_WARNING "vfat_rename: fs corrupted\n");
922 goto out;
923 }
924
925 if (is_dir) { 916 if (is_dir) {
926 err = fat_dir_empty(new_inode); 917 err = fat_dir_empty(new_inode);
927 if (err) 918 if (err)
928 goto out; 919 goto out;
929 } 920 }
921 new_i_pos = MSDOS_I(new_inode)->i_pos;
930 fat_detach(new_inode); 922 fat_detach(new_inode);
931 } else { 923 } else {
932 err = vfat_add_entry(new_dir, &new_dentry->d_name, is_dir, 0, 924 err = vfat_add_entry(new_dir, &new_dentry->d_name, is_dir, 0,
933 &ts, &sinfo); 925 &ts, &sinfo);
934 if (err) 926 if (err)
935 goto out; 927 goto out;
928 new_i_pos = sinfo.i_pos;
936 } 929 }
937 new_dir->i_version++; 930 new_dir->i_version++;
938 931
939 fat_detach(old_inode); 932 fat_detach(old_inode);
940 fat_attach(old_inode, sinfo.i_pos); 933 fat_attach(old_inode, new_i_pos);
941 if (IS_DIRSYNC(new_dir)) { 934 if (IS_DIRSYNC(new_dir)) {
942 err = fat_sync_inode(old_inode); 935 err = fat_sync_inode(old_inode);
943 if (err) 936 if (err)
@@ -1001,7 +994,7 @@ error_inode:
1001 fat_detach(old_inode); 994 fat_detach(old_inode);
1002 fat_attach(old_inode, old_sinfo.i_pos); 995 fat_attach(old_inode, old_sinfo.i_pos);
1003 if (new_inode) { 996 if (new_inode) {
1004 fat_attach(new_inode, sinfo.i_pos); 997 fat_attach(new_inode, new_i_pos);
1005 if (corrupt) 998 if (corrupt)
1006 corrupt |= fat_sync_inode(new_inode); 999 corrupt |= fat_sync_inode(new_inode);
1007 } else { 1000 } else {