linux-btrfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Liu Bo <bo.li.liu@oracle.com>
To: Josef Bacik <jbacik@fusionio.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: Wed, 3 Jul 2013 17:47:21 +0800	[thread overview]
Message-ID: <20130703094721.GC15921@localhost.localdomain> (raw)
In-Reply-To: <20130701202206.GG4288@localhost.localdomain>

On Mon, Jul 01, 2013 at 04:22:06PM -0400, Josef Bacik wrote:
> 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,

Yeah, I've sent a patch for this :)

- liubo

      reply	other threads:[~2013-07-03  9:47 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
2013-07-03  9:47   ` Liu Bo [this message]

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=20130703094721.GC15921@localhost.localdomain \
    --to=bo.li.liu@oracle.com \
    --cc=jbacik@fusionio.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).