From cf8663fa994343941fbbd5c1a7f4d131c366ef2f Mon Sep 17 00:00:00 2001 From: Yuezhang Mo Date: Thu, 4 Aug 2022 16:01:50 +0800 Subject: exfat: convert exfat_add_entry() to use dentry cache After this conversion, if "dirsync" or "sync" is enabled, the number of synchronized dentries in exfat_add_entry() will change from 2 to 1. Signed-off-by: Yuezhang Mo Reviewed-by: Andy Wu Reviewed-by: Aoyama Wataru Reviewed-by: Sungjong Seo Signed-off-by: Namjae Jeon --- fs/exfat/namei.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) (limited to 'fs/exfat/namei.c') diff --git a/fs/exfat/namei.c b/fs/exfat/namei.c index 9c549fd11fc8..07506f3882bb 100644 --- a/fs/exfat/namei.c +++ b/fs/exfat/namei.c @@ -499,6 +499,8 @@ static int exfat_add_entry(struct inode *inode, const char *path, struct exfat_sb_info *sbi = EXFAT_SB(sb); struct exfat_uni_name uniname; struct exfat_chain clu; + struct timespec64 ts = current_time(inode); + struct exfat_entry_set_cache es; int clu_size = 0; unsigned int start_clu = EXFAT_FREE_CLUSTER; @@ -531,8 +533,14 @@ static int exfat_add_entry(struct inode *inode, const char *path, /* fill the dos name directory entry information of the created file. * the first cluster is not determined yet. (0) */ - ret = exfat_init_dir_entry(inode, p_dir, dentry, type, - start_clu, clu_size); + + ret = exfat_get_empty_dentry_set(&es, sb, p_dir, dentry, num_entries); + if (ret) + goto out; + + exfat_init_dir_entry(&es, type, start_clu, clu_size, &ts); + + ret = exfat_put_dentry_set(&es, IS_DIRSYNC(inode)); if (ret) goto out; -- cgit v1.2.3-59-g8ed1b