summaryrefslogtreecommitdiff
path: root/fs/exfat
diff options
context:
space:
mode:
authorYuezhang Mo <Yuezhang.Mo@sony.com>2022-06-29 11:05:51 +0800
committerNamjae Jeon <linkinjeon@kernel.org>2022-08-01 10:14:06 +0900
commitbe17b1ccd4e82a66b9d9676dec8edce137e967d8 (patch)
tree3d92a6365494e6251dbaf49c08cac8d8d9c79fc1 /fs/exfat
parent4493895b2bdcca135a8e7c1384deaa35316e8e22 (diff)
exfat: remove duplicate write inode for extending dir/file
Since the timestamps need to be updated, the directory entries will be updated by mark_inode_dirty() whether or not a new cluster is allocated for the file or directory, so there is no need to use __exfat_write_inode() to update the directory entries when allocating a new cluster for a file or directory. Signed-off-by: Yuezhang Mo <Yuezhang.Mo@sony.com> Reviewed-by: Andy Wu <Andy.Wu@sony.com> Reviewed-by: Aoyama Wataru <wataru.aoyama@sony.com> Reviewed-by: Daniel Palmer <daniel.palmer@sony.com> Reviewed-by: Sungjong Seo <sj1557.seo@samsung.com> Signed-off-by: Namjae Jeon <linkinjeon@kernel.org>
Diffstat (limited to 'fs/exfat')
-rw-r--r--fs/exfat/inode.c9
-rw-r--r--fs/exfat/namei.c4
2 files changed, 1 insertions, 12 deletions
diff --git a/fs/exfat/inode.c b/fs/exfat/inode.c
index 3acfbec1a0d4..a795437b86d0 100644
--- a/fs/exfat/inode.c
+++ b/fs/exfat/inode.c
@@ -112,7 +112,7 @@ void exfat_sync_inode(struct inode *inode)
static int exfat_map_cluster(struct inode *inode, unsigned int clu_offset,
unsigned int *clu, int create)
{
- int ret, modified = false;
+ int ret;
unsigned int last_clu;
struct exfat_chain new_clu;
struct super_block *sb = inode->i_sb;
@@ -203,7 +203,6 @@ static int exfat_map_cluster(struct inode *inode, unsigned int clu_offset,
if (new_clu.flags == ALLOC_FAT_CHAIN)
ei->flags = ALLOC_FAT_CHAIN;
ei->start_clu = new_clu.dir;
- modified = true;
} else {
if (new_clu.flags != ei->flags) {
/* no-fat-chain bit is disabled,
@@ -213,7 +212,6 @@ static int exfat_map_cluster(struct inode *inode, unsigned int clu_offset,
exfat_chain_cont_cluster(sb, ei->start_clu,
num_clusters);
ei->flags = ALLOC_FAT_CHAIN;
- modified = true;
}
if (new_clu.flags == ALLOC_FAT_CHAIN)
if (exfat_ent_set(sb, last_clu, new_clu.dir))
@@ -223,11 +221,6 @@ static int exfat_map_cluster(struct inode *inode, unsigned int clu_offset,
num_clusters += num_to_be_allocated;
*clu = new_clu.dir;
- if (modified) {
- if (__exfat_write_inode(inode, inode_needs_sync(inode)))
- return -EIO;
- }
-
inode->i_blocks +=
num_to_be_allocated << sbi->sect_per_clus_bits;
diff --git a/fs/exfat/namei.c b/fs/exfat/namei.c
index d640f9de16a9..7fac9c4b60cf 100644
--- a/fs/exfat/namei.c
+++ b/fs/exfat/namei.c
@@ -388,10 +388,6 @@ static int exfat_find_empty_entry(struct inode *inode,
ei->i_size_aligned += sbi->cluster_size;
ei->flags = p_dir->flags;
inode->i_blocks += 1 << sbi->sect_per_clus_bits;
-
- /* update the directory entry */
- if (__exfat_write_inode(inode, IS_DIRSYNC(inode)))
- return -EIO;
}
return dentry;