diff --git a/file.c b/file.c index 6b45fdb..1b28930 100644 --- a/file.c +++ b/file.c @@ -233,8 +233,6 @@ int __exfat_truncate(struct inode *inode, loff_t new_size) if (exfat_free_cluster(inode, &clu)) return -EIO; - exfat_clear_volume_dirty(sb); - return 0; } diff --git a/namei.c b/namei.c index b5b67e5..2cc809c 100644 --- a/namei.c +++ b/namei.c @@ -608,7 +608,6 @@ static int exfat_create(struct inode *dir, struct dentry *dentry, umode_t mode, exfat_set_volume_dirty(sb); err = exfat_add_entry(dir, dentry->d_name.name, &cdir, TYPE_FILE, &info); - exfat_clear_volume_dirty(sb); if (err) goto unlock; @@ -896,7 +895,6 @@ static int exfat_unlink(struct inode *dir, struct dentry *dentry) /* This doesn't modify ei */ ei->dir.dir = DIR_DELETED; - exfat_clear_volume_dirty(sb); #if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 16, 0) inode_inc_iversion(dir); @@ -950,7 +948,6 @@ static int exfat_mkdir(struct inode *dir, struct dentry *dentry, umode_t mode) exfat_set_volume_dirty(sb); err = exfat_add_entry(dir, dentry->d_name.name, &cdir, TYPE_DIR, &info); - exfat_clear_volume_dirty(sb); if (err) goto unlock; @@ -1098,7 +1095,6 @@ static int exfat_rmdir(struct inode *dir, struct dentry *dentry) goto unlock; } ei->dir.dir = DIR_DELETED; - exfat_clear_volume_dirty(sb); #if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 16, 0) inode_inc_iversion(dir); @@ -1449,7 +1445,6 @@ static int __exfat_rename(struct inode *old_parent_inode, */ new_ei->dir.dir = DIR_DELETED; } - exfat_clear_volume_dirty(sb); out: return ret; } diff --git a/super.c b/super.c index 12f56e8..615e52d 100644 --- a/super.c +++ b/super.c @@ -113,7 +113,6 @@ static int exfat_set_vol_flags(struct super_block *sb, unsigned short new_flags) { struct exfat_sb_info *sbi = EXFAT_SB(sb); struct boot_sector *p_boot = (struct boot_sector *)sbi->boot_bh->b_data; - bool sync; /* retain persistent-flags */ new_flags |= sbi->vol_flags_persistent; @@ -136,16 +135,15 @@ static int exfat_set_vol_flags(struct super_block *sb, unsigned short new_flags) p_boot->vol_flags = cpu_to_le16(new_flags); - if ((new_flags & VOLUME_DIRTY) && !buffer_dirty(sbi->boot_bh)) - sync = true; - else - sync = false; - set_buffer_uptodate(sbi->boot_bh); mark_buffer_dirty(sbi->boot_bh); - if (sync) - sync_dirty_buffer(sbi->boot_bh); +#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 8, 0) + __sync_dirty_buffer(sbi->boot_bh, REQ_SYNC | REQ_FUA | REQ_PREFLUSH); +#else + __sync_dirty_buffer(sbi->boot_bh, REQ_SYNC | REQ_FUA | REQ_FLUSH); +#endif + return 0; }