diff options
author | Yuezhang Mo <Yuezhang.Mo@sony.com> | 2022-08-04 16:01:50 +0800 |
---|---|---|
committer | Namjae Jeon <linkinjeon@kernel.org> | 2024-03-19 20:55:36 +0900 |
commit | cf8663fa994343941fbbd5c1a7f4d131c366ef2f (patch) | |
tree | e3741fdc849fa9b3ede4e59161b1af3cbb25d116 /fs/exfat/namei.c | |
parent | exfat: add exfat_get_empty_dentry_set() helper (diff) | |
download | wireguard-linux-cf8663fa994343941fbbd5c1a7f4d131c366ef2f.tar.xz wireguard-linux-cf8663fa994343941fbbd5c1a7f4d131c366ef2f.zip |
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 <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 '')
-rw-r--r-- | fs/exfat/namei.c | 12 |
1 files changed, 10 insertions, 2 deletions
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; |