]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
exfat: code cleanup for exfat_readdir()
authorYuezhang Mo <Yuezhang.Mo@sony.com>
Thu, 12 Sep 2024 09:07:01 +0000 (17:07 +0800)
committerNamjae Jeon <linkinjeon@kernel.org>
Mon, 25 Nov 2024 08:08:26 +0000 (17:08 +0900)
For the root directory and other directories, the clusters
allocated to them can be obtained from exfat_inode_info, and
there is no need to distinguish them.

And there is no need to initialize atime/ctime/mtime/size in
exfat_readdir(), because exfat_iterate() does not use them.

Signed-off-by: Yuezhang Mo <Yuezhang.Mo@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>
fs/exfat/dir.c

index 7446bf09a04a8f4b9923a98bce347985b2fa7d9a..24149e0ebb82d30394b8c5ba0009f1f384cbcbec 100644 (file)
@@ -82,11 +82,8 @@ static int exfat_readdir(struct inode *inode, loff_t *cpos, struct exfat_dir_ent
        if (ei->type != TYPE_DIR)
                return -EPERM;
 
-       if (ei->entry == -1)
-               exfat_chain_set(&dir, sbi->root_dir, 0, ALLOC_FAT_CHAIN);
-       else
-               exfat_chain_set(&dir, ei->start_clu,
-                       EXFAT_B_TO_CLU(i_size_read(inode), sbi), ei->flags);
+       exfat_chain_set(&dir, ei->start_clu,
+               EXFAT_B_TO_CLU(i_size_read(inode), sbi), ei->flags);
 
        dentries_per_clu = sbi->dentries_per_clu;
        max_dentries = (unsigned int)min_t(u64, MAX_EXFAT_DENTRIES,
@@ -135,21 +132,6 @@ static int exfat_readdir(struct inode *inode, loff_t *cpos, struct exfat_dir_ent
 
                        num_ext = ep->dentry.file.num_ext;
                        dir_entry->attr = le16_to_cpu(ep->dentry.file.attr);
-                       exfat_get_entry_time(sbi, &dir_entry->crtime,
-                                       ep->dentry.file.create_tz,
-                                       ep->dentry.file.create_time,
-                                       ep->dentry.file.create_date,
-                                       ep->dentry.file.create_time_cs);
-                       exfat_get_entry_time(sbi, &dir_entry->mtime,
-                                       ep->dentry.file.modify_tz,
-                                       ep->dentry.file.modify_time,
-                                       ep->dentry.file.modify_date,
-                                       ep->dentry.file.modify_time_cs);
-                       exfat_get_entry_time(sbi, &dir_entry->atime,
-                                       ep->dentry.file.access_tz,
-                                       ep->dentry.file.access_time,
-                                       ep->dentry.file.access_date,
-                                       0);
 
                        *uni_name.name = 0x0;
                        err = exfat_get_uniname_from_ext_entry(sb, &clu, i,
@@ -166,8 +148,6 @@ static int exfat_readdir(struct inode *inode, loff_t *cpos, struct exfat_dir_ent
                        ep = exfat_get_dentry(sb, &clu, i + 1, &bh);
                        if (!ep)
                                return -EIO;
-                       dir_entry->size =
-                               le64_to_cpu(ep->dentry.stream.valid_size);
                        dir_entry->entry = dentry;
                        brelse(bh);