From mboxrd@z Thu Jan 1 00:00:00 1970 From: Jamie Lokier Subject: Re: FIBMAP/FIEMAP discrepancy for CAP_SYS_RAWIO Date: Tue, 8 Sep 2009 09:47:20 +0100 Message-ID: <20090908084720.GB31909@shareable.org> References: <87y6osry4k.fsf@mid.deneb.enyo.de> <20090907105014.GV4197@webber.adilger.int> <87y6oqd8lt.fsf@mid.deneb.enyo.de> <20090908072349.GC4197@webber.adilger.int> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Cc: Florian Weimer , linux-fsdevel@vger.kernel.org To: Andreas Dilger Return-path: Received: from mail2.shareable.org ([80.68.89.115]:55868 "EHLO mail2.shareable.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752153AbZIHIrU (ORCPT ); Tue, 8 Sep 2009 04:47:20 -0400 Content-Disposition: inline In-Reply-To: <20090908072349.GC4197@webber.adilger.int> Sender: linux-fsdevel-owner@vger.kernel.org List-ID: Andreas Dilger wrote: > 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. With FIEMAP, filesystems which don't use extents will still scan a potentially large region of the disk doing block lookups won't they, just to maximise the size of the first extent in a large file? Assuming yes, FIBMAP would be faster than FIEMAP in those cases, which may be a reason to give it the same permissions, so it can be used. -- Jamie