aboutsummaryrefslogtreecommitdiff
path: root/sys/fs/devfs
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/devfs
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/devfs')
-rw-r--r--sys/fs/devfs/devfs_vnops.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/sys/fs/devfs/devfs_vnops.c b/sys/fs/devfs/devfs_vnops.c
index 5c0bf603ab9b..c046c4e88ad3 100644
--- a/sys/fs/devfs/devfs_vnops.c
+++ b/sys/fs/devfs/devfs_vnops.c
@@ -1381,6 +1381,8 @@ devfs_readdir(struct vop_readdir_args *ap)
if (dp->d_reclen > uio->uio_resid)
break;
dp->d_fileno = de->de_inode;
+ /* NOTE: d_off is the offset for the *next* entry. */
+ dp->d_off = off + dp->d_reclen;
if (off >= uio->uio_offset) {
error = vfs_read_dirent(ap, dp, off);
if (error)