On Mon, Jul 01, 2013 at 10:13:26PM +0800, Liu Bo wrote:
> For partial extents, snapshot-aware defrag does not work as expected,
> since
> a) we use the wrong logical offset to search for parents, which should be
>    disk_bytenr + extent_offset, not just disk_bytenr,
> b) 'offset' returned by the backref walking just refers to key.offset, not
>    the 'offset' stored in btrfs_extent_data_ref which is
>    (key.offset - extent_offset).
> 
> The reproducer:
> $ mkfs.btrfs sda
> $ mount sda /mnt
> $ btrfs sub create /mnt/sub
> $ for i in `seq 5 -1 1`; do dd if=/dev/zero of=/mnt/sub/foo bs=5k count=1 
> seek=$i conv=notrunc oflag=sync; done
> $ btrfs sub snap /mnt/sub /mnt/snap1
> $ btrfs sub snap /mnt/sub /mnt/snap2
> $ sync; btrfs filesystem defrag /mnt/sub/foo;
> $ umount /mnt
> $ btrfs-debug-tree sda (Here we can check whether the defrag operation is 
> snapshot-awared.
> 
> This addresses the above two problems.
> 

Can this be turned into a xfstest somehow?  Like do fiemap and make sure the
block numbers match up right?  Thanks,

Josef
--
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