From owner-freebsd-fs@FreeBSD.ORG Tue Mar 27 18:34:58 2012 Return-Path: Delivered-To: fs@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 7EE731065673 for ; Tue, 27 Mar 2012 18:34:58 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from mail.zoral.com.ua (mx0.zoral.com.ua [91.193.166.200]) by mx1.freebsd.org (Postfix) with ESMTP id E3FAF8FC1C for ; Tue, 27 Mar 2012 18:34:57 +0000 (UTC) Received: from skuns.kiev.zoral.com.ua (localhost [127.0.0.1]) by mail.zoral.com.ua (8.14.2/8.14.2) with ESMTP id q2RIYgNt079693 for ; Tue, 27 Mar 2012 21:34:42 +0300 (EEST) (envelope-from kostikbel@gmail.com) Received: from deviant.kiev.zoral.com.ua (kostik@localhost [127.0.0.1]) by deviant.kiev.zoral.com.ua (8.14.5/8.14.5) with ESMTP id q2RIYeCw080261 for ; Tue, 27 Mar 2012 21:34:40 +0300 (EEST) (envelope-from kostikbel@gmail.com) Received: (from kostik@localhost) by deviant.kiev.zoral.com.ua (8.14.5/8.14.5/Submit) id q2RIYeOG080260 for fs@freebsd.org; Tue, 27 Mar 2012 21:34:40 +0300 (EEST) (envelope-from kostikbel@gmail.com) X-Authentication-Warning: deviant.kiev.zoral.com.ua: kostik set sender to kostikbel@gmail.com using -f Date: Tue, 27 Mar 2012 21:34:40 +0300 From: Konstantin Belousov To: fs@freebsd.org Message-ID: <20120327183440.GS2358@deviant.kiev.zoral.com.ua> Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="DBwjNljafULFACtk" Content-Disposition: inline User-Agent: Mutt/1.4.2.3i X-Virus-Scanned: clamav-milter 0.95.2 at skuns.kiev.zoral.com.ua X-Virus-Status: Clean X-Spam-Status: No, score=-4.0 required=5.0 tests=ALL_TRUSTED,AWL,BAYES_00 autolearn=ham version=3.2.5 X-Spam-Checker-Version: SpamAssassin 3.2.5 (2008-06-10) on skuns.kiev.zoral.com.ua Cc: Subject: RFC: SEEK_HOLE/SEEK_DATA common implementation X-BeenThere: freebsd-fs@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Filesystems List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 27 Mar 2012 18:34:58 -0000 --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--