Now that fat_sync_inode() ends up writing all metadata buffers associated with the inode, it isn't necessary to write them out explicitely using sync_dirty_buffer(). Remove the unnecessary calls. Signed-off-by: Jan Kara --- fs/fat/dir.c | 14 -------------- fs/fat/namei_msdos.c | 20 +++++++------------- 2 files changed, 7 insertions(+), 27 deletions(-) diff --git a/fs/fat/dir.c b/fs/fat/dir.c index 4f6f42f33613..a54e6d125794 100644 --- a/fs/fat/dir.c +++ b/fs/fat/dir.c @@ -1028,8 +1028,6 @@ static int __fat_remove_entries(struct inode *dir, loff_t pos, int nr_slots) nr_slots--; } mmb_mark_buffer_dirty(bh, &MSDOS_I(dir)->i_metadata_bhs); - if (IS_DIRSYNC(dir)) - err = sync_dirty_buffer(bh); brelse(bh); if (err) break; @@ -1063,8 +1061,6 @@ int fat_remove_entries(struct inode *dir, struct fat_slot_info *sinfo) nr_slots--; } mmb_mark_buffer_dirty(bh, &MSDOS_I(dir)->i_metadata_bhs); - if (IS_DIRSYNC(dir)) - err = sync_dirty_buffer(bh); brelse(bh); if (err) return err; @@ -1119,21 +1115,11 @@ static int fat_zeroed_cluster(struct inode *dir, sector_t blknr, int nr_used, n++; blknr++; if (n == nr_bhs) { - if (IS_DIRSYNC(dir)) { - err = fat_sync_bhs(bhs, n); - if (err) - goto error; - } for (i = 0; i < n; i++) brelse(bhs[i]); n = 0; } } - if (IS_DIRSYNC(dir)) { - err = fat_sync_bhs(bhs, n); - if (err) - goto error; - } for (i = 0; i < n; i++) brelse(bhs[i]); diff --git a/fs/fat/namei_msdos.c b/fs/fat/namei_msdos.c index 0fd2971ad4b1..4e20f8498938 100644 --- a/fs/fat/namei_msdos.c +++ b/fs/fat/namei_msdos.c @@ -518,26 +518,21 @@ static int do_msdos_rename(struct inode *old_dir, unsigned char *old_name, MSDOS_I(old_inode)->i_attrs |= ATTR_HIDDEN; else MSDOS_I(old_inode)->i_attrs &= ~ATTR_HIDDEN; - if (IS_DIRSYNC(new_dir)) { - err = fat_sync_inode(old_inode); - if (err) - goto error_inode; - } else - mark_inode_dirty(old_inode); - if (update_dotdot) { fat_set_start(dotdot_de, MSDOS_I(new_dir)->i_logstart); mmb_mark_buffer_dirty(dotdot_bh, &MSDOS_I(old_inode)->i_metadata_bhs); - if (IS_DIRSYNC(new_dir)) { - err = sync_dirty_buffer(dotdot_bh); - if (err) - goto error_dotdot; - } drop_nlink(old_dir); if (!new_inode) inc_nlink(new_dir); } + if (IS_DIRSYNC(new_dir)) { + err = fat_sync_inode(old_inode); + if (err) + goto error_dotdot; + } else + mark_inode_dirty(old_inode); + err = fat_remove_entries(old_dir, &old_sinfo); /* and releases bh */ old_sinfo.bh = NULL; @@ -571,7 +566,6 @@ static int do_msdos_rename(struct inode *old_dir, unsigned char *old_name, &MSDOS_I(old_inode)->i_metadata_bhs); corrupt |= sync_dirty_buffer(dotdot_bh); } -error_inode: fat_detach(old_inode); fat_attach(old_inode, old_sinfo.i_pos); MSDOS_I(old_inode)->i_attrs = old_attrs; -- 2.51.0