linux-btrfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Fajar A. Nugraha" <list@fajar.net>
To: linux-btrfs <linux-btrfs@vger.kernel.org>
Subject: [PATCH] make "btrfs filesystem label" command actually work
Date: Thu, 2 Jun 2011 09:54:27 +0700	[thread overview]
Message-ID: <BANLkTikGo52=CHtwYN2Eh9wv=RTH5+sANg@mail.gmail.com> (raw)

This simple patch makes "btrfs filesystem label" command actually work.

On tmp branch, commit d1dc6a9, "btrfs filesystem label" functionality
was introduced. However the commit lacks one component that lets
"btrfs" accept "filesystem label" command.
Test case:

#===================================================

# truncate -s 1G /tmp/dev.img

# losetup -f
/dev/loop0

# losetup /dev/loop0 /tmp/dev.img

# mkfs.btrfs -L old /dev/loop0

WARNING! - Btrfs Btrfs v0.19 IS EXPERIMENTAL
WARNING! - see http://btrfs.wiki.kernel.org before using

fs created label old on /dev/loop0
	nodesize 4096 leafsize 4096 sectorsize 4096 size 1.00GB
Btrfs Btrfs v0.19

# btrfs fi la /dev/loop0
old

# btrfs fi la /dev/loop0 new

# btrfs fi la /dev/loop0
new

# mount /dev/disk/by-label/new /mnt/tmp

# btrfs fi la /dev/loop0
FATAL: the filesystem has to be unmounted

# umount /dev/loop0

# btrfs fi la /dev/loop0
new

#===================================================

Not sure if you need if you need a signoff for something as trivial as
this, but here it is just in case.

Signed-off-by: Fajar A. Nugraha <list@fajar.net>
---
 btrfs.c |    6 ++++++
 1 files changed, 6 insertions(+), 0 deletions(-)

diff --git a/btrfs.c b/btrfs.c
index 4cd4210..84c2337 100644
--- a/btrfs.c
+++ b/btrfs.c
@@ -95,6 +95,12 @@ static struct Command commands[] = {
          "filesystem balance", "<path>\n"
                "Balance the chunks across the device."
        },
+       { do_change_label, -1,
+         "filesystem label", "<device> [<newlabel>]\n"
+               "With one argument, get the label of filesystem on <device>.\n"
+               "If <newlabel> is passed, set the filesystem label to
<newlabel>.\n"
+               "The filesystem must be unmounted.\n"
+       },
        { do_scan, 999,
          "device scan", "[<device>...]\n"
                "Scan all device for or the passed device for a btrfs\n"
---

-- 
Fajar

                 reply	other threads:[~2011-06-02  2:54 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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='BANLkTikGo52=CHtwYN2Eh9wv=RTH5+sANg@mail.gmail.com' \
    --to=list@fajar.net \
    --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).