diff options
author | Yuezhang Mo <Yuezhang.Mo@sony.com> | 2023-07-20 09:40:08 +0300 |
---|---|---|
committer | Namjae Jeon <linkinjeon@kernel.org> | 2023-10-31 04:01:45 +0300 |
commit | ee785c15b5906a69d4007b4754e8ae40fb41e0b4 (patch) | |
tree | d5960f2815f9fa05ae3310aadad0670aebee52a4 /fs/exfat/namei.c | |
parent | dab48b8f2fe7264d51ec9eed0adea0fe3c78830a (diff) | |
download | linux-ee785c15b5906a69d4007b4754e8ae40fb41e0b4.tar.xz |
exfat: support create zero-size directory
This commit adds mount option 'zero_size_dir'. If this option
enabled, don't allocate a cluster to directory when creating
it, and set the directory size to 0.
On Windows, a cluster is allocated for a directory when it is
created, so the mount option is disabled by default.
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>
Signed-off-by: Namjae Jeon <linkinjeon@kernel.org>
Diffstat (limited to 'fs/exfat/namei.c')
-rw-r--r-- | fs/exfat/namei.c | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/fs/exfat/namei.c b/fs/exfat/namei.c index 1e9c945130f4..5d737e0b639a 100644 --- a/fs/exfat/namei.c +++ b/fs/exfat/namei.c @@ -518,7 +518,7 @@ static int exfat_add_entry(struct inode *inode, const char *path, goto out; } - if (type == TYPE_DIR) { + if (type == TYPE_DIR && !sbi->options.zero_size_dir) { ret = exfat_alloc_new_dir(inode, &clu); if (ret) goto out; @@ -551,7 +551,10 @@ static int exfat_add_entry(struct inode *inode, const char *path, info->num_subdirs = 0; } else { info->attr = EXFAT_ATTR_SUBDIR; - info->start_clu = start_clu; + if (sbi->options.zero_size_dir) + info->start_clu = EXFAT_EOF_CLUSTER; + else + info->start_clu = start_clu; info->size = clu_size; info->num_subdirs = EXFAT_MIN_SUBDIR; } |