From mboxrd@z Thu Jan 1 00:00:00 1970 From: Andreas Dilger Subject: Re: FIBMAP/FIEMAP discrepancy for CAP_SYS_RAWIO Date: Tue, 08 Sep 2009 09:23:49 +0200 Message-ID: <20090908072349.GC4197@webber.adilger.int> References: <87y6osry4k.fsf@mid.deneb.enyo.de> <20090907105014.GV4197@webber.adilger.int> <87y6oqd8lt.fsf@mid.deneb.enyo.de> Mime-Version: 1.0 Content-Type: text/plain; CHARSET=US-ASCII Content-Transfer-Encoding: 7BIT Cc: linux-fsdevel@vger.kernel.org To: Florian Weimer Return-path: Received: from sca-es-mail-2.Sun.COM ([192.18.43.133]:57681 "EHLO sca-es-mail-2.sun.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753785AbZIHHXy (ORCPT ); Tue, 8 Sep 2009 03:23:54 -0400 Received: from fe-sfbay-10.sun.com ([192.18.43.129]) by sca-es-mail-2.sun.com (8.13.7+Sun/8.12.9) with ESMTP id n887NvR8001675 for ; Tue, 8 Sep 2009 00:23:57 -0700 (PDT) Content-disposition: inline Received: from conversion-daemon.fe-sfbay-10.sun.com by fe-sfbay-10.sun.com (Sun Java(tm) System Messaging Server 7u2-7.04 64bit (built Jul 2 2009)) id <0KPN00E005QDQV00@fe-sfbay-10.sun.com> for linux-fsdevel@vger.kernel.org; Tue, 08 Sep 2009 00:23:57 -0700 (PDT) In-reply-to: <87y6oqd8lt.fsf@mid.deneb.enyo.de> Sender: linux-fsdevel-owner@vger.kernel.org List-ID: On Sep 07, 2009 16:26 +0000, Florian Weimer wrote: > * Andreas Dilger: > > If you are implementing a tool to use this, I would code it to try > > FIEMAP first, then FIBMAP (if it is running as root, or it gets > > fixed in some future kernel), then just do without (as it most likely > > does already today). > > If FIBMAP is unsafe, it's likely exposed by concurrent changes to the > file, so using it would still be unsafe for backup purposes. And I > really only need the number of the first block. (I want to optimize > reading of Maildir-style folders, mainly for backup purposes.) Given that the worst that can happen for your particular application if FIBMAP gets the wrong block number is a sub-optimal ordering for the file copy, there is no risk in doing this. For the FIEMAP code, since you only need the first block number, just pass it a single fiemap_extent so that it doesn't spend time generating a full list of extents that you don't need to use. Cheers, Andreas -- Andreas Dilger Sr. Staff Engineer, Lustre Group Sun Microsystems of Canada, Inc.