summaryrefslogtreecommitdiff
path: root/fs/exfat/dir.c
diff options
context:
space:
mode:
authorYuezhang Mo <Yuezhang.Mo@sony.com>2022-08-05 15:55:58 +0800
committerNamjae Jeon <linkinjeon@kernel.org>2024-03-19 20:55:40 +0900
commitff4343da02e8918deca8ddc91f3855a454e96868 (patch)
tree59637e6d44d170f669cdcff9b7c6c6b85f09d4bf /fs/exfat/dir.c
parentcf8663fa994343941fbbd5c1a7f4d131c366ef2f (diff)
exfat: convert exfat_remove_entries() to use dentry cache
Before this conversion, in exfat_remove_entries(), to mark the dentries in a dentry set as deleted, the sync times is equals the dentry numbers if 'dirsync' or 'sync' is enabled. That affects not only performance but also device life. After this conversion, only needs to be synchronized once if 'dirsync' or 'sync' is enabled. 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: Sungjong Seo <sj1557.seo@samsung.com> Signed-off-by: Namjae Jeon <linkinjeon@kernel.org>
Diffstat (limited to 'fs/exfat/dir.c')
-rw-r--r--fs/exfat/dir.c17
1 files changed, 6 insertions, 11 deletions
diff --git a/fs/exfat/dir.c b/fs/exfat/dir.c
index 0065d2abc983..599dc81c9a08 100644
--- a/fs/exfat/dir.c
+++ b/fs/exfat/dir.c
@@ -577,28 +577,23 @@ int exfat_init_ext_entry(struct inode *inode, struct exfat_chain *p_dir,
return 0;
}
-int exfat_remove_entries(struct inode *inode, struct exfat_chain *p_dir,
- int entry, int order, int num_entries)
+void exfat_remove_entries(struct inode *inode, struct exfat_entry_set_cache *es,
+ int order)
{
- struct super_block *sb = inode->i_sb;
int i;
struct exfat_dentry *ep;
- struct buffer_head *bh;
- for (i = order; i < num_entries; i++) {
- ep = exfat_get_dentry(sb, p_dir, entry + i, &bh);
- if (!ep)
- return -EIO;
+ for (i = order; i < es->num_entries; i++) {
+ ep = exfat_get_dentry_cached(es, i);
if (exfat_get_entry_type(ep) & TYPE_BENIGN_SEC)
exfat_free_benign_secondary_clusters(inode, ep);
exfat_set_entry_type(ep, TYPE_DELETED);
- exfat_update_bh(bh, IS_DIRSYNC(inode));
- brelse(bh);
}
- return 0;
+ if (order < es->num_entries)
+ es->modified = true;
}
void exfat_update_dir_chksum_with_entry_set(struct exfat_entry_set_cache *es)