linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Chris Mason <chris.mason@oracle.com>
To: Christoph Hellwig <hch@infradead.org>,
	Kay Sievers <kay.sievers@vrfy.org>
Cc: Andreas Dilger <adilger@sun.com>,
	Andrew Morton <akpm@linux-foundation.org>,
	Stephen Rothwell <sfr@canb.auug.org.au>,
	linux-kernel@vger.kernel.org, linux-btrfs@vger.kernel.org,
	linux-fsdevel <linux-fsdevel@vger.kernel.org>
Subject: Re: Notes on support for multiple devices for a single filesystem
Date: Wed, 17 Dec 2008 09:53:48 -0500	[thread overview]
Message-ID: <1229525628.27170.30.camel@think.oraclecorp.com> (raw)
In-Reply-To: <20081217132343.GA14695@infradead.org>

On Wed, 2008-12-17 at 08:23 -0500, Christoph Hellwig wrote:
> FYI: here's a little writeup I did this summer on support for
> filesystems spanning multiple block devices:
> 
> 

Thanks Christoph, I'll start with a description of what btrfs does
today.

Every Btrfs filesystem has a uuid, and a tree that stores all the device
uuids that belong to the FS uuid.

Every btrfs device has a device uuid and a super block that indicates
which FS uuid it belongs to.

The btrfs kernel module holds a list of the FS uuids found and the
devices that belong to each one.  This list is populated by a block
device scanning ioctl that opens a bdev and checks for btrfs supers.

I tried to keep this code as simple as possible because I knew we'd end
up replacing it.  At mount time, btrfs makes sure the devices found by
scanning match the devices the FS expected to find.

btrfsctl -a scans all of /dev calling the scan ioctl on each device and
btrfsctl -A /dev/xxxx just calls the ioctl on a single device.

No scanning is required for a single device filesystem.  After the scan
is done, sending any device in a multi-device filesystem is enough for
the kernel to mount the FS.  IOW:

mkfs.btrfs /dev/sdb ; mount /dev/sdb /mnt just works.
mkfs.btrfs /dev/sdb /dev/sdc ; mount /dev/sdb /mnt also works

(mkfs.btrfs calls the ioctl on multi-device filesystems).

UUIDS and labels are important in large systems, but if the admin knows
a given device is part of an FS, they are going to expect to be able to
send that one device to mount and have things work.

Even though btrfs currently maintains the device list in the kernel, I'm
happy to move it into a userland api once we settle on one.  Kay has
some code so that udev can discover the btrfs device<->FS uuid mappings,
resulting in a tree like this:

  $ tree /dev/btrfs/
  /dev/btrfs/
  |-- 0cdedd75-2d03-41e6-a1eb-156c0920a021
  |   |-- 897fac06-569c-4f45-a0b9-a1f91a9564d4 -> ../../sda10
  |   `-- aac20975-b642-4650-b65b-b92ce22616f2 -> ../../sda9
  `-- a1ec970a-2463-414e-864c-2eb8ac4e1cf2
      |-- 4d1f1fff-4c6b-4b87-8486-36f58abc0610 -> ../../sdb2
      `-- e7fe3065-c39f-4295-a099-a89e839ae350 -> ../../sdb1

It makes sense to me to use /dev/multi-device/ instead of /dev/btrfs/,
I'm fine with anything really.

-chris



  parent reply	other threads:[~2008-12-17 14:53 UTC|newest]

Thread overview: 29+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-11-20 12:18 Btrfs trees for linux-next Chris Mason
2008-12-11  2:34 ` Chris Mason
2008-12-11  3:14   ` Stephen Rothwell
2008-12-11  4:06     ` Andrew Morton
2008-12-11  5:55       ` Stephen Rothwell
2008-12-11 14:43       ` Chris Mason
2008-12-15 21:03         ` Andreas Dilger
2008-12-15 22:55           ` Kay Sievers
2008-12-16  1:37             ` Chris Mason
2008-12-16  1:39               ` Kay Sievers
2008-12-17 13:23           ` Notes on support for multiple devices for a single filesystem Christoph Hellwig
2008-12-17 14:50             ` Kay Sievers
2008-12-17 15:08               ` Christoph Hellwig
2008-12-17 15:33                 ` Kay Sievers
2008-12-17 14:53             ` Chris Mason [this message]
2008-12-17 19:53             ` Andrew Morton
2008-12-17 20:58               ` Chris Mason
2008-12-17 21:20                 ` Kay Sievers
2008-12-17 21:26                   ` Chris Mason
2008-12-17 21:27                   ` Jeff Garzik
2008-12-18 21:22                     ` Bryan Henderson
2008-12-17 21:24                 ` Andreas Dilger
2008-12-17 21:30                   ` Jeff Garzik
2008-12-17 21:41                   ` Chris Mason
2008-12-22  1:59               ` Liu Hui
2008-12-17 22:04             ` Andreas Dilger
2008-12-17 22:19               ` Dave Kleikamp
     [not found] <e1f6055f0812181336q105b4ebcy81d72edd2a35baa8@mail.gmail.com>
2008-12-19 19:03 ` Bryan Henderson
2008-12-19 19:30   ` Chris Mason

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=1229525628.27170.30.camel@think.oraclecorp.com \
    --to=chris.mason@oracle.com \
    --cc=adilger@sun.com \
    --cc=akpm@linux-foundation.org \
    --cc=hch@infradead.org \
    --cc=kay.sievers@vrfy.org \
    --cc=linux-btrfs@vger.kernel.org \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=sfr@canb.auug.org.au \
    /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).