All of lore.kernel.org
 help / color / mirror / Atom feed
From: David Pottage <david@electric-spoon.com>
To: Chris Mason <chris.mason@oracle.com>
Cc: Arne Jansen <sensille@gmx.net>, Josef Bacik <josef@redhat.com>,
	linux-btrfs <linux-btrfs@vger.kernel.org>,
	linux-fsdevel <linux-fsdevel@vger.kernel.org>, hch <hch@lst.de>,
	ssorce <ssorce@redhat.com>
Subject: Re: What to do about subvolumes?
Date: Thu, 02 Dec 2010 17:14:53 +0000	[thread overview]
Message-ID: <4CF7D40D.508@electric-spoon.com> (raw)
In-Reply-To: <1291306150-sup-7861@think>

On 02/12/10 16:11, Chris Mason wrote:
> Excerpts from Arne Jansen's message of 2010-12-02 04:49:39 -0500:
>    
>> Josef Bacik wrote:
>>      
>>> 1) Scrap the 256 inode number thing.  Instead we'll just put a flag in the inode
>>> to say "Hey, I'm a subvolume" and then we can do all of the appropriate magic
>>> that way.  This unfortunately will be an incompatible format change, but the
>>> sooner we get this adressed the easier it will be in the long run.  Obviously
>>> when I say format change I mean via the incompat bits we have, so old fs's won't
>>> be broken and such.
>>>
>>> 2) Do something like NFS's referral mounts when we cd into a subvolume.  Now we
>>> just do dentry trickery, but that doesn't make the boundary between subvolumes
>>> clear, so it will confuse people (and samba) when they walk into a subvolume and
>>> all of a sudden the inode numbers are the same as in the directory behind them.
>>> With doing the referral mount thing, each subvolume appears to be its own mount
>>> and that way things like NFS and samba will work properly.
>>>
>>>        
>> What about the alternative and allocating inode numbers globally? The only
>> problem would be with snapshots as they share the inum with the source, but
>> one could just remap inode numbers in snapshots by sparing some bits at the
>> top of this 64 bit field.
>>      
> The global inode number is possible, it's just another btree that must
> be maintained on disk in order to map which inodes are free and which
> ones aren't.  It also needs to have a reference count on each inode,
> since each snapshot effectively increases the reference count on
> every file and directory it contains.
>
> The cost of maintaining that reference count is very very high.
>    

A couple of years ago I was suffering from the problem of different 
files having the same inode number on Netapp servers. On a Netapp device 
if you snapshot a volume then the files in the snapshot have the same 
inode number as the original, even if the original changes. (Netapp 
snapshots are read only).

This means that if you attempt to see what has changed since your last 
snapshot using a command line such as:

diff src/file.c .snapshots/hourly.12/src.file.c

Then the diff tool will tell you that the files are the same even if 
they are different, because it is assuming that files with the same 
inode number will have identical contents.

Therefore I think it is a bad idea if potentially different files on 
btrfs can have the same inode number. It will break all sorts of tools.

Instead of maintaining a big complicated reference count of used inode 
numbers, could btrfs use bit masks to create a the userland visible 
inode number from the subvolume id and the real internal inode number. 
Something like:

userland_inode = ( volume_id << 48 ) & internal_inode;

Please forgive me if this is impossible, or if that C snippet is 
syntactically incorrect. I am not a filesystem or kernel developer, and 
I have not coded in C for many years.

-- 
David Pottage


  reply	other threads:[~2010-12-02 17:14 UTC|newest]

