Skip to contentSkip to conversation

btrfs-progs: Split original mode check to its own

PATCH In review Qu Wenruo 3 participants 4 messages Feb 6, 2018 – Mar 10, 2018

Subsystems (2)
lore
Share & tools
lore

Qu Wenruo

author
#0 lore raw

cover btrfs-progs: Split original mode check to its own

This time, there are 2 patches too large to reach mail list, so please fetch the whole patchset from github as usual:
https://github.com/adam900710/btrfs-progs/tree/split_check_part2

The branch is based on devel branch, whose HEAD is:
commit 3aa1bbdd89ee9c9c48d260a6192fae08328f1b2f (david/devel)

Author: David Sterba <[email protected]>
Date:   Sat Feb 3 01:15:42 2018 +0100

btrfs-progs: mkfs: fix build on musl

Another build failure on musl.

Issue: #90

The first patch moves remaining common code to mode-common.c. Things like transid fix, which is handled in read_tree_block(), get moved to mode-common.c.
And commented added for exported functions.

The 2nd patch moves the original mode code to mode-original.c. Unlike lowmem mode, original mode has more functions exported, as things like bad items repair is integrated into the main funtion.

The last patch moves check/main.c back to cmds-check.c to keep subcommand hierarchy.

With the split done, we now have a clear view about the check code size:

$ wc -l check/*.[ch] cmds-check.c | sort -h
    67 check/mode-lowmem.h
   137 check/mode-common.h
   308 check/mode-original.h
   661 cmds-check.c
  2062 check/mode-common.c
  4573 check/mode-lowmem.c
  7577 check/mode-original.c

Qu Wenruo (3):
btrfs-progs: check: Move more shared codes to mode-common.c
btrfs-progs: Move the remaining original mode code to mode-original.c
btrfs-progs: Move check/main.c to cmds-check.c to maintain the
subcommand hierarchy

 Makefile                          |    7 +-
 check/mode-common.c               | 1711 +++++++++
 check/mode-common.h               |   39 +-
 check/{main.c => mode-original.c} | 6954 ++++++++++++-------------------------
 check/mode-original.h             |   32 +-
 cmds-check.c                      |  661 ++++
 6 files changed, 4742 insertions(+), 4662 deletions(-)
 rename check/{main.c => mode-original.c} (76%)
 create mode 100644 cmds-check.c
Signature · 1 line
2.16.1
author
#1 lore raw

PATCH 3/3 btrfs-progs: Move check/main.c to cmds-check.c to maintain the subcommand hierarchy

cmds-check.c is back now, with include files cleaned up.

---
 Makefile                     |  8 ++++----
 check/main.c => cmds-check.c | 17 -----------------
 2 files changed, 4 insertions(+), 21 deletions(-)
 rename check/main.c => cmds-check.c (97%)
Makefile +4 -4
index f51a8d701a2c..58e894c0171b 100644
@@ -100,6 +100,7 @@ CHECKER_FLAGS := -include $(check_defs) -D__CHECKER__ \
 	-D__CHECK_ENDIAN__ -Wbitwise -Wuninitialized -Wshadow -Wundef \
 	-U_FORTIFY_SOURCE -Wdeclaration-after-statement -Wdefault-bitfield-sign
 
+check_objects = check/mode-lowmem.o check/mode-original.o check/mode-common.o
 objects = ctree.o disk-io.o kernel-lib/radix-tree.o extent-tree.o print-tree.o \
 	  root-tree.o dir-item.o file-item.o inode-item.o inode-map.o \
 	  extent-cache.o extent_io.o volumes.o utils.o repair.o \
@@ -109,12 +110,11 @@ objects = ctree.o disk-io.o kernel-lib/radix-tree.o extent-tree.o print-tree.o \
 	  fsfeatures.o kernel-lib/tables.o kernel-lib/raid56.o transaction.o
 cmds_objects = cmds-subvolume.o cmds-filesystem.o cmds-device.o cmds-scrub.o \
 	       cmds-inspect.o cmds-balance.o cmds-send.o cmds-receive.o \
-	       cmds-quota.o cmds-qgroup.o cmds-replace.o check/main.o \
+	       cmds-quota.o cmds-qgroup.o cmds-replace.o cmds-check.o \
 	       cmds-restore.o cmds-rescue.o chunk-recover.o super-recover.o \
 	       cmds-property.o cmds-fi-usage.o cmds-inspect-dump-tree.o \
 	       cmds-inspect-dump-super.o cmds-inspect-tree-stats.o cmds-fi-du.o \
-	       mkfs/common.o check/mode-common.o check/mode-lowmem.o \
-	       check/mode-original.o
+	       mkfs/common.o
 libbtrfs_objects = send-stream.o send-utils.o kernel-lib/rbtree.o btrfs-list.o \
 		   kernel-lib/crc32c.o messages.o \
 		   uuid-tree.o utils-lib.o rbtree-utils.o
@@ -391,7 +391,7 @@ btrfs-%: btrfs-%.o $(objects) $(standalone_deps) $(libs_static)
 		$(libs_static) \
 		$(LDFLAGS) $(LIBS) $($(subst -,_,$@-libs))
 
-btrfs: btrfs.o $(objects) $(cmds_objects) $(libs_static)
+btrfs: btrfs.o $(objects) $(cmds_objects) $(libs_static) $(check_objects)
 	@echo "    [LD]     $@"
 	$(Q)$(CC) -o $@ $^ $(LDFLAGS) $(LIBS) $(LIBS_COMP)
 
cmds-check.c renamed from check/main.c +0 -17
similarity index 97%
rename from check/main.c
rename to cmds-check.c
index 1bb2142e113e..28746712fac1 100644
@@ -16,32 +16,15 @@
  * Boston, MA 021110-1307, USA.
  */
 
-#include <stdio.h>
-#include <stdlib.h>
-#include <unistd.h>
-#include <fcntl.h>
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <unistd.h>
 #include <getopt.h>
 #include <uuid/uuid.h>
-#include "ctree.h"
 #include "volumes.h"
 #include "repair.h"
 #include "disk-io.h"
-#include "print-tree.h"
 #include "task-utils.h"
 #include "transaction.h"
 #include "utils.h"
-#include "commands.h"
-#include "free-space-cache.h"
-#include "free-space-tree.h"
-#include "btrfsck.h"
 #include "qgroup-verify.h"
-#include "rbtree-utils.h"
-#include "backref.h"
-#include "kernel-shared/ulist.h"
-#include "hash.h"
 #include "help.h"
 #include "check/mode-common.h"
 #include "check/mode-original.h"
Signature · 1 line
2.16.1
#3 lore raw
Quoted 9 lines · David Sterba
Quoted 3 lines · Qu Wenruo

This time, there are 2 patches too large to reach mail list, so please fetch the whole patchset from github as usual:
https://github.com/adam900710/btrfs-progs/tree/split_check_part2

I missed this patch series, sorry. The changes look good, there are unfortunatelly merge conflicts due to the asan/ubsan fixes that should be trivial to resolve. Can you please rebase the branch and let mek now? Thanks.

No problem, would send the new patchset and pull request to info you.

Thanks,
Qu

Quoted 5 lines

--
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-info.html