linux-btrfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Miao Xie <miaox@cn.fujitsu.com>
To: Arne Jansen <sensille@gmx.net>
Cc: Linux Btrfs <linux-btrfs@vger.kernel.org>,
	wangshilong <wangsl-fnst@cn.fujitsu.com>
Subject: Re: About btrfs qgroup import/export command
Date: Wed, 09 Jan 2013 18:17:31 +0800	[thread overview]
Message-ID: <50ED43BB.7090505@cn.fujitsu.com> (raw)
In-Reply-To: <50D1A7A9.9010300@gmx.net>

Hi, Arne

On Wed, 19 Dec 2012 12:40:25 +0100, Arne Jansen wrote:
> On 19.12.2012 12:25, Miao Xie wrote:
>> As we know, there is no backup function for qgroup. when the problem
>> occurs, the users must recover qgroup configuration manually, it is not
>> convenient. And besides that, some users might want to import an existed
>> qgroup configuration into a new filesystem. Btrfs does not have such a
>> function,it can only be done manually.
>>
>> So we want to implement btrfs qgroup import/export commands.
>> 1)'btrfs qgroup export' commands will export qgroup tree
>>   into a user's specified file.(stdout by default)
>>
>> 2)user may modify the configuration file firstly and then
>>   import it into the filesystem.(by 'btrfs qgroup import' command)
>>
>> The file may be formated as the following:
>>
>> Qgroupid     is_compressed     is_exclusive   limited_size    parent
>> ----------------------------------------------------------------------
>>  0/1            0                 0              10G            1/0
>>  1/0            1                 1              20G            ---
>>   
>>  If 'is_exclusive' is set, 'limited_size' corresponds to max exlusive size,
>>  else max referenced size. Here 'parent' exclude ancestral qgroups. 
>>
>> Is there any comment about this idea? 
> 
> The configuration only really makes sense in combination with the existing
> subvolumes. Even if the target has subvolumes under the same name, they
> might have different internal IDs. So it might make more sense to address
> the level 0 qgroups by name.

Good idea.

> Also it might be misleading to apply a configuration to an existing fs, as
> it currently is not possible get a correct accounting if the fs is not
> empty. Rescan is not yet implemented.

Rescan will be implemented in the future, so it is not a main problem
to implement 'btrfs qgroup import/export' commands.

> So instead of just saving and restoring the qgroup config, it might make
> more sense to create a new filesystem including all subvolumes and quota
> config from a config file.
> But, I'm not completely convinced that this is a features that is needed
> frequently. If I want a standard deployment, I simple write a script that
> creates the fs + subvol + quota.

If users want to config some qgroups(reset the limited size,
modify its ancestral qgroups),i think it is more convenient and flexible
to use import/export commands than write a script.


Above all,our qgroup import/export commands will be implemented as follows:

qgroupid  is_compressed  is_exclusive  limited_size   parent   full_path
------------------------------------------------------------------------

And we may specify matching degree when we import the qgroup information.

<1>strict matching
	qgroup(level-0) matches a subvolume/snapshot 's objectid and full path exactly.
	If a qgroup fail to match, the process will exit.

<2>general matching
	It only require qgroup(level-0) to match a subvolume/snapshot 's full path.
	If the corresponding subvolume/snapshot does not exist,skip it. Otherwise,apply
	modifications to the corresponding subvolume/snapshot qgroup.

<3>weak matching
	It only require qgroup(level-0) to match a subvolume/snapshot 's full path.
	If the corresponding subvolume/snapshot does not exist,create the subvolume
	automatically(a tracking qgroup is also created automatically)and then apply
	modifications to the newly created tracking qgroup.


How do you think about the above idea?

Thanks
Miao

  parent reply	other threads:[~2013-01-09 10:16 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <50D1632E.6010801@cn.fujitsu.com>
2012-12-19 11:25 ` About btrfs qgroup import/export command Miao Xie
2012-12-19 11:40   ` Arne Jansen
2012-12-20  3:17     ` Miao Xie
2013-01-09 10:17     ` Miao Xie [this message]
2013-01-09 12:18       ` Arne Jansen

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=50ED43BB.7090505@cn.fujitsu.com \
    --to=miaox@cn.fujitsu.com \
    --cc=linux-btrfs@vger.kernel.org \
    --cc=sensille@gmx.net \
    --cc=wangsl-fnst@cn.fujitsu.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).