Thread overview: 79+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-12-01 14:21 What to do about subvolumes? Josef Bacik
2010-12-01 14:50 ` Mike Hommey
2010-12-01 14:51 ` C Anthony Risinger
2010-12-01 14:51   ` C Anthony Risinger
2010-12-01 16:01   ` Chris Mason
2010-12-01 16:01     ` Chris Mason
2010-12-01 16:03     ` C Anthony Risinger
2010-12-01 16:03       ` C Anthony Risinger
2010-12-01 16:13       ` Chris Mason
2010-12-01 16:13         ` Chris Mason
2010-12-01 16:31     ` Mike Hommey
2010-12-01 16:31       ` Mike Hommey
2010-12-09 19:53       ` Martin Steigerwald
2010-12-01 16:00 ` Chris Mason
2010-12-01 16:38 ` Hugo Mills
2010-12-01 16:48   ` Gordan Bobic
2010-12-01 16:52   ` Mike Hommey
2010-12-01 16:52   ` C Anthony Risinger
2010-12-01 16:52     ` C Anthony Risinger
2010-12-01 17:38   ` Josef Bacik
2010-12-01 19:35     ` Hugo Mills
2010-12-01 20:24       ` Freddie Cash
2010-12-01 20:24         ` Freddie Cash
2010-12-01 21:28         ` Hugo Mills
2010-12-01 23:32           ` Freddie Cash
2010-12-01 23:32             ` Freddie Cash
2010-12-02  4:46             ` Mike Fedyk
2010-12-02  4:46               ` Mike Fedyk
2010-12-01 18:33 ` Goffredo Baroncelli
2010-12-01 18:36   ` Josef Bacik
2010-12-01 18:48     ` C Anthony Risinger
2010-12-01 18:48       ` C Anthony Risinger
2010-12-01 18:52       ` C Anthony Risinger
2010-12-01 18:52         ` C Anthony Risinger
2010-12-01 19:08         ` Goffredo Baroncelli
2010-12-01 19:44 ` J. Bruce Fields
2010-12-01 19:54   ` Josef Bacik
2010-12-01 20:00     ` J. Bruce Fields
2010-12-01 20:09       ` Josef Bacik
2010-12-01 20:16         ` J. Bruce Fields
2010-12-02  1:52         ` Michael Vrable
2010-12-03 20:53           ` J. Bruce Fields
2010-12-01 20:03 ` Jeff Layton
2010-12-01 20:46   ` Goffredo Baroncelli
2010-12-01 21:06     ` Jeff Layton
2010-12-02  9:26 ` Arne Jansen
2010-12-02  9:49 ` Arne Jansen
2010-12-02 16:11   ` Chris Mason
2010-12-02 17:14     ` David Pottage [this message]
     [not found]       ` <AANLkTinBzpoCnci+1a=0pjXbAdQ7mzpdr2k8GOo7HUc8@mail.gmail.com>
2010-12-03 13:47         ` Fwd: " Paweł Brodacki
2010-12-03 20:56       ` J. Bruce Fields
2010-12-03  2:43   ` Phillip Susi
2011-01-31  2:40   ` Ian Kent
2010-12-03  4:25 ` Chris Ball
2010-12-03 14:00   ` Josef Bacik
2010-12-03 21:45 ` Josef Bacik
2010-12-03 22:16   ` J. Bruce Fields
2010-12-03 22:27   ` Dave Chinner
2010-12-03 22:29     ` Chris Mason
2010-12-03 22:45       ` J. Bruce Fields
2010-12-03 23:01         ` Andreas Dilger
2010-12-06 16:48           ` J. Bruce Fields
2010-12-08  6:39             ` Andreas Dilger
2010-12-08 23:07             ` Neil Brown
2010-12-09  4:41               ` Andreas Dilger
2010-12-09 15:19                 ` J. Bruce Fields
2010-12-07 16:52         ` hch
2010-12-07 20:45           ` J. Bruce Fields
2010-12-07 16:51     ` Christoph Hellwig
2010-12-07 17:02       ` Trond Myklebust
2010-12-08 17:16         ` Andreas Dilger
2010-12-08 17:27           ` J. Bruce Fields
2010-12-08 21:18             ` Andreas Dilger
2010-12-04 21:58   ` Mike Fedyk
2010-12-04 21:58     ` Mike Fedyk
2010-12-06 14:27     ` Josef Bacik
2010-12-06 14:27       ` Josef Bacik
2011-01-31  2:56       ` Ian Kent
2010-12-07 16:48 ` Christoph Hellwig

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=4CF7D40D.508@electric-spoon.com \
    --to=david@electric-spoon.com \
    --cc=chris.mason@oracle.com \
    --cc=hch@lst.de \
    --cc=josef@redhat.com \
    --cc=linux-btrfs@vger.kernel.org \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=sensille@gmx.net \
    --cc=ssorce@redhat.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.