btrfs-progs: Move btrfstune to btrfs device tune
Subsystems (3)
RFC PATCH 1/1 btrfs-progs: Move btrfstune to btrfs device tune
Good time of day,
According to https://btrfs.wiki.kernel.org/index.php/Project_ideas#btrfs
Quote:
merge functionality of btrfstune, eg. under btrfs dev set-seed /dev/ (discuss the command name though)
This patch is just code move
After, user can tune btrfs parameters through:
btrfs dev tune -xr /dev/sda2
Also i merge two functions in one:
static int enable_extrefs_flag(struct btrfs_root *root) and
static int enable_skinny_metadata(struct btrfs_root *root) to
static void enable_flag(struct btrfs_root *root, u64 flag) Where flag is:BTRFS_FEATURE_INCOMPAT_SKINNY_METADATA BTRFS_FEATURE_INCOMPAT_EXTENDED_IREF
Because function is identical.
P.S.
I write this patch on branch:git://repo.or.cz/btrfs-progs-unstable/devel.git
But i think, what it can be safety applied on stable branch. If it needed, i can redo and resend patch.
P.S.S
If it needed, i can move seed function in separated command, like in project ideas (btrfs dev set-seed /dev/ or something else). And if seed is same as readonly, may be command must named like "readonly" 1/0 <dev>?
--- Documentation/Makefile | 3 +- Documentation/btrfs-device.txt | 19 +++- Makefile | 10 +-- btrfstune.c | 197 ----------------------------------------- cmds-device.c | 156 ++++++++++++++++++++++++++++++++ 5 files changed, 177 insertions(+), 208 deletions(-)
Documentation/Makefile +1 -2
@@ -9,7 +9,6 @@ MAN8_TXT += btrfs-find-root.txt MAN8_TXT += btrfs-image.txt MAN8_TXT += btrfs-map-logical.txt MAN8_TXT += btrfs-show-super.txt -MAN8_TXT += btrfstune.txt MAN8_TXT += btrfs-zero-log.txt MAN8_TXT += fsck.btrfs.txt MAN8_TXT += mkfs.btrfs.txt
@@ -82,7 +81,7 @@ clean: %.8.gz : %.8 $(QUIET_GZIP)$(GZIP) -n -c $< > $@ -%.8 : %.xml +%.8 : %.xml $(QUIET_XMLTO)$(RM) $@ && \ $(XMLTO) -m $(MANPAGE_XSL) $(XMLTO_EXTRA) man $< %.xml : %.txt asciidoc.conf
Documentation/btrfs-device.txt +17 -2
@@ -80,10 +80,10 @@ Remove device(s) from a filesystem identified by <path>. *scan* [(--all-devices|-d)|<device> [<device>...]]:: Scan devices for a btrfs filesystem. + -If one or more devices are passed, these are scanned for a btrfs filesystem. +If one or more devices are passed, these are scanned for a btrfs filesystem. If no devices are passed, btrfs uses block devices containing btrfs filesystem as listed by blkid. -Finally, if '--all-devices' or '-d' is passed, all the devices under /dev are +Finally, if '--all-devices' or '-d' is passed, all the devices under /dev are scanned. *ready* <device>::
@@ -98,6 +98,21 @@ identified by <path> or for a single <device>. -z:::: Reset stats to zero after reading them. +*tune* [options] <dev>:: +Used to tune various btrfs filesystem parameters, you can enable +some extended features for btrfs and set seeding flag. ++ +`Options` ++ +-S <value>:: +Updates the seeding value, it forces a fs readonly so that you can use it to +build other filesystems. +-r:: +Enable extended inode refs. +-x:: +Enable skinny metadata extent refs. + + EXIT STATUS ----------- *btrfs device* returns a zero exist status if it succeeds. Non zero is
Makefile +2 -2
@@ -48,7 +48,7 @@ MAKEOPTS = --no-print-directory Q=$(Q) progs = mkfs.btrfs btrfs-debug-tree btrfsck \ btrfs btrfs-map-logical btrfs-image btrfs-zero-log btrfs-convert \ - btrfs-find-root btrfstune btrfs-show-super + btrfs-find-root btrfs-show-super # external libs required by various binaries; for btrfs-foo, # specify btrfs_foo_libs = <list of libs>; see $($(subst...)) rules below
@@ -85,7 +85,7 @@ lib_links = libbtrfs.so.0 libbtrfs.so headers = $(libbtrfs_headers) # make C=1 to enable sparse -check_defs := .cc-defines.h +check_defs := .cc-defines.h ifdef C # # We're trying to use sparse against glibc headers which go wild
@@ -200,10 +200,6 @@ mkfs.btrfs.static: $(static_objects) mkfs.static.o $(static_libbtrfs_objects) $(Q)$(CC) $(STATIC_CFLAGS) -o mkfs.btrfs.static mkfs.static.o
$(static_objects) \
$(static_libbtrfs_objects) $(STATIC_LDFLAGS) $(STATIC_LIBS)
-btrfstune: $(objects) $(libs) btrfstune.o
- @echo " [LD] $@"
- $(Q)$(CC) $(CFLAGS) -o btrfstune $(objects) btrfstune.o $(LDFLAGS) $(LIBS)
-
dir-test: $(objects) $(libs) dir-test.o
@echo " [LD] $@"
$(Q)$(CC) $(CFLAGS) -o dir-test $(objects) dir-test.o $(LDFLAGS) $(LIBS)
@@ -228,7 +224,7 @@ clean-all: clean-doc clean
clean: $(CLEANDIRS)
@echo "Cleaning"
$(Q)rm -f $(progs) cscope.out *.o *.o.d btrfs-convert btrfs-image
btrfs-select-super \
- btrfs-zero-log btrfstune dir-test ioctl-test quick-test send-test btrfsck \
+ btrfs-zero-log dir-test ioctl-test quick-test send-test btrfsck \
btrfs.static mkfs.btrfs.static btrfs-calc-size \
version.h $(check_defs) \
$(libs) $(lib_links)
btrfstune.c deleted +0 -197
197 lines not on this page · raw message
cmds-device.c +156 -0
184 lines not on this page · raw message
Signature · 2 lines
Best regards, Timofey.
Quoted 4 lines · Timofey Titovets
According to https://btrfs.wiki.kernel.org/index.php/Project_ideas#btrfs
Quote:
merge functionality of btrfstune, eg. under btrfs dev set-seed/dev/(discuss the command name though)
I've added this project idea long time ago and I'm afraid it's not valid anymore, at least not in the proposed way.
Quoted 3 lines
This patch is just code move
After, user can tune btrfs parameters through:
btrfs dev tune -xr/dev/sda2
The btrfstune utility works on an unmounted filesystem and affects the whole filesystem, so the 'device' subgroup is not right here.
Most of the commands from the base utility on a mounted filesystem, so a separate btrfstune makes some distinction. The reason for merging the two was to avoid a 1MB binary for very simple thing, the generic filesystem code can be shared with 'btrfs'.
The question is what's the right UI, a new subcommand, or via the generic properties command? The property interface is not yet populated, so it might be hard to imagine where the tuning settings would go. Something like this:
$ btrfs prop set feature.skinny-metadata 1 /dev/sdx
The extended refs can be turned on even on a mounted filesystem, so this would avoid doing 'echo 1 > /sys/fs/btrfs/UUID/features/extended_iref'.
At this moment I'm inclined to use the properties interface, which means that the btrfstune utility will stay a bit longer. I'll update the project idea to reflect this so it's not confusing anymore (sorry).
No problem =).
Then, just ignore patch.
2014-08-19 17:03 GMT+03:00 David Sterba <[email protected]>:
Quoted 34 lines · Timofey Titovets
Quoted 4 lines
According to https://btrfs.wiki.kernel.org/index.php/Project_ideas#btrfs
Quote:
merge functionality of btrfstune, eg. under btrfs dev set-seed/dev/(discuss the command name though)I've added this project idea long time ago and I'm afraid it's not valid anymore, at least not in the proposed way.
Quoted 3 lines
This patch is just code move
After, user can tune btrfs parameters through:
btrfs dev tune -xr/dev/sda2The btrfstune utility works on an unmounted filesystem and affects the whole filesystem, so the 'device' subgroup is not right here.
Most of the commands from the base utility on a mounted filesystem, so a separate btrfstune makes some distinction. The reason for merging the two was to avoid a 1MB binary for very simple thing, the generic filesystem code can be shared with 'btrfs'.
The question is what's the right UI, a new subcommand, or via the generic properties command? The property interface is not yet populated, so it might be hard to imagine where the tuning settings would go. Something like this:
$ btrfs prop set feature.skinny-metadata 1 /dev/sdxThe extended refs can be turned on even on a mounted filesystem, so this would avoid doing 'echo 1 >
/sys/fs/btrfs/UUID/features/extended_iref'.At this moment I'm inclined to use the properties interface, which means that the btrfstune utility will stay a bit longer. I'll update the project idea to reflect this so it's not confusing anymore (sorry).
Signature · 2 lines
Have a nice day, Timofey.