diff options
author | Russell King <rmk+kernel@armlinux.org.uk> | 2019-12-09 11:09:15 +0000 |
---|---|---|
committer | Al Viro <viro@zeniv.linux.org.uk> | 2020-01-20 20:12:40 -0500 |
commit | 95fbadbb5566e383f0cfe40d895e698ab38bdbc7 (patch) | |
tree | 97c0fc9d60b2f16765c9803ef52003bbdff93a74 /fs/adfs/dir.c | |
parent | 71b2612776c1b9c34c460f79bcdaef46d0e77ed2 (diff) |
fs/adfs: dir: add common dir object initialisation
Initialise the dir object before we pass it down to the directory format
specific read handler. This allows us to get rid of the initialisation
inside those handlers.
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.c')
-rw-r--r-- | fs/adfs/dir.c | 16 |
1 files changed, 13 insertions, 3 deletions
diff --git a/fs/adfs/dir.c b/fs/adfs/dir.c index a54c53244992..c1b8b5bccbec 100644 --- a/fs/adfs/dir.c +++ b/fs/adfs/dir.c @@ -13,6 +13,16 @@ */ static DEFINE_RWLOCK(adfs_dir_lock); +static int adfs_dir_read(struct super_block *sb, u32 indaddr, + unsigned int size, struct adfs_dir *dir) +{ + dir->sb = sb; + dir->bhs = dir->bh; + dir->nr_buffers = 0; + + return ADFS_SB(sb)->s_dir->read(sb, indaddr, size, dir); +} + void adfs_object_fixup(struct adfs_dir *dir, struct object_info *obj) { unsigned int dots, i; @@ -64,7 +74,7 @@ adfs_readdir(struct file *file, struct dir_context *ctx) if (ctx->pos >> 32) return 0; - ret = ops->read(sb, inode->i_ino, inode->i_size, &dir); + ret = adfs_dir_read(sb, inode->i_ino, inode->i_size, &dir); if (ret) return ret; @@ -115,7 +125,7 @@ adfs_dir_update(struct super_block *sb, struct object_info *obj, int wait) goto out; } - ret = ops->read(sb, obj->parent_id, 0, &dir); + ret = adfs_dir_read(sb, obj->parent_id, 0, &dir); if (ret) goto out; @@ -167,7 +177,7 @@ static int adfs_dir_lookup_byname(struct inode *inode, const struct qstr *qstr, u32 name_len; int ret; - ret = ops->read(sb, inode->i_ino, inode->i_size, &dir); + ret = adfs_dir_read(sb, inode->i_ino, inode->i_size, &dir); if (ret) goto out; |