From patchwork Thu Jun 2 02:54:27 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Fajar A. Nugraha" X-Patchwork-Id: 842602 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter2.kernel.org (8.14.4/8.14.3) with ESMTP id p523Z9Mm005207 for ; Thu, 2 Jun 2011 03:35:10 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1759427Ab1FBCy2 (ORCPT ); Wed, 1 Jun 2011 22:54:28 -0400 Received: from mail-iw0-f174.google.com ([209.85.214.174]:34408 "EHLO mail-iw0-f174.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1759417Ab1FBCy1 (ORCPT ); Wed, 1 Jun 2011 22:54:27 -0400 Received: by iwn34 with SMTP id 34so339745iwn.19 for ; Wed, 01 Jun 2011 19:54:27 -0700 (PDT) MIME-Version: 1.0 Received: by 10.231.196.233 with SMTP id eh41mr313840ibb.6.1306983267363; Wed, 01 Jun 2011 19:54:27 -0700 (PDT) Received: by 10.231.37.194 with HTTP; Wed, 1 Jun 2011 19:54:27 -0700 (PDT) Date: Thu, 2 Jun 2011 09:54:27 +0700 Message-ID: Subject: [PATCH] make "btrfs filesystem label" command actually work From: "Fajar A. Nugraha" To: linux-btrfs Sender: linux-btrfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-btrfs@vger.kernel.org X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.6 (demeter2.kernel.org [140.211.167.43]); Thu, 02 Jun 2011 03:35:10 +0000 (UTC) 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 --- btrfs.c | 6 ++++++ 1 files changed, 6 insertions(+), 0 deletions(-) "Scan all device for or the passed device for a btrfs\n" --- 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", "\n" "Balance the chunks across the device." }, + { do_change_label, -1, + "filesystem label", " []\n" + "With one argument, get the label of filesystem on .\n" + "If is passed, set the filesystem label to .\n" + "The filesystem must be unmounted.\n" + }, { do_scan, 999, "device scan", "[...]\n"