linux-btrfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Larry D'Anna <larry@elder-gods.org>
To: linux-btrfs@vger.kernel.org
Cc: larry@elder-gods.org, "Yan Zheng" <zheng.z.yan@intel.com>
Subject: [PATCH 0/2] btrfs: allow cross-subvolume BTRFS_IOC_CLONE
Date: Thu, 31 Mar 2011 00:00:11 -0400	[thread overview]
Message-ID: <cover.1301542804.git.larry@elder-gods.org> (raw)

This is a simple patch to allow reflinks to be made crossing subvolume
boundaries.  The only complication I found in implementing this is that
btrfs_ioctl_clone reuses a btrfs_path.  This is a slight problem because once we
allow the source and destination inodes to come from different btrfs_roots, we
need to know what root to pass into the various calls to btrfs_release_path, and
keeping track of this would further complicate the control flow of
btrfs_ioctl_clone.  Fortunately btrfs_release_path does not use it's first
argument, patch number 1 removes it.

Patch number 2 is then just a simple matter of distinguishing between the source
and destination btrfs_roots in btrfs_ioctl_clone.

If removing the first argument from btrfs_release_path is undesirable, then
btrfs_ioctl_clone could simply pass NULL.  There are a few other places in btrfs
that already do this.

I have tested this by cp -a --reflink=always all the files found in the UML
slackware root_fs, and also by cloning a test file with hundreds of
random extents and holes.  

Larry D'Anna (2):
  btrfs: remove unused argument 'root' from btrfs_release_path
  btrfs: allow cross-subvolume BTRFS_IOC_CLONE

 fs/btrfs/ctree.c            |   28 ++++++------
 fs/btrfs/ctree.h            |    2 +-
 fs/btrfs/dir-item.c         |    2 +-
 fs/btrfs/extent-tree.c      |   74 ++++++++++++++++----------------
 fs/btrfs/file-item.c        |   12 +++---
 fs/btrfs/file.c             |   12 +++---
 fs/btrfs/free-space-cache.c |   14 +++---
 fs/btrfs/inode.c            |   42 +++++++++---------
 fs/btrfs/ioctl.c            |   22 +++++----
 fs/btrfs/relocation.c       |   30 +++++++-------
 fs/btrfs/root-tree.c        |   10 ++--
 fs/btrfs/tree-defrag.c      |    2 +-
 fs/btrfs/tree-log.c         |   98 +++++++++++++++++++++---------------------
 fs/btrfs/volumes.c          |   16 ++++----
 fs/btrfs/xattr.c            |    4 +-
 15 files changed, 185 insertions(+), 183 deletions(-)


             reply	other threads:[~2011-03-31  4:00 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-03-31  4:00 Larry D'Anna [this message]
2011-03-31  4:00 ` [PATCH 1/2] btrfs: remove unused argument 'root' from btrfs_release_path Larry D'Anna
2011-03-31  4:00 ` [PATCH 2/2] btrfs: allow cross-subvolume BTRFS_IOC_CLONE Larry D'Anna
2011-03-31  6:36 ` [PATCH 0/2] " Christoph Hellwig
2011-03-31  6:44   ` Arne Jansen
2011-03-31 12:02   ` Chris Mason
2011-04-01 13:34     ` Christoph Hellwig
2011-04-01 13:40       ` Chris Mason
2011-04-02  1:59         ` Fajar A. Nugraha
2011-12-22 12:24         ` Chris Samuel
2012-01-06 12:04           ` Konstantinos Skarlatos
2012-01-06 17:57             ` David Sterba
2012-01-09  6:58               ` Marios Titas
2012-01-09 13:31                 ` Jérôme Poulin
2012-01-19 16:52                   ` Jérôme Poulin
2011-04-02 15:51       ` Ken Drummond
2011-04-02 16:56         ` Larry D'Anna
2011-04-02 20:01           ` Jérôme Poulin
  -- strict thread matches above, loose matches on Subject: below --
2011-03-31 11:12 Tomasz Chmielewski

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=cover.1301542804.git.larry@elder-gods.org \
    --to=larry@elder-gods.org \
    --cc=linux-btrfs@vger.kernel.org \
    --cc=zheng.z.yan@intel.com \
    /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).