
From: OGAWA Hirofumi <hirofumi@mail.parknet.co.jp>

Signed-off-by: OGAWA Hirofumi <hirofumi@mail.parknet.co.jp>
Signed-off-by: Andrew Morton <akpm@osdl.org>
---

 25-akpm/fs/msdos/namei.c |   37 +++++++++++++++++--------------------
 1 files changed, 17 insertions(+), 20 deletions(-)

diff -puN fs/msdos/namei.c~fat-use-fat_remove_entries-for-msdos fs/msdos/namei.c
--- 25/fs/msdos/namei.c~fat-use-fat_remove_entries-for-msdos	Sun Mar  6 17:13:24 2005
+++ 25-akpm/fs/msdos/namei.c	Sun Mar  6 17:13:24 2005
@@ -346,16 +346,15 @@ static int msdos_rmdir(struct inode *dir
 	if (err)
 		goto out;
 
-	sinfo.de->name[0] = DELETED_FLAG;
-	mark_buffer_dirty(sinfo.bh);
-	brelse(sinfo.bh);
-	fat_detach(inode);
+	err = fat_remove_entries(dir, &sinfo);	/* and releases bh */
+	if (err)
+		goto out;
+	dir->i_nlink--;
+
 	inode->i_nlink = 0;
-	inode->i_ctime = dir->i_ctime = dir->i_mtime = CURRENT_TIME_SEC;
+	inode->i_ctime = CURRENT_TIME_SEC;
+	fat_detach(inode);
 	mark_inode_dirty(inode);
-
-	dir->i_nlink--;
-	mark_inode_dirty(dir);
 out:
 	unlock_kernel();
 
@@ -430,18 +429,16 @@ static int msdos_unlink(struct inode *di
 	lock_kernel();
 	err = msdos_find(dir, dentry->d_name.name, dentry->d_name.len, &sinfo);
 	if (err)
-		goto unlink_done;
+		goto out;
 
-	sinfo.de->name[0] = DELETED_FLAG;
-	mark_buffer_dirty(sinfo.bh);
-	brelse(sinfo.bh);
-	fat_detach(inode);
+	err = fat_remove_entries(dir, &sinfo);	/* and releases bh */
+	if (err)
+		goto out;
 	inode->i_nlink = 0;
-	inode->i_ctime = dir->i_ctime = dir->i_mtime = CURRENT_TIME_SEC;
+	inode->i_ctime = CURRENT_TIME_SEC;
+	fat_detach(inode);
 	mark_inode_dirty(inode);
-
-	mark_inode_dirty(dir);
-unlink_done:
+out:
 	unlock_kernel();
 
 	return err;
@@ -526,10 +523,10 @@ static int do_msdos_rename(struct inode 
 	}
 	new_dir->i_version++;
 
-	old_sinfo.de->name[0] = DELETED_FLAG;
-	mark_buffer_dirty(old_sinfo.bh);
-	brelse(old_sinfo.bh);
+	err = fat_remove_entries(old_dir, &old_sinfo);	/* and releases bh */
 	old_sinfo.bh = NULL;
+	if (err)
+		goto out;
 	if (is_dir)
 		old_dir->i_nlink--;
 	fat_detach(old_inode);
_
