|
Kmods SIG |
50e2b3 |
From 04cee52fb8bdbdb0506460f191ed6fd9e6faf00b Mon Sep 17 00:00:00 2001
|
|
Kmods SIG |
50e2b3 |
From: Tetsuhiro Kohada <kohada.t2@gmail.com>
|
|
Kmods SIG |
50e2b3 |
Date: Thu, 17 Sep 2020 10:39:16 +0900
|
|
Kmods SIG |
50e2b3 |
Subject: [Backport 04cee52fb8bd] exfat: remove 'rwoffset' in exfat_inode_info
|
|
Kmods SIG |
50e2b3 |
|
|
Kmods SIG |
50e2b3 |
Remove 'rwoffset' in exfat_inode_info and replace it with the parameter of
|
|
Kmods SIG |
50e2b3 |
exfat_readdir().
|
|
Kmods SIG |
50e2b3 |
Since rwoffset is referenced only by exfat_readdir(), it is not necessary
|
|
Kmods SIG |
50e2b3 |
a exfat_inode_info's member.
|
|
Kmods SIG |
50e2b3 |
Also, change cpos to point to the next of entry-set, and return the index
|
|
Kmods SIG |
50e2b3 |
of dir-entry via dir_entry->entry.
|
|
Kmods SIG |
50e2b3 |
|
|
Kmods SIG |
50e2b3 |
Signed-off-by: Tetsuhiro Kohada <kohada.t2@gmail.com>
|
|
Kmods SIG |
50e2b3 |
Acked-by: Sungjong Seo <sj1557.seo@samsung.com>
|
|
Kmods SIG |
50e2b3 |
Signed-off-by: Namjae Jeon <namjae.jeon@samsung.com>
|
|
Kmods SIG |
50e2b3 |
---
|
|
Kmods SIG |
50e2b3 |
src/dir.c | 21 +++++++++------------
|
|
Kmods SIG |
50e2b3 |
src/exfat_fs.h | 2 --
|
|
Kmods SIG |
50e2b3 |
src/file.c | 2 --
|
|
Kmods SIG |
50e2b3 |
src/inode.c | 3 ---
|
|
Kmods SIG |
50e2b3 |
src/super.c | 1 -
|
|
Kmods SIG |
50e2b3 |
5 files changed, 9 insertions(+), 20 deletions(-)
|
|
Kmods SIG |
50e2b3 |
|
|
Kmods SIG |
50e2b3 |
diff --git a/src/dir.c b/src/dir.c
|
|
Kmods SIG |
50e2b3 |
index 5fa751937932f589c3f633c99ba0efd1aadad57e..916797077aad4ab45cd73c36a5012fd2653fef33 100644
|
|
Kmods SIG |
50e2b3 |
--- a/src/dir.c
|
|
Kmods SIG |
50e2b3 |
+++ b/src/dir.c
|
|
Kmods SIG |
50e2b3 |
@@ -59,9 +59,9 @@ static void exfat_get_uniname_from_ext_entry(struct super_block *sb,
|
|
Kmods SIG |
50e2b3 |
}
|
|
Kmods SIG |
50e2b3 |
|
|
Kmods SIG |
50e2b3 |
/* read a directory entry from the opened directory */
|
|
Kmods SIG |
50e2b3 |
-static int exfat_readdir(struct inode *inode, struct exfat_dir_entry *dir_entry)
|
|
Kmods SIG |
50e2b3 |
+static int exfat_readdir(struct inode *inode, loff_t *cpos, struct exfat_dir_entry *dir_entry)
|
|
Kmods SIG |
50e2b3 |
{
|
|
Kmods SIG |
50e2b3 |
- int i, dentries_per_clu, dentries_per_clu_bits = 0;
|
|
Kmods SIG |
50e2b3 |
+ int i, dentries_per_clu, dentries_per_clu_bits = 0, num_ext;
|
|
Kmods SIG |
50e2b3 |
unsigned int type, clu_offset;
|
|
Kmods SIG |
50e2b3 |
sector_t sector;
|
|
Kmods SIG |
50e2b3 |
struct exfat_chain dir, clu;
|
|
Kmods SIG |
50e2b3 |
@@ -70,7 +70,7 @@ static int exfat_readdir(struct inode *inode, struct exfat_dir_entry *dir_entry)
|
|
Kmods SIG |
50e2b3 |
struct super_block *sb = inode->i_sb;
|
|
Kmods SIG |
50e2b3 |
struct exfat_sb_info *sbi = EXFAT_SB(sb);
|
|
Kmods SIG |
50e2b3 |
struct exfat_inode_info *ei = EXFAT_I(inode);
|
|
Kmods SIG |
50e2b3 |
- unsigned int dentry = ei->rwoffset & 0xFFFFFFFF;
|
|
Kmods SIG |
50e2b3 |
+ unsigned int dentry = EXFAT_B_TO_DEN(*cpos) & 0xFFFFFFFF;
|
|
Kmods SIG |
50e2b3 |
struct buffer_head *bh;
|
|
Kmods SIG |
50e2b3 |
|
|
Kmods SIG |
50e2b3 |
/* check if the given file ID is opened */
|
|
Kmods SIG |
50e2b3 |
@@ -127,6 +127,7 @@ static int exfat_readdir(struct inode *inode, struct exfat_dir_entry *dir_entry)
|
|
Kmods SIG |
50e2b3 |
continue;
|
|
Kmods SIG |
50e2b3 |
}
|
|
Kmods SIG |
50e2b3 |
|
|
Kmods SIG |
50e2b3 |
+ num_ext = ep->dentry.file.num_ext;
|
|
Kmods SIG |
50e2b3 |
dir_entry->attr = le16_to_cpu(ep->dentry.file.attr);
|
|
Kmods SIG |
50e2b3 |
exfat_get_entry_time(sbi, &dir_entry->crtime,
|
|
Kmods SIG |
50e2b3 |
ep->dentry.file.create_tz,
|
|
Kmods SIG |
50e2b3 |
@@ -157,12 +158,13 @@ static int exfat_readdir(struct inode *inode, struct exfat_dir_entry *dir_entry)
|
|
Kmods SIG |
50e2b3 |
return -EIO;
|
|
Kmods SIG |
50e2b3 |
dir_entry->size =
|
|
Kmods SIG |
50e2b3 |
le64_to_cpu(ep->dentry.stream.valid_size);
|
|
Kmods SIG |
50e2b3 |
+ dir_entry->entry = dentry;
|
|
Kmods SIG |
50e2b3 |
brelse(bh);
|
|
Kmods SIG |
50e2b3 |
|
|
Kmods SIG |
50e2b3 |
ei->hint_bmap.off = dentry >> dentries_per_clu_bits;
|
|
Kmods SIG |
50e2b3 |
ei->hint_bmap.clu = clu.dir;
|
|
Kmods SIG |
50e2b3 |
|
|
Kmods SIG |
50e2b3 |
- ei->rwoffset = ++dentry;
|
|
Kmods SIG |
50e2b3 |
+ *cpos = EXFAT_DEN_TO_B(dentry + 1 + num_ext);
|
|
Kmods SIG |
50e2b3 |
return 0;
|
|
Kmods SIG |
50e2b3 |
}
|
|
Kmods SIG |
50e2b3 |
|
|
Kmods SIG |
50e2b3 |
@@ -178,7 +180,7 @@ static int exfat_readdir(struct inode *inode, struct exfat_dir_entry *dir_entry)
|
|
Kmods SIG |
50e2b3 |
}
|
|
Kmods SIG |
50e2b3 |
|
|
Kmods SIG |
50e2b3 |
dir_entry->namebuf.lfn[0] = '\0';
|
|
Kmods SIG |
50e2b3 |
- ei->rwoffset = dentry;
|
|
Kmods SIG |
50e2b3 |
+ *cpos = EXFAT_DEN_TO_B(dentry);
|
|
Kmods SIG |
50e2b3 |
return 0;
|
|
Kmods SIG |
50e2b3 |
}
|
|
Kmods SIG |
50e2b3 |
|
|
Kmods SIG |
50e2b3 |
@@ -242,12 +244,10 @@ static int exfat_iterate(struct file *filp, struct dir_context *ctx)
|
|
Kmods SIG |
50e2b3 |
if (err)
|
|
Kmods SIG |
50e2b3 |
goto unlock;
|
|
Kmods SIG |
50e2b3 |
get_new:
|
|
Kmods SIG |
50e2b3 |
- ei->rwoffset = EXFAT_B_TO_DEN(cpos);
|
|
Kmods SIG |
50e2b3 |
-
|
|
Kmods SIG |
50e2b3 |
if (cpos >= i_size_read(inode))
|
|
Kmods SIG |
50e2b3 |
goto end_of_dir;
|
|
Kmods SIG |
50e2b3 |
|
|
Kmods SIG |
50e2b3 |
- err = exfat_readdir(inode, &de);
|
|
Kmods SIG |
50e2b3 |
+ err = exfat_readdir(inode, &cpos, &de);
|
|
Kmods SIG |
50e2b3 |
if (err) {
|
|
Kmods SIG |
50e2b3 |
/*
|
|
Kmods SIG |
50e2b3 |
* At least we tried to read a sector. Move cpos to next sector
|
|
Kmods SIG |
50e2b3 |
@@ -262,13 +262,10 @@ static int exfat_iterate(struct file *filp, struct dir_context *ctx)
|
|
Kmods SIG |
50e2b3 |
goto end_of_dir;
|
|
Kmods SIG |
50e2b3 |
}
|
|
Kmods SIG |
50e2b3 |
|
|
Kmods SIG |
50e2b3 |
- cpos = EXFAT_DEN_TO_B(ei->rwoffset);
|
|
Kmods SIG |
50e2b3 |
-
|
|
Kmods SIG |
50e2b3 |
if (!nb->lfn[0])
|
|
Kmods SIG |
50e2b3 |
goto end_of_dir;
|
|
Kmods SIG |
50e2b3 |
|
|
Kmods SIG |
50e2b3 |
- i_pos = ((loff_t)ei->start_clu << 32) |
|
|
Kmods SIG |
50e2b3 |
- ((ei->rwoffset - 1) & 0xffffffff);
|
|
Kmods SIG |
50e2b3 |
+ i_pos = ((loff_t)ei->start_clu << 32) | (de.entry & 0xffffffff);
|
|
Kmods SIG |
50e2b3 |
tmp = exfat_iget(sb, i_pos);
|
|
Kmods SIG |
50e2b3 |
if (tmp) {
|
|
Kmods SIG |
50e2b3 |
inum = tmp->i_ino;
|
|
Kmods SIG |
50e2b3 |
diff --git a/src/exfat_fs.h b/src/exfat_fs.h
|
|
Kmods SIG |
50e2b3 |
index 49af03660d6c31423864e866db70c34df943c691..b8f0e829ecbd26c14788899de066e533b6dbaf1e 100644
|
|
Kmods SIG |
50e2b3 |
--- a/src/exfat_fs.h
|
|
Kmods SIG |
50e2b3 |
+++ b/src/exfat_fs.h
|
|
Kmods SIG |
50e2b3 |
@@ -265,8 +265,6 @@ struct exfat_inode_info {
|
|
Kmods SIG |
50e2b3 |
* the validation of hint_stat.
|
|
Kmods SIG |
50e2b3 |
*/
|
|
Kmods SIG |
50e2b3 |
unsigned int version;
|
|
Kmods SIG |
50e2b3 |
- /* file offset or dentry index for readdir */
|
|
Kmods SIG |
50e2b3 |
- loff_t rwoffset;
|
|
Kmods SIG |
50e2b3 |
|
|
Kmods SIG |
50e2b3 |
/* hint for cluster last accessed */
|
|
Kmods SIG |
50e2b3 |
struct exfat_hint hint_bmap;
|
|
Kmods SIG |
50e2b3 |
diff --git a/src/file.c b/src/file.c
|
|
Kmods SIG |
50e2b3 |
index 4831a39632a18d65ef4901d355f2dc58700b8e45..a92478eabfa4e43f2198ccf9b62b8632b697c8dc 100644
|
|
Kmods SIG |
50e2b3 |
--- a/src/file.c
|
|
Kmods SIG |
50e2b3 |
+++ b/src/file.c
|
|
Kmods SIG |
50e2b3 |
@@ -208,8 +208,6 @@ int __exfat_truncate(struct inode *inode, loff_t new_size)
|
|
Kmods SIG |
50e2b3 |
/* hint information */
|
|
Kmods SIG |
50e2b3 |
ei->hint_bmap.off = EXFAT_EOF_CLUSTER;
|
|
Kmods SIG |
50e2b3 |
ei->hint_bmap.clu = EXFAT_EOF_CLUSTER;
|
|
Kmods SIG |
50e2b3 |
- if (ei->rwoffset > new_size)
|
|
Kmods SIG |
50e2b3 |
- ei->rwoffset = new_size;
|
|
Kmods SIG |
50e2b3 |
|
|
Kmods SIG |
50e2b3 |
/* hint_stat will be used if this is directory. */
|
|
Kmods SIG |
50e2b3 |
ei->hint_stat.eidx = 0;
|
|
Kmods SIG |
50e2b3 |
diff --git a/src/inode.c b/src/inode.c
|
|
Kmods SIG |
50e2b3 |
index 109f9b4c40d3119351695e5f84063882b41907f3..730373e0965aff2a8c366b34482c61afeec9cd56 100644
|
|
Kmods SIG |
50e2b3 |
--- a/src/inode.c
|
|
Kmods SIG |
50e2b3 |
+++ b/src/inode.c
|
|
Kmods SIG |
50e2b3 |
@@ -114,8 +114,6 @@ static int exfat_map_cluster(struct inode *inode, unsigned int clu_offset,
|
|
Kmods SIG |
50e2b3 |
unsigned int local_clu_offset = clu_offset;
|
|
Kmods SIG |
50e2b3 |
unsigned int num_to_be_allocated = 0, num_clusters = 0;
|
|
Kmods SIG |
50e2b3 |
|
|
Kmods SIG |
50e2b3 |
- ei->rwoffset = EXFAT_CLU_TO_B(clu_offset, sbi);
|
|
Kmods SIG |
50e2b3 |
-
|
|
Kmods SIG |
50e2b3 |
if (EXFAT_I(inode)->i_size_ondisk > 0)
|
|
Kmods SIG |
50e2b3 |
num_clusters =
|
|
Kmods SIG |
50e2b3 |
EXFAT_B_TO_CLU_ROUND_UP(EXFAT_I(inode)->i_size_ondisk,
|
|
Kmods SIG |
50e2b3 |
@@ -567,7 +565,6 @@ static int exfat_fill_inode(struct inode *inode, struct exfat_dir_entry *info)
|
|
Kmods SIG |
50e2b3 |
ei->hint_stat.eidx = 0;
|
|
Kmods SIG |
50e2b3 |
ei->hint_stat.clu = info->start_clu;
|
|
Kmods SIG |
50e2b3 |
ei->hint_femp.eidx = EXFAT_HINT_NONE;
|
|
Kmods SIG |
50e2b3 |
- ei->rwoffset = 0;
|
|
Kmods SIG |
50e2b3 |
ei->hint_bmap.off = EXFAT_EOF_CLUSTER;
|
|
Kmods SIG |
50e2b3 |
ei->i_pos = 0;
|
|
Kmods SIG |
50e2b3 |
|
|
Kmods SIG |
50e2b3 |
diff --git a/src/super.c b/src/super.c
|
|
Kmods SIG |
50e2b3 |
index 60b941ba557b41fae3ea6b16b3041c3aecdc2b93..3ffdce5c7384dd4ad416068d78675a40d0d01e64 100644
|
|
Kmods SIG |
50e2b3 |
--- a/src/super.c
|
|
Kmods SIG |
50e2b3 |
+++ b/src/super.c
|
|
Kmods SIG |
50e2b3 |
@@ -342,7 +342,6 @@ static int exfat_read_root(struct inode *inode)
|
|
Kmods SIG |
50e2b3 |
ei->flags = ALLOC_FAT_CHAIN;
|
|
Kmods SIG |
50e2b3 |
ei->type = TYPE_DIR;
|
|
Kmods SIG |
50e2b3 |
ei->version = 0;
|
|
Kmods SIG |
50e2b3 |
- ei->rwoffset = 0;
|
|
Kmods SIG |
50e2b3 |
ei->hint_bmap.off = EXFAT_EOF_CLUSTER;
|
|
Kmods SIG |
50e2b3 |
ei->hint_stat.eidx = 0;
|
|
Kmods SIG |
50e2b3 |
ei->hint_stat.clu = sbi->root_dir;
|
|
Kmods SIG |
50e2b3 |
--
|
|
Kmods SIG |
50e2b3 |
2.31.1
|
|
Kmods SIG |
50e2b3 |
|