From: Josef Bacik <jbacik@fusionio.com>
To: Liu Bo <bo.li.liu@oracle.com>
Cc: <linux-btrfs@vger.kernel.org>
Subject: Re: [PATCH] Btrfs: fix a bug of snapshot-aware defrag to make it work on partial extents
Date: Mon, 1 Jul 2013 16:22:06 -0400 [thread overview]
Message-ID: <20130701202206.GG4288@localhost.localdomain> (raw)
In-Reply-To: <1372688006-18176-1-git-send-email-bo.li.liu@oracle.com>
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
next prev parent reply other threads:[~2013-07-01 20:22 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-07-01 14:13 [PATCH] Btrfs: fix a bug of snapshot-aware defrag to make it work on partial extents Liu Bo
2013-07-01 20:22 ` Josef Bacik [this message]
2013-07-03 9:47 ` Liu Bo
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=20130701202206.GG4288@localhost.localdomain \
--to=jbacik@fusionio.com \
--cc=bo.li.liu@oracle.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).