linux-btrfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Anand Jain <anand.jain@oracle.com>
To: Hans van Kranenburg <hans@knorrie.org>,
	linux-btrfs <linux-btrfs@vger.kernel.org>
Subject: Re: The btrfs 'label' property: device or filesystem-wide?
Date: Fri, 2 Aug 2019 20:54:24 +0800	[thread overview]
Message-ID: <79005fd4-3314-aa73-5830-caad37ff1f2c@oracle.com> (raw)
In-Reply-To: <8e535199-800a-b794-07e4-cb42f2f9b0c5@knorrie.org>

On 8/2/19 5:42 PM, Hans van Kranenburg wrote:
> Hi,
> 
> I was just looking at btrfs property and what it can do.
> 
> Now, I notice that the man page contains:
> 
>    label: label of device
> 
> When I look at a device and ask what properties I can set, I see:
> 
> -# btrfs property list -t device /dev/xvdb
> label               Set/get label of device.
> 
> But, when I try to set it, it complains:
> 
> -# btrfs property set -t device /dev/xvdb label yolo
> ERROR: device /dev/xvdb is mounted, use mount point
> 
> A mount point points to a whole filesystem, not a specific device.
> 
> -# btrfs property set -t device /btrfs label yolo
> 
> The result is that the label at filesystem level is set. A device
> doesn't even have something like a label itself.
> 
> -# btrfs fi show
> Label: 'yolo'  uuid: 370415b8-b96f-456e-8713-6833b2a65127
> 	Total devices 4 FS bytes used 144.00KiB
> 	devid    1 size 10.00GiB used 1.00GiB path /dev/xvdb
> 	devid    2 size 10.00GiB used 1.00GiB path /dev/xvdc
> 	devid    3 size 10.00GiB used 288.00MiB path /dev/xvdd
> 	devid    4 size 10.00GiB used 288.00MiB path /dev/xvde
> 
> So, am I missing something, or should this have been:
> 
> -# btrfs property set -t filesystem label foo /mountpoint

Yes. Label is for the whole filesystem.

Initially the label was set-able only using the device path (after
mkfs), for which the device has to be in unmounted state.

So when we implemented the label ioctl, so that label can be set on the
mounted fs, we had to maintain its backward compatible.

So at both, btrfs fi label and btrfs prop set the label works on the
mount-point or the device path if its unmounted. And even if the device
path is used the label is for the whole filesystem.

HTH
Anand


> Hans
> 


  reply	other threads:[~2019-08-02 12:56 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-08-02  9:42 The btrfs 'label' property: device or filesystem-wide? Hans van Kranenburg
2019-08-02 12:54 ` Anand Jain [this message]
2019-08-02 13:42   ` Hans van Kranenburg

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=79005fd4-3314-aa73-5830-caad37ff1f2c@oracle.com \
    --to=anand.jain@oracle.com \
    --cc=hans@knorrie.org \
    --cc=linux-btrfs@vger.kernel.org \
    /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).