All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jeff Liu <jeff.liu@oracle.com>
To: linux-btrfs@vger.kernel.org
Cc: anand.jain@oracle.com, miaox@cn.fujitsu.com
Subject: [RFC PATCH V5 0/2] Btrfs: get/set label of mounted file system
Date: Mon, 17 Dec 2012 19:21:55 +0800	[thread overview]
Message-ID: <50CF0053.4050906@oracle.com> (raw)

Hello,

This patch set is trying to make Btrfs support get/set label for a mounted file sytem via ioctl(2).
There are a couple of changes according to Miao's comments which were shown as following.

Changes of V5->V4 in kernel:
- Revise the ioctl number of BTRFS_IOC_GET_FSLABEL/BTRFS_IOC_SET_FSLABEL to 49/50 separately.
- Replace btrfs_root_readonly() check up with mnt_want_write_file().
- Validate the input label length, return -EINVAL if the specified length is exceeding
  "BTRFS_LABEL_SIZE -1".

Changes of V5->V4 in user space:
- Revise the ioctl number accordingly.
- Don't proceed to get/set the label upon a mounted file system if the dev patch is specified, i.e.
btrfs filesystem label /dev/sdaX [new label]
  Instead, alert the user to execute this command against the mount point, i.e.
btrfs filesystem label /btrfs_mount_path [new label]
- Validate the input label length for changing the label upon an unmounted file system as well.
  We does not check it up currently, the command just keeping silent and truncate the label
  characters which are beyond "BTRFS_LABEL_SIZE - 1".


Tests:
======
/dev/sda6 on /btrfs type btrfs (rw)

jeff@koala:~/oss/btrfs-progs$ sudo ./btrfs filesystem label /btrfs 
btrfs_label

Failure if the length is exceeding 255.
jeff@koala:~/oss/btrfs-progs$ sudo ./btrfs filesystem label /btrfs `perl -e 'print "A"x256'`
ERROR: unable to set label Invalid argument

Otherwise, that's ok.
jeff@koala:~/oss/btrfs-progs$ sudo ./btrfs filesystem label /btrfs `perl -e 'print "A"x255'`

jeff@koala:~/oss/btrfs-progs$ sudo ./btrfs filesystem label /btrfs
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA


The old versions can be found at:
v4:
http://permalink.gmane.org/gmane.comp.file-systems.btrfs/21618

v3:
https://patchwork.kernel.org/patch/1124642/

v2:
http://permalink.gmane.org/gmane.comp.file-systems.btrfs/12877

v1:
http://permalink.gmane.org/gmane.comp.file-systems.btrfs/12872

Thanks,
-Jeff

             reply	other threads:[~2012-12-17 11:22 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-12-17 11:21 Jeff Liu [this message]
2012-12-17 11:22 ` [RFC PATCH V5 1/2] Btrfs: Add a new ioctl to get the label of a mounted filesystem Jeff Liu
2012-12-17 11:59   ` Miao Xie
2012-12-17 11:22 ` [RFC PATCH V5 2/2] Btrfs: Add a new ioctl to change the label of a mounted file system Jeff Liu
2012-12-17 11:57   ` Miao Xie
2012-12-17 13:30     ` Jeff Liu
2012-12-17 17:34       ` Goffredo Baroncelli
2012-12-18  2:20         ` Jeff Liu
2012-12-18  2:21         ` Miao Xie
2012-12-18  2:33           ` Jeff Liu
2012-12-18  2:47             ` Jeff Liu
2012-12-17 11:34 ` [PATCH v5 1/4] Btrfs-progs: get " Jeff Liu
2012-12-17 11:35 ` [PATCH V5 2/4] Btrfs-progs: Change the " Jeff Liu
2012-12-17 11:35 ` [PATCH V5 3/4] Btrfs-progs: Fix set_label_unmounted() with label length validation Jeff Liu
2012-12-17 11:35 ` [PATCH v5 4/4] Btrfs-progs: fix cmd_label_usage to reflect this change Jeff Liu

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=50CF0053.4050906@oracle.com \
    --to=jeff.liu@oracle.com \
    --cc=anand.jain@oracle.com \
    --cc=linux-btrfs@vger.kernel.org \
    --cc=miaox@cn.fujitsu.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.