aboutsummaryrefslogtreecommitdiff
path: root/sys/fs/udf
diff options
context:
space:
mode:
authorKonstantin Belousov <kib@FreeBSD.org>2018-11-14 14:18:35 +0000
committerKonstantin Belousov <kib@FreeBSD.org>2018-11-14 14:18:35 +0000
commit1c4ca7789029ae5478e160fd43b039b71523c0d2 (patch)
treeebe30c84784f39aefcec04c4927db112c2c93bf0 /sys/fs/udf
parentd5aef6d6ca05d7d7d8aa53b410ecd6d63e18d083 (diff)
downloadsrc-1c4ca7789029ae5478e160fd43b039b71523c0d2.tar.gz
src-1c4ca7789029ae5478e160fd43b039b71523c0d2.zip
Add d_off support for multiple filesystems.
The d_off field has been added to the dirent structure recently. Currently filesystems don't support this feature. Support has been added and tested for zfs, ufs, ext2fs, fdescfs, msdosfs and unionfs. A stub implementation is available for cd9660, nandfs, udf and pseudofs but hasn't been tested. Motivation for this feature: our usecase is for a userspace nfs server (nfs-ganesha) with zfs. At the moment we cache direntry offsets by calling lseek once per entry, with this patch we can get the offset directly from getdirentries(2) calls which provides a significant speedup. Submitted by: Jack Halford <jack@gandi.net> Reviewed by: mckusick, pfg, rmacklem (previous versions) Sponsored by: Gandi.net MFC after: 1 week Differential revision: https://reviews.freebsd.org/D17917
Notes
Notes: svn path=/head/; revision=340431
Diffstat (limited to 'sys/fs/udf')
-rw-r--r--sys/fs/udf/udf_vnops.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/sys/fs/udf/udf_vnops.c b/sys/fs/udf/udf_vnops.c
index 6e7706c5c7c5..30558cf86931 100644
--- a/sys/fs/udf/udf_vnops.c
+++ b/sys/fs/udf/udf_vnops.c
@@ -846,6 +846,7 @@ udf_readdir(struct vop_readdir_args *a)
dir.d_name[1] = '\0';
dir.d_namlen = 1;
dir.d_reclen = GENERIC_DIRSIZ(&dir);
+ dir.d_off = 1;
uiodir.dirent = &dir;
error = udf_uiodir(&uiodir, dir.d_reclen, uio, 1);
if (error)
@@ -858,6 +859,7 @@ udf_readdir(struct vop_readdir_args *a)
dir.d_name[2] = '\0';
dir.d_namlen = 2;
dir.d_reclen = GENERIC_DIRSIZ(&dir);
+ dir.d_off = 2;
uiodir.dirent = &dir;
error = udf_uiodir(&uiodir, dir.d_reclen, uio, 2);
} else {
@@ -867,6 +869,7 @@ udf_readdir(struct vop_readdir_args *a)
dir.d_type = (fid->file_char & UDF_FILE_CHAR_DIR) ?
DT_DIR : DT_UNKNOWN;
dir.d_reclen = GENERIC_DIRSIZ(&dir);
+ dir.d_off = ds->this_off;
uiodir.dirent = &dir;
error = udf_uiodir(&uiodir, dir.d_reclen, uio,
ds->this_off);