On Mon, Oct 12, 2015 at 04:37:55AM +0000, 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.
> 
> 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.

   That's correct. If you use FIEMAP to get the blocks of a file, and
then balance the FS or defrag the file, then even without an explicit
write to the file, the file's location will have changed. This is the
same reason that btrfs doesn't support swap files (although I don't
know if swapon uses FIEMAP directly, or if there's just some
equivalent mechanism to get the blocks).

   Hugo.

-- 
Hugo Mills             | Have found Lost City of Atlantis. High Priest is
hugo@... carfax.org.uk | winning at quoits
http://carfax.org.uk/  |
PGP: E2AB1DE4          |

Attachment: signature.asc
Description: Digital signature

Reply via email to