From mboxrd@z Thu Jan 1 00:00:00 1970 From: Joel Becker Subject: Re: [RFC][PATCH 0/5] Fiemap, an extent mapping ioctl Date: Thu, 29 May 2008 11:56:16 -0700 Message-ID: <20080529185616.GA2655@mail.oracle.com> 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> <20080529005134.GB12405@disturbed> <20080529130254.GB21299@infradead.org> <483ECCB5.5060909@hp.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Cc: Christoph Hellwig , Mark Fasheh , linux-fsdevel@vger.kernel.org To: jim owens Return-path: Received: from agminet01.oracle.com ([141.146.126.228]:14685 "EHLO agminet01.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751298AbYE2TAt (ORCPT ); Thu, 29 May 2008 15:00:49 -0400 Content-Disposition: inline In-Reply-To: <483ECCB5.5060909@hp.com> Sender: linux-fsdevel-owner@vger.kernel.org List-ID: On Thu, May 29, 2008 at 11:33:09AM -0400, jim owens wrote: > Christoph Hellwig wrote: >> >> What use is there geeting the extent count for a range? I'd rather >> do it only per-file like the xfs ioctl. > > I'll answer that from practical experience. Our api equivalents: > > __u64 fm_start; /* logical offset (inclusive) at > * which to start mapping (in) */ > __u64 fm_length; /* logical length of mapping which > * userspace cares about (in) */ > __u32 fm_extent_count; /* size of fm_extents array (in) */ > __u32 fm_mapped_extents; /* number of extents that were > * mapped (out) */ > > ... note it has no flags field and no separate ioctl_extent_count. > > "fm_extent_count" is > IN == max_extents to return. > OUT == number of extents remaining in-range after fm_mapped_extents > > Pass in fm_extent_count==0 and you get OUT number of extent entries > within your fm_start + fm_length range. Which you can use to set > your malloc size because the FS can have massive extent counts :( See, that's a very natural API. I'd be much happier with that - "extent_count == 0" is consistent with no extent structures passed in. It also fits with many other API that do it the same way (eg, snprintf). Joel -- "I don't know anything about music. In my line you don't have to." - Elvis Presley Joel Becker Principal Software Developer Oracle E-mail: joel.becker@oracle.com Phone: (650) 506-8127