After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 663207 - [PATCH] Add labelling of btrfs file systems
[PATCH] Add labelling of btrfs file systems
Status: RESOLVED FIXED
Product: gparted
Classification: Other
Component: application
GIT HEAD
Other Linux
: Normal enhancement
: ---
Assigned To: gparted maintainers alias
gparted maintainers alias
Depends on:
Blocks:
 
 
Reported: 2011-11-01 23:52 UTC by Mike Fleetwood
Modified: 2011-12-13 17:40 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
btrfs labelling patch (1.27 KB, patch)
2011-11-01 23:52 UTC, Mike Fleetwood
none Details | Review

Description Mike Fleetwood 2011-11-01 23:52:45 UTC
Created attachment 200467 [details] [review]
btrfs labelling patch

Hi,

Btrfs-progs recently gained the capability to label btrfs file systems.  Attached is my suggested patch for gparted to also be able to label btrfs file systems.

Thanks,
Mike

-- 

Add the "btrfs filesystem label" command
Committed: 25 Oct 2011
http://git.kernel.org/?p=linux/kernel/git/mason/btrfs-progs.git;a=commitdiff;h=e8f47cf068c3a4b5de7770ebb9eef37e28e09ef7

Capability determination in btrfs::get_filesystem_support() -
The labelling capability only exists in the newer multi-command "btrfs" executable and over time it is gaining more sub-commands.  Therefore I had perform a, standard check the executable can be found call, but also run "btrfs" to test for labelling capability.  Fortunately running "btrfs filesystem label --help" can be used.  Older releases of "btrfs" which don't support labelling report unknown command and a non-zero exit status, where as a newer supporting release of "btrfs" outputs help and a zero exit status.

I think I have used Utils::execute_command() correctly, but check.

I have tested gparted with the patch applied.
- Correctly determines the labelling capability of the btrfs executable.
- Labels unmounted btrfs file systems.
- Labels multi-device unmounted btrfs file systems (despite the btrfs-progs commit claiming single device btrfs' only).
- Correctly handles error from "btrfs filesystem label" from trying to label a mounted multi-device btrfs file system via one of it's other devices not listed in /proc/mounts.
Comment 1 Curtis Gedak 2011-11-02 19:41:36 UTC
Thank you Mike for your interest in GParted and for providing this patch.  :-)

From a quick review and testing of the patch, all appears to work well and is correctly implemented in my opinion.  Good job!

Generally I prefer to include patches such as this when the feature (btrfs label) has been formally released as a package (in btrfs-tools v0.20 perhaps).

Since your patch also works well with previous versions of btrfs-tools (it doesn't break anything), I am planning to include it in the next release of GParted.  The next release will likely be in the December/January time frame.

Does this timing work for you?
Comment 2 Mike Fleetwood 2011-11-02 23:24:43 UTC
Hi Curtis,

I fully understand your preference for a formal btrfs-progs release and I would prefer it too, but the code's history suggests that may be some time away.  The btrfs kernel code is constantly being developed and gaining new features and being officially released every 3 months or so in the latest Linux kernel.  Btrfs-progs is also being developed to match, however the last version stamp in the code base was v0.19 back in June 2009!  Fedora's btrfs-progs package is periodically updated from the repository to keep it in-line with the shipped kernel.  I assume other distributions must do the same, otherwise btrfs-progs wouldn't handle half the features available in the kernel btrfs driver.  As you've kindly accepted my patch for the next gparted release, this is merely rambling and not arm twisting ;-)

A December/January release is great.

Thanks,
Mike
Comment 3 Curtis Gedak 2011-11-13 16:48:07 UTC
Thank you again for this patch Mike.

Your enhancement has been committed to the gnome git repository for inclusion in the next release of GParted.

The relevant git commit can be viewed at the following link:
http://git.gnome.org/browse/gparted/commit/?id=7ba1d417c5c4a76945ec7253be03460313c5c429


For anyone reading this bug report, a btrfs-tools package released after Oct. 25, 2011 (and greater than version 0.19) is required for labelling of btrfs file systems to work.
Comment 4 Curtis Gedak 2011-12-13 17:40:51 UTC
The enhancement to address this bug report has been included in GParted 0.11.0 released on Dec. 13, 2011.