diff options
author | Russell King <rmk+kernel@armlinux.org.uk> | 2019-12-09 14:10:16 +0300 |
---|---|---|
committer | Al Viro <viro@zeniv.linux.org.uk> | 2020-01-21 04:12:41 +0300 |
commit | 4287e4deb1280633ffbda608f946d6d7c2d76d4a (patch) | |
tree | 4494eba3d3a9ce47f4d7772d6332054bdc08ef7e /fs/adfs/dir.c | |
parent | cdc46e99e1c9f50802c4f543f10151887e4c4e0e (diff) | |
download | linux-4287e4deb1280633ffbda608f946d6d7c2d76d4a.tar.xz |
fs/adfs: dir: add more efficient iterate() per-format method
Rather than using setpos + getnext to iterate through the directory
entries, pass iterate() down to the dir format code to populate the
dirents.
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, 2 insertions, 14 deletions
diff --git a/fs/adfs/dir.c b/fs/adfs/dir.c index 2a8f5f1fd3d0..7fda44464121 100644 --- a/fs/adfs/dir.c +++ b/fs/adfs/dir.c @@ -240,12 +240,8 @@ static int adfs_iterate(struct file *file, struct dir_context *ctx) struct inode *inode = file_inode(file); struct super_block *sb = inode->i_sb; const struct adfs_dir_ops *ops = ADFS_SB(sb)->s_dir; - struct object_info obj; struct adfs_dir dir; - int ret = 0; - - if (ctx->pos >> 32) - return 0; + int ret; down_read(&adfs_dir_rwsem); ret = adfs_dir_read_inode(sb, inode, &dir); @@ -263,15 +259,7 @@ static int adfs_iterate(struct file *file, struct dir_context *ctx) ctx->pos = 2; } - ret = ops->setpos(&dir, ctx->pos - 2); - if (ret) - goto unlock_relse; - while (ops->getnext(&dir, &obj) == 0) { - if (!dir_emit(ctx, obj.name, obj.name_len, - obj.indaddr, DT_UNKNOWN)) - break; - ctx->pos++; - } + ret = ops->iterate(&dir, ctx); unlock_relse: up_read(&adfs_dir_rwsem); |