Skip to contentSkip to conversation

Resend: [RFC PATCH] btrfs-progs: Move btrfstune to btrfs device tune

PATCH Timofey Titovets 1 participant 1 message Aug 14, 2014

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

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
index 45299bb..75f50a2 100644
@@ -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
index 0f7917d..8f21672 100644
@@ -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
index 76565e8..28e190f 100644
@@ -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 · 6 lines
Best regards,
Timofey.
--
To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo