All of lore.kernel.org
 help / color / mirror / Atom feed
From: Qu Wenruo <quwenruo@cn.fujitsu.com>
To: Martin <sha256sum@gmail.com>, <linux-btrfs@vger.kernel.org>
Subject: Re: Why subvolume and not just volume?
Date: Wed, 5 Aug 2015 15:23:54 +0800	[thread overview]
Message-ID: <55C1BA0A.8090804@cn.fujitsu.com> (raw)
In-Reply-To: <CAK4jXzy8OpRMnF=hYEamZVxiumH9Xn_8uDo_xOQhYfLf3cA9dA@mail.gmail.com>


Martin wrote on 2015/08/05 09:06 +0200:
> Hi,
>
> Does anyone know the reason subvolumes are not called just volumes? I
> mean, the top subvolume is not called a volume, so there is nothing to
> be "sub" of.
Because normally a volume is referred as a complete filesystem.
So from this respect, subvolume is not a full filesystem, it still need 
a lot of extra data from other trees to build its contents.

So, that's why there is "sub" prefix.
Although it acts much like a volume as it can be mounted like a 
filesystem, but it's still not a full filesystem.
>
> Also, what is the penalty of a subvolume compared to a directory? From
> a design perspective, couldn't all directories just be subvolumes?
Yes, subvolume has its overhead, and when it comes as many as 
directories, the overhead won't be small.

The overhead that I can remember is shown below.
Use empty tree as an example for its size, and default mkfs options.
The '+' after number means it will increase with snapshots

1) Empty tree block: 16K
    Of course takes more if its child file/dir grows
2) ROOT_ITEM in tree root: 439bytes
3) ROOT_BACKREF in tree root: 22+bytes
5) extent backref for tree block:
     33+bytes for skinny metadata
     53+bytes without skinny metadata

Alone with other trees like log tree, one for each subvolume if fsync is 
called.

Not to mention other run-time overhead.
For example, to search a inode in one subvolume.
Search_slot would be enough to find the INODE_ITEM.

But to search a inode across subvolume boundary, need to first found the 
subvolume boundary and loop until we reach the subvolume containing the 
inode, then do the above search_slot to locate the INODE_ITEM.

Although the overhead is already small, but not that small to make all 
directories to be subvolume.

Thanks,
Qu
>
> Martin
> --
> To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
>

  reply	other threads:[~2015-08-05  7:23 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-08-05  7:06 Why subvolume and not just volume? Martin
2015-08-05  7:23 ` Qu Wenruo [this message]
2015-08-05 17:13 ` David Sterba
2015-08-06  7:23 ` Duncan
2015-08-06 11:17   ` Austin S Hemmelgarn

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=55C1BA0A.8090804@cn.fujitsu.com \
    --to=quwenruo@cn.fujitsu.com \
    --cc=linux-btrfs@vger.kernel.org \
    --cc=sha256sum@gmail.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.