Date: Tue, 27 Mar 2012 21:34:40 +0300 From: Konstantin Belousov <kostikbel@gmail.com> To: fs@freebsd.org Subject: RFC: SEEK_HOLE/SEEK_DATA common implementation Message-ID: <20120327183440.GS2358@deviant.kiev.zoral.com.ua>
next in thread | raw e-mail | index | archive | help
--DBwjNljafULFACtk Content-Type: text/plain; charset=us-ascii Content-Disposition: inline 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. --DBwjNljafULFACtk Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.12 (FreeBSD) iEYEARECAAYFAk9yCEAACgkQC3+MBN1Mb4i9IwCgjNfxloBEPUGl6vVAPPEldo9M YJYAn1jeVfualFuYW5AqnRO5QFoBwJT9 =SJml -----END PGP SIGNATURE----- --DBwjNljafULFACtk--
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20120327183440.GS2358>