public inbox for linux-btrfs@vger.kernel.org
 help / color / mirror / Atom feed
From: Chris Mason <chris.mason@oracle.com>
To: TARUISI Hiroaki <taruishi.hiroak@jp.fujitsu.com>
Cc: zheng.yan@oracle.com, linux-btrfs@vger.kernel.org
Subject: Re: Way to quickly "revert back" to a snapshot?
Date: Fri, 30 Oct 2009 11:35:11 -0400	[thread overview]
Message-ID: <20091030153511.GA9857@think> (raw)
In-Reply-To: <4AEA8D20.3020504@jp.fujitsu.com>

On Fri, Oct 30, 2009 at 03:52:16PM +0900, TARUISI Hiroaki wrote:
> I'm trying to make this snapshots/subvolumes listing feature,
> I wonder how the interface should be.
> 
> I tried to make this feature using ioctl interface, but I don't
> know how to notify all subvolume informations because number
> of subvolumes are not known before search.
> (It may work, that we call number-notify ioctl before subvol-
>  listing ioctl itself, or we call subvol-listing ioctl repeatedly
>  to last subvolume. But both seem to be not good to me.)
> 
> Is there any other idea?

Thank you for working on this feature.

We find the subvolumes and snapshots by using the forward references in
the tree of tree roots, and the offset field of the key is set to the
root objectid of the subvolume/snapshot we have a reference on (see
root-tree.c:btrfs_add_root_ref())

So, my plan was to have a 'starting objectid' field in the struct we pass
from userland in the ioctl.   The ioctl would find the first reference
that is greater than the starting objectid.  rootid 0 is never used, so
passing zero is fine for the first call.

The ioctl would be called over and over again until it finds zero
subvols/snapshots.  I'd pass a buffer from userland so that it can
return a large list.

I think the ioctl should return the path name to the
subvolume/snapshot, which the kernel will have to find by walking the
directory back references up to the top level directory of the snapshot.
It will also need to return the root objectid so the application can
pass that into the next ioctl call.

Does this make sense?

-chris


  reply	other threads:[~2009-10-30 15:35 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-10-17 17:20 Way to quickly "revert back" to a snapshot? John Dong
2009-10-26  9:38 ` Chris Mason
2009-10-30  6:52   ` TARUISI Hiroaki
2009-10-30 15:35     ` Chris Mason [this message]
2009-11-02  1:16       ` TARUISI Hiroaki
2009-11-04 21:57     ` David Nicol
2009-11-04 22:33       ` Andrey Kuzmin
2009-11-05  5:31         ` TARUISI Hiroaki

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=20091030153511.GA9857@think \
    --to=chris.mason@oracle.com \
    --cc=linux-btrfs@vger.kernel.org \
    --cc=taruishi.hiroak@jp.fujitsu.com \
    --cc=zheng.yan@oracle.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