From mboxrd@z Thu Jan 1 00:00:00 1970 From: Andreas Dilger Subject: Re: [RFC][PATCH 0/5] Fiemap, an extent mapping ioctl Date: Wed, 28 May 2008 19:17:29 -0600 Message-ID: <20080529011729.GB2937@webber.adilger.int> References: <20080525000148.GJ8325@wotan.suse.de> <20080525194203.GB24328@infradead.org> <20080527185622.GR8325@wotan.suse.de> <20080527203124.GC27827@mail.oracle.com> <20080528160201.GA7263@webber.adilger.int> <20080528170419.GA6031@mail.oracle.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7BIT Cc: Mark Fasheh , Christoph Hellwig , linux-fsdevel@vger.kernel.org, Andreas Dilger , Kalpak Shah , Eric Sandeen , Josef Bacik To: Joel Becker Return-path: Received: from sca-es-mail-1.Sun.COM ([192.18.43.132]:39022 "EHLO sca-es-mail-1.sun.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753065AbYE2BRn (ORCPT ); Wed, 28 May 2008 21:17:43 -0400 Received: from fe-sfbay-09.sun.com ([192.18.43.129]) by sca-es-mail-1.sun.com (8.13.7+Sun/8.12.9) with ESMTP id m4T1HfG9015746 for ; Wed, 28 May 2008 18:17:41 -0700 (PDT) Received: from conversion-daemon.fe-sfbay-09.sun.com by fe-sfbay-09.sun.com (Sun Java System Messaging Server 6.2-8.04 (built Feb 28 2007)) id <0K1L00001VHEMS00@fe-sfbay-09.sun.com> (original mail from adilger@sun.com) for linux-fsdevel@vger.kernel.org; Wed, 28 May 2008 18:17:41 -0700 (PDT) In-reply-to: <20080528170419.GA6031@mail.oracle.com> Content-disposition: inline Sender: linux-fsdevel-owner@vger.kernel.org List-ID: On May 28, 2008 10:04 -0700, Joel Becker wrote: > It's not about net reduction of code. It's about a readable and > understandable interface. "Pass this array of extent structures we'll > ignore if you set this special flag" is pretty ugly. Calling FIECOUNT > separately is nice. How it is implemented in the kernel is a whole > 'nother ball of wax - maybe we don't have ->fiecount() and always > implement FIECOUNT in terms of a ->fiemap() walk. Doesn't matter. In the FIEMAP + NUM_EXTENTS count, you don't need to pass the array of structures, just the header. I don't think this is an onerous interface: struct fiemap fiemap = { .fm_start = 0, .fm_length = ~0ULL, .fm_num_extents = 0, .fm_flags = FIEMAP_FLAG_NUM_EXTENTS } rc = ioctl(fd, FIEMAP, &fiemap); if (rc == 0) num_extents = fiemap.fm_mapped_extents; We wouldn't need to even specify .fm_num_extents, if the VFS handler doesn't check its validity for FIEMAP_FLAG_NUM_EXTENTS (contrary to my recent change proposal). Cheers, Andreas -- Andreas Dilger Sr. Staff Engineer, Lustre Group Sun Microsystems of Canada, Inc.