RFC: SEEK_HOLE/SEEK_DATA common implementation

Konstantin Belousov kostikbel at gmail.com
Tue Mar 27 18:34:58 UTC 2012


Hello,
Please find at
http://people.freebsd.org/~kib/misc/seek_hole.1.patch
a prototype generic implementation of the SEEK_HOLE/SEEK_DATA lseek(2)
whence command for any filesystem that properly supports bmap.

I was unable to find any test suite for the feature, and the only more
or less reasonable case I found was from lklm, extracted at
http://people.freebsd.org/~kib/misc/seek_hole.c
The block for file with hole at the end is commented out because
UFS never puts holes at EOF. The block_size is tuned for default block
size on UFS on recent FreeBSD.

Filesystem-specific implementations could greatly increase the performance
of the call, because the presented implementation does linear search
through the blocks until hole/data boundary is found. E.g., for UFS,
the fast tree-like structure of indirect blocks can be traversed to
point at the next boundary. But this implementation is generic.

Please comment.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 196 bytes
Desc: not available
Url : http://lists.freebsd.org/pipermail/freebsd-fs/attachments/20120327/55b7fc6f/attachment.pgp


More information about the freebsd-fs mailing list