aboutsummaryrefslogtreecommitdiffstats
path: root/fs/adfs/dir_fplus.c
diff options
context:
space:
mode:
authorRussell King <rmk+kernel@armlinux.org.uk>2019-12-09 11:10:21 +0000
committerAl Viro <viro@zeniv.linux.org.uk>2020-01-20 20:12:41 -0500
commit016936b32131d0b33328d8c109f83fabb56618a3 (patch)
tree6381bbae78c24b096f32180e4e7ab7e6389e3e46 /fs/adfs/dir_fplus.c
parentfs/adfs: dir: add more efficient iterate() per-format method (diff)
downloadlinux-dev-016936b32131d0b33328d8c109f83fabb56618a3.tar.xz
linux-dev-016936b32131d0b33328d8c109f83fabb56618a3.zip
fs/adfs: dir: use pointers to access directory head/tails
Add and use pointers in the adfs_dir structure to access the directory head and tail structures, which will always be contiguous in a buffer. This allows us to avoid memcpy()ing the data in the new directory code, making it slightly more efficient. Signed-off-by: Russell King <rmk+kernel@armlinux.org.uk> Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Diffstat (limited to 'fs/adfs/dir_fplus.c')
-rw-r--r--fs/adfs/dir_fplus.c11
1 files changed, 4 insertions, 7 deletions
diff --git a/fs/adfs/dir_fplus.c b/fs/adfs/dir_fplus.c
index edcbaa94ecb9..6f2dbcf6819b 100644
--- a/fs/adfs/dir_fplus.c
+++ b/fs/adfs/dir_fplus.c
@@ -20,7 +20,7 @@ static int adfs_fplus_read(struct super_block *sb, u32 indaddr,
if (ret)
return ret;
- h = (struct adfs_bigdirheader *)dir->bhs[0]->b_data;
+ dir->bighead = h = (void *)dir->bhs[0]->b_data;
dirsize = le32_to_cpu(h->bigdirsize);
if (dirsize != size) {
adfs_msg(sb, KERN_WARNING,
@@ -40,7 +40,7 @@ static int adfs_fplus_read(struct super_block *sb, u32 indaddr,
if (ret)
return ret;
- t = (struct adfs_bigdirtail *)
+ dir->bigtail = t = (struct adfs_bigdirtail *)
(dir->bhs[dir->nr_buffers - 1]->b_data + (sb->s_blocksize - 8));
if (t->bigdirendname != cpu_to_le32(BIGDIRENDNAME) ||
@@ -62,11 +62,9 @@ out:
static int
adfs_fplus_setpos(struct adfs_dir *dir, unsigned int fpos)
{
- struct adfs_bigdirheader *h =
- (struct adfs_bigdirheader *) dir->bhs[0]->b_data;
int ret = -ENOENT;
- if (fpos <= le32_to_cpu(h->bigdirentries)) {
+ if (fpos <= le32_to_cpu(dir->bighead->bigdirentries)) {
dir->pos = fpos;
ret = 0;
}
@@ -77,8 +75,7 @@ adfs_fplus_setpos(struct adfs_dir *dir, unsigned int fpos)
static int
adfs_fplus_getnext(struct adfs_dir *dir, struct object_info *obj)
{
- struct adfs_bigdirheader *h =
- (struct adfs_bigdirheader *) dir->bhs[0]->b_data;
+ struct adfs_bigdirheader *h = dir->bighead;
struct adfs_bigdirentry bde;
unsigned int offset;
int ret;