Qu Wenruo 於 2018-03-07 17:27 寫到:
On 2018年03月07日 16:20, robbieko wrote:
From: Robbie Ko <robbi...@synology.com>

This patchset intends to fix btrfs fiemap related bug.

The fiemap has the following problems:

1) Wrong extent count when fm_extent_count is zero.


2) SHARED bit is not correct
I have two ideas, but I do not know which one is the best.

Like:
 # dd if=/dev/zero bs=16K count=2 oflag=dsync of=/mnt/btrfs/file
 # xfs_io -c "fiemap -v" /mnt/btrfs/file
     /mnt/btrfs/file:
     EXT: FILE-OFFSET      BLOCK-RANGE      TOTAL FLAGS
       0: [0..63]:         4241424..4241487    64   0x1
 # cloner -s $((16*1024)) /mnt/btrfs/file /mnt/btrfs/file_clone

1. When any extent is shared in extent map, the entire extent map is shared
 # xfs_io -c "fiemap -v" /mnt/btrfs/file
     /mnt/btrfs/file:
     EXT: FILE-OFFSET      BLOCK-RANGE      TOTAL FLAGS
       0: [0..63]:         4241424..4241487   64  0x2001

I think this is what btrfs is doing right now.
Although I'm not sure if this is the best solution.

BTW, I just did the same operation, and just get the SHARED flag on both
source and destination.

Is there something wrong?


Currently, only the first extent is checked for shared in extent_map.
Details can refer to "[PATCH 2/2] Btrfs: fix fiemap extent SHARED flag error with range clone."



2. Split into different extent
 # xfs_io -c "fiemap -v" /mnt/btrfs/file
     /mnt/btrfs/file:
     EXT: FILE-OFFSET      BLOCK-RANGE      TOTAL FLAGS
       0: [0..31]:         4241424..4241455   32  0x0
       1: [32..63]:        4241456..4241487   32  0x2001

This is what XFS does.

Thanks,
Qu


Robbie Ko (2):
  Btrfs: fiemap: pass correct bytenr when fm_extent_count is zero
  Btrfs: fix fiemap extent SHARED flag error with range clone.

fs/btrfs/extent_io.c | 150 ++++++++++++++++++++++++++++++++++++++++++++-------
 1 file changed, 132 insertions(+), 18 deletions(-)

--
1.9.1

--
To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


--
To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to