Skip to content

Commit 6b151eb

Browse files
YuezhangMonamjaejeon
authored andcommitted
exfat: code cleanup for exfat_readdir()
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 <[email protected]> Reviewed-by: Aoyama Wataru <[email protected]> Reviewed-by: Daniel Palmer <[email protected]> Reviewed-by: Sungjong Seo <[email protected]> Signed-off-by: Namjae Jeon <[email protected]>
1 parent 33a8666 commit 6b151eb

File tree

1 file changed

+2
-22
lines changed

1 file changed

+2
-22
lines changed

fs/exfat/dir.c

Lines changed: 2 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -82,11 +82,8 @@ static int exfat_readdir(struct inode *inode, loff_t *cpos, struct exfat_dir_ent
8282
if (ei->type != TYPE_DIR)
8383
return -EPERM;
8484

85-
if (ei->entry == -1)
86-
exfat_chain_set(&dir, sbi->root_dir, 0, ALLOC_FAT_CHAIN);
87-
else
88-
exfat_chain_set(&dir, ei->start_clu,
89-
EXFAT_B_TO_CLU(i_size_read(inode), sbi), ei->flags);
85+
exfat_chain_set(&dir, ei->start_clu,
86+
EXFAT_B_TO_CLU(i_size_read(inode), sbi), ei->flags);
9087

9188
dentries_per_clu = sbi->dentries_per_clu;
9289
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
135132

136133
num_ext = ep->dentry.file.num_ext;
137134
dir_entry->attr = le16_to_cpu(ep->dentry.file.attr);
138-
exfat_get_entry_time(sbi, &dir_entry->crtime,
139-
ep->dentry.file.create_tz,
140-
ep->dentry.file.create_time,
141-
ep->dentry.file.create_date,
142-
ep->dentry.file.create_time_cs);
143-
exfat_get_entry_time(sbi, &dir_entry->mtime,
144-
ep->dentry.file.modify_tz,
145-
ep->dentry.file.modify_time,
146-
ep->dentry.file.modify_date,
147-
ep->dentry.file.modify_time_cs);
148-
exfat_get_entry_time(sbi, &dir_entry->atime,
149-
ep->dentry.file.access_tz,
150-
ep->dentry.file.access_time,
151-
ep->dentry.file.access_date,
152-
0);
153135

154136
*uni_name.name = 0x0;
155137
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
166148
ep = exfat_get_dentry(sb, &clu, i + 1, &bh);
167149
if (!ep)
168150
return -EIO;
169-
dir_entry->size =
170-
le64_to_cpu(ep->dentry.stream.valid_size);
171151
dir_entry->entry = dentry;
172152
brelse(bh);
173153

0 commit comments

Comments
 (0)