diff options
| author | Yuezhang Mo <Yuezhang.Mo@sony.com> | 2024-09-12 16:57:06 +0800 |
|---|---|---|
| committer | Namjae Jeon <linkinjeon@kernel.org> | 2024-11-25 17:08:27 +0900 |
| commit | 8a3f5711ad74db9881b289a6e34d7f3b700df720 (patch) | |
| tree | 921c983ed0f0581900e725a6967c29fdf458f502 /fs/exfat/dir.c | |
| parent | 6b151eb5df78dc1a1ea7c862834199e08ea11c7b (diff) | |
| download | linux-next-8a3f5711ad74db9881b289a6e34d7f3b700df720.tar.gz linux-next-8a3f5711ad74db9881b289a6e34d7f3b700df720.zip | |
exfat: reduce FAT chain traversal
Before this commit, ->dir and ->entry of exfat_inode_info record the
first cluster of the parent directory and the directory entry index
starting from this cluster.
The directory entry set will be gotten during write-back-inode/rmdir/
unlink/rename. If the clusters of the parent directory are not
continuous, the FAT chain will be traversed from the first cluster of
the parent directory to find the cluster where ->entry is located.
After this commit, ->dir records the cluster where the first directory
entry in the directory entry set is located, and ->entry records the
directory entry index in the cluster, so that there is almost no need
to access the FAT when getting the directory entry set.
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>
Diffstat (limited to 'fs/exfat/dir.c')
| -rw-r--r-- | fs/exfat/dir.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/fs/exfat/dir.c b/fs/exfat/dir.c index 24149e0ebb82..fe0a9b8a0cd0 100644 --- a/fs/exfat/dir.c +++ b/fs/exfat/dir.c @@ -148,7 +148,8 @@ 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->entry = dentry; + dir_entry->entry = i; + dir_entry->dir = clu; brelse(bh); ei->hint_bmap.off = EXFAT_DEN_TO_CLU(dentry, sbi); @@ -256,7 +257,7 @@ get_new: if (!nb->lfn[0]) goto end_of_dir; - i_pos = ((loff_t)ei->start_clu << 32) | (de.entry & 0xffffffff); + i_pos = ((loff_t)de.dir.dir << 32) | (de.entry & 0xffffffff); tmp = exfat_iget(sb, i_pos); if (tmp) { inum = tmp->i_ino; |
