linux-btrfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Eric Sandeen <sandeen@redhat.com>
To: "Wang, Zhiye" <Zhiye.Wang@Arcserve.com>,
	"linux-btrfs@vger.kernel.org" <linux-btrfs@vger.kernel.org>
Subject: Re: Questions about FIEMAP
Date: Mon, 12 Oct 2015 08:27:13 -0500	[thread overview]
Message-ID: <561BB531.6070706@redhat.com> (raw)
In-Reply-To: <CY1PR10MB04283CC6BA7D9AE8F3F0B984E4310@CY1PR10MB0428.namprd10.prod.outlook.com>

On 10/11/15 11:37 PM, Wang, Zhiye wrote:
> Hello everyone,
> 
> After googled a bit, I got information that btrfs supports FIEMAP (as "cp" needs it), but it's not valid for "write" operation.

cp should not be using fiemap any more.  It was for a while, until they realized that copying based on fiemap output could lead to corruption because things changed between the fiemap call and the actual copy...

> I guess we cannot write to block device directly after get block list using FIEMAP. This is because:
> 
> 1. COW feature of btrfs (but this can be disabled using NOCOW)
> 2. File system rebalance
> 3. Defragmentation
> 
> Aren't item #2 and #3 also a problem for "read" operation? For example, after "cp" get block list using FIEMAP, file system rebalance occurs, So, previous result of FIEMAP is not valid anymore.
> 
> Or maybe I misunderstood something. Please correct me.

That all may be true for btrfs, but more fundamentally as dsterba said, nothing guarantees that the layout won't change *immediately* after your fiemap call.  This is the case on any filesystem, not just btrfs.

-Eric


  parent reply	other threads:[~2015-10-12 13:27 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-10-12  4:37 Questions about FIEMAP Wang, Zhiye
2015-10-12  6:01 ` Duncan
2015-10-12  8:10 ` Hugo Mills
2015-10-12 13:04 ` David Sterba
2015-10-12 13:27 ` Eric Sandeen [this message]
2015-10-28  9:57   ` Wang, Zhiye
2015-10-28 12:36     ` Duncan

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=561BB531.6070706@redhat.com \
    --to=sandeen@redhat.com \
    --cc=Zhiye.Wang@Arcserve.com \
    --cc=linux-btrfs@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).