summaryrefslogtreecommitdiff
path: root/fs/adfs/dir_fplus.c
diff options
context:
space:
mode:
authorRussell King <rmk+kernel@armlinux.org.uk>2019-12-09 14:10:16 +0300
committerAl Viro <viro@zeniv.linux.org.uk>2020-01-21 04:12:41 +0300
commit4287e4deb1280633ffbda608f946d6d7c2d76d4a (patch)
tree4494eba3d3a9ce47f4d7772d6332054bdc08ef7e /fs/adfs/dir_fplus.c
parentcdc46e99e1c9f50802c4f543f10151887e4c4e0e (diff)
downloadlinux-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_fplus.c')
-rw-r--r--fs/adfs/dir_fplus.c21
1 files changed, 21 insertions, 0 deletions
diff --git a/fs/adfs/dir_fplus.c b/fs/adfs/dir_fplus.c
index ae11236515d0..edcbaa94ecb9 100644
--- a/fs/adfs/dir_fplus.c
+++ b/fs/adfs/dir_fplus.c
@@ -118,8 +118,29 @@ adfs_fplus_getnext(struct adfs_dir *dir, struct object_info *obj)
return 0;
}
+static int adfs_fplus_iterate(struct adfs_dir *dir, struct dir_context *ctx)
+{
+ struct object_info obj;
+
+ if ((ctx->pos - 2) >> 32)
+ return 0;
+
+ if (adfs_fplus_setpos(dir, ctx->pos - 2))
+ return 0;
+
+ while (!adfs_fplus_getnext(dir, &obj)) {
+ if (!dir_emit(ctx, obj.name, obj.name_len,
+ obj.indaddr, DT_UNKNOWN))
+ break;
+ ctx->pos++;
+ }
+
+ return 0;
+}
+
const struct adfs_dir_ops adfs_fplus_dir_ops = {
.read = adfs_fplus_read,
+ .iterate = adfs_fplus_iterate,
.setpos = adfs_fplus_setpos,
.getnext = adfs_fplus_getnext,
};