Skip to contentSkip to conversation

btrfs-progs: prep work for syncing files into kernel-shared

PATCH In review Josef Bacik 2 participants 14 messages Apr 19, 2023 – May 2, 2023 Btrfs file system

lore
Share & tools
lore
#0 lore raw

cover btrfs-progs: prep work for syncing files into kernel-shared

Hello,

These a variety of fixes, cleanups, and api changes to make it easier to sync recent kernel changes into btrfs-progs. They're relatively straightforward, and have been run through the tests. Thanks,

Josef

Josef Bacik (11):
btrfs-progs: fix kerncompat.h include ordering for libbtrfs
btrfs-progs: use $SUDO_HELPER in convert tests for temp files
btrfs-progs: re-add __init to include/kerncompat.h
btrfs-progs: introduce UASSERT() for purely userspace code
btrfs-progs: move BTRFS_DISABLE_BACKTRACE check in print_trace
btrfs-progs: remove the _on() related message helpers
btrfs-progs: consolidate the btrfs message helpers
btrfs-progs: rename the qgroup structs to match the kernel
btrfs-progs: remove fs_info argument from btrfs_check_* helpers
btrfs-progs: add a btrfs check helper for checking blocks
btrfs-progs: remove parent_key arg from btrfs_check_* helpers

 check/clear-cache.c         |  4 +-
 check/main.c                | 26 ++++-------
 check/mode-common.c         | 12 ++---
 check/mode-lowmem.c         | 31 ++++++-------
 check/qgroup-verify.c       | 16 +++----
 check/repair.c              | 29 ++++++++++++
 check/repair.h              |  3 +-
 cmds/filesystem-du.c        |  2 +-
 cmds/filesystem-usage.c     |  6 +--
 cmds/qgroup.c               | 42 ++++++++----------
 cmds/replace.c              |  4 +-
 cmds/rescue-chunk-recover.c |  6 +--
 cmds/rescue.c               |  4 +-
 cmds/subvolume-list.c       | 20 ++++-----
 common/device-utils.c       |  4 +-
 common/messages.c           | 69 +----------------------------
 common/messages.h           | 56 ++++++++++++++---------
 common/units.c              |  4 +-
 convert/common.c            |  4 +-
 convert/main.c              |  2 +-
 image/main.c                |  2 +-
 include/kerncompat.h        | 14 ++----
 kernel-shared/ctree.c       | 43 ++++--------------
 kernel-shared/ctree.h       | 88 ++++++++++++++++++-------------------
 kernel-shared/disk-io.c     |  4 +-
 kernel-shared/print-tree.c  | 18 ++++----
 libbtrfs/ctree.h            |  4 +-
 libbtrfs/send-stream.c      |  3 +-
 libbtrfs/send-utils.c       |  2 +-
 mkfs/main.c                 |  4 +-
 tests/common.convert        | 16 +++----
 31 files changed, 231 insertions(+), 311 deletions(-)
Signature · 1 line
2.39.1
#1 lore raw

PATCH 1/11 btrfs-progs: fix kerncompat.h include ordering for libbtrfs

We're keeping a libbtrfs compatible kerncompat.h around to make it easier to modify the rest of btrfs-progs. Unfortunately we also use some of kernel-lib in libbtrfs, and those also include kerncompat.h. Those getting included first means we'll pull include/kerncompat.h instead of libbtrfs/kerncompat.h, which will mess things up.

Fix this by making sure we include our local copy of kerncompat.h first before we include any other header in btrfs-progs.

---
 libbtrfs/ctree.h      | 4 ++--
 libbtrfs/send-utils.c | 2 +-
 2 files changed, 3 insertions(+), 3 deletions(-)
libbtrfs/ctree.h +2 -2
index e7a51c4b..ea2a680e 100644
@@ -22,14 +22,14 @@
 #include <stdbool.h>
 
 #if BTRFS_FLAT_INCLUDES
+#include "libbtrfs/kerncompat.h"
 #include "kernel-lib/list.h"
 #include "kernel-lib/rbtree.h"
-#include "libbtrfs/kerncompat.h"
 #include "libbtrfs/ioctl.h"
 #else
+#include <btrfs/kerncompat.h>
 #include <btrfs/list.h>
 #include <btrfs/rbtree.h>
-#include <btrfs/kerncompat.h>
 #include <btrfs/ioctl.h>
 #endif /* BTRFS_FLAT_INCLUDES */
 
libbtrfs/send-utils.c +1 -1
index 831ec0dc..eb0ed5af 100644
@@ -24,10 +24,10 @@
 #include <fcntl.h>
 #include <limits.h>
 #include <errno.h>
-#include "kernel-lib/rbtree.h"
 #include "libbtrfs/ctree.h"
 #include "libbtrfs/send-utils.h"
 #include "libbtrfs/ioctl.h"
+#include "kernel-lib/rbtree.h"
 
 static int btrfs_subvolid_resolve_sub(int fd, char *path, size_t *path_len,
 				      u64 subvol_id);
Signature · 1 line
2.39.1
#2 lore raw

PATCH 2/11 btrfs-progs: use $SUDO_HELPER in convert tests for temp files

In reply to Josef Bacik

While running make test-convert as a normal user I ran into this problem where we do sudo find <blah> into a mktemp file that's created as the normal user. This results in find getting a EPERM while trying to mess with that temp file. Fix this by using $SUDO_HELPER for all the tempfile manipulations so that root is the owner of everything, which allows the convert tests to run as a normal user.

---
 tests/common.convert | 16 ++++++++--------
 1 file changed, 8 insertions(+), 8 deletions(-)
tests/common.convert +8 -8
index 264972fa..160909eb 100644
@@ -113,32 +113,32 @@ convert_test_perm() {
 
 	_assert_path "$1"
 	PERMTMP="$1"
-	FILES_LIST=$(mktemp --tmpdir btrfs-progs-convert-filelist.XXXXXX)
+	FILES_LIST=$($SUDO_HELPER mktemp --tmpdir btrfs-progs-convert-filelist.XXXXXX)
 
 	run_check $SUDO_HELPER dd if=/dev/zero of="$TEST_MNT/test" "bs=$nodesize" \
 		count=1 status=noxfer >/dev/null 2>&1
 	run_check_stdout $SUDO_HELPER find "$TEST_MNT" -type f ! -name 'image' -fprint "$FILES_LIST"
 	# Fix directory entries order
-	sort "$FILES_LIST" -o "$FILES_LIST"
-	for file in `cat "$FILES_LIST"` ;do
+	$SUDO_HELPER sort "$FILES_LIST" -o "$FILES_LIST"
+	for file in `$SUDO_HELPER cat "$FILES_LIST"` ;do
 		run_check_stdout $SUDO_HELPER getfacl --absolute-names "$file" >> "$PERMTMP"
 	done
-	rm -- "$FILES_LIST"
+	$SUDO_HELPER rm -- "$FILES_LIST"
 }
 # list acls of files on $TEST_MNT
 # $1: path where the acls will be stored
 convert_test_acl() {
 	local ACLSTMP
 	ACLTMP="$1"
-	FILES_LIST=$(mktemp --tmpdir btrfs-progs-convert-filelist.XXXXXX)
+	FILES_LIST=$($SUDO_HELPER mktemp --tmpdir btrfs-progs-convert-filelist.XXXXXX)
 
 	run_check_stdout $SUDO_HELPER find "$TEST_MNT/acls" -type f -fprint "$FILES_LIST"
 	# Fix directory entries order
-	sort "$FILES_LIST" -o "$FILES_LIST"
-	for file in `cat "$FILES_LIST"`;do
+	$SUDO_HELPER sort "$FILES_LIST" -o "$FILES_LIST"
+	for file in `$SUDO_HELPER cat "$FILES_LIST"`;do
 		run_check_stdout $SUDO_HELPER getfattr --absolute-names -d "$file" >> "$ACLTMP"
 	done
-	rm -- "$FILES_LIST"
+	$SUDO_HELPER rm -- "$FILES_LIST"
 }
 
 # do conversion with given features and nodesize, fsck afterwards
Signature · 1 line
2.39.1
#3 lore raw

PATCH 3/11 btrfs-progs: re-add __init to include/kerncompat.h

In reply to Josef Bacik

Now that we're properly separated with libbtrfs/kerncompat.h and include/kerncompat.h, go ahead and add the __init definition back so we can have it available for the kernel synced files.

---
 include/kerncompat.h | 4 ----
 1 file changed, 4 deletions(-)
include/kerncompat.h +0 -4
index 4dce65c0..62b6a357 100644
@@ -578,11 +578,7 @@ struct work_struct {
 typedef struct wait_queue_head_s {
 } wait_queue_head_t;
 
-/*
- * __init cannot be defined in kerncompat.h as it's still part of libbtrfs and
- * the macro name is too generic and can break build.
 #define __init
-*/
 #define __cold
 
 #endif
Signature · 1 line
2.39.1
#4 lore raw

PATCH 4/11 btrfs-progs: introduce UASSERT() for purely userspace code

In reply to Josef Bacik

While syncing messages.[ch] I had to back out the ASSERT() code in kerncompat.h, which means we now rely on the kernel code for ASSERT(). In order to maintain some semblance of separation introduce UASSERT() and use that in all the purely userspace code.

---
 check/clear-cache.c         |  4 ++--
 check/main.c                | 10 +++++-----
 check/mode-common.c         | 12 ++++++------
 check/mode-lowmem.c         | 20 ++++++++++----------
 cmds/filesystem-du.c        |  2 +-
 cmds/filesystem-usage.c     |  6 +++---
 cmds/qgroup.c               | 22 +++++++++++-----------
 cmds/replace.c              |  4 ++--
 cmds/rescue-chunk-recover.c |  6 +++---
 cmds/rescue.c               |  4 ++--
 cmds/subvolume-list.c       | 20 ++++++++++----------
 common/device-utils.c       |  4 ++--
 common/messages.h           |  6 ++++++
 common/units.c              |  4 ++--
 convert/common.c            |  4 ++--
 convert/main.c              |  2 +-
 image/main.c                |  2 +-
 libbtrfs/send-stream.c      |  3 ++-
 mkfs/main.c                 |  4 ++--
 19 files changed, 73 insertions(+), 66 deletions(-)
check/clear-cache.c +2 -2
index 0a3001a4..ecc95167 100644
@@ -505,12 +505,12 @@ int truncate_free_ino_items(struct btrfs_root *root)
 			fi = btrfs_item_ptr(leaf, path.slots[0],
 					    struct btrfs_file_extent_item);
 			extent_type = btrfs_file_extent_type(leaf, fi);
-			ASSERT(extent_type == BTRFS_FILE_EXTENT_REG);
+			UASSERT(extent_type == BTRFS_FILE_EXTENT_REG);
 			extent_disk_bytenr = btrfs_file_extent_disk_bytenr(leaf, fi);
 			extent_num_bytes = btrfs_file_extent_disk_num_bytes (leaf, fi);
 			extent_offset = found_key.offset -
 					btrfs_file_extent_offset(leaf, fi);
-			ASSERT(extent_offset == 0);
+			UASSERT(extent_offset == 0);
 			ret = btrfs_free_extent(trans, root, extent_disk_bytenr,
 						extent_num_bytes, 0, root->objectid,
 						BTRFS_FREE_INO_OBJECTID, 0);
check/main.c +5 -5
index 9a7f40e7..1a9ad50c 100644
@@ -9680,14 +9680,14 @@ static int build_roots_info_cache(void)
 			rii->level = (u8)-1;
 			entry = &rii->cache_extent;
 			ret = insert_cache_extent(roots_info_cache, entry);
-			ASSERT(ret == 0);
+			UASSERT(ret == 0);
 		} else {
 			rii = container_of(entry, struct root_item_info,
 					   cache_extent);
 		}
 
-		ASSERT(rii->cache_extent.start == root_id);
-		ASSERT(rii->cache_extent.size == 1);
+		UASSERT(rii->cache_extent.start == root_id);
+		UASSERT(rii->cache_extent.size == 1);
 
 		if (level > rii->level || rii->level == (u8)-1) {
 			rii->level = level;
@@ -9726,8 +9726,8 @@ static int maybe_repair_root_item(struct btrfs_path *path,
 	}
 
 	rii = container_of(entry, struct root_item_info, cache_extent);
-	ASSERT(rii->cache_extent.start == root_id);
-	ASSERT(rii->cache_extent.size == 1);
+	UASSERT(rii->cache_extent.start == root_id);
+	UASSERT(rii->cache_extent.size == 1);
 
 	if (rii->node_count != 1) {
 		fprintf(stderr,
check/mode-common.c +6 -6
index c8ac235d..ef272368 100644
@@ -224,8 +224,8 @@ int check_prealloc_extent_written(u64 disk_bytenr, u64 num_bytes)
 
 		iref = (struct btrfs_extent_inline_ref *)ptr;
 		type = btrfs_extent_inline_ref_type(path.nodes[0], iref);
-		ASSERT(type == BTRFS_EXTENT_DATA_REF_KEY ||
-		       type == BTRFS_SHARED_DATA_REF_KEY);
+		UASSERT(type == BTRFS_EXTENT_DATA_REF_KEY ||
+			type == BTRFS_SHARED_DATA_REF_KEY);
 
 		if (type == BTRFS_EXTENT_DATA_REF_KEY) {
 			struct btrfs_extent_data_ref *dref;
@@ -398,7 +398,7 @@ int insert_inode_item(struct btrfs_trans_handle *trans,
 	btrfs_set_stack_timespec_sec(&ii.mtime, now);
 
 	ret = btrfs_insert_inode(trans, root, ino, &ii);
-	ASSERT(!ret);
+	UASSERT(!ret);
 
 	warning("root %llu inode %llu recreating inode item, this may "
 		"be incomplete, please check permissions and content after "
@@ -985,7 +985,7 @@ int repair_imode_common(struct btrfs_root *root, struct btrfs_path *path)
 	int ret;
 
 	btrfs_item_key_to_cpu(path->nodes[0], &key, path->slots[0]);
-	ASSERT(key.type == BTRFS_INODE_ITEM_KEY);
+	UASSERT(key.type == BTRFS_INODE_ITEM_KEY);
 	if (root->objectid == BTRFS_ROOT_TREE_OBJECTID) {
 		/* In root tree we only have two possible imode */
 		if (key.objectid == BTRFS_ROOT_TREE_OBJECTID)
@@ -1033,7 +1033,7 @@ int check_repair_free_space_inode(struct btrfs_path *path)
 	int ret = 0;
 
 	btrfs_item_key_to_cpu(path->nodes[0], &key, path->slots[0]);
-	ASSERT(key.type == BTRFS_INODE_ITEM_KEY && is_fstree(key.objectid));
+	UASSERT(key.type == BTRFS_INODE_ITEM_KEY && is_fstree(key.objectid));
 	iitem = btrfs_item_ptr(path->nodes[0], path->slots[0],
 			       struct btrfs_inode_item);
 	mode = btrfs_inode_mode(path->nodes[0], iitem);
@@ -1607,7 +1607,7 @@ static int get_num_devs_in_chunk_tree(struct btrfs_fs_info *fs_info)
 		return ret;
 
 	/* We should be the first slot, and chunk tree should not be empty*/
-	ASSERT(path.slots[0] == 0 && btrfs_header_nritems(path.nodes[0]));
+	UASSERT(path.slots[0] == 0 && btrfs_header_nritems(path.nodes[0]));
 
 	btrfs_item_key_to_cpu(path.nodes[0], &key, path.slots[0]);
 
check/mode-lowmem.c +10 -10
index 10258d34..f0e5f8d6 100644
@@ -833,7 +833,7 @@ static int find_dir_index(struct btrfs_root *root, u64 dirid, u64 location_id,
 	int slot;
 	int ret;
 
-	ASSERT(index_ret);
+	UASSERT(index_ret);
 
 	/* search from the last index */
 	key.objectid = dirid;
@@ -1029,7 +1029,7 @@ static int repair_ternary_lowmem(struct btrfs_root *root, u64 dir_ino, u64 ino,
 		stage++;
 
 	/* stage must be smllarer than 3 */
-	ASSERT(stage < 3);
+	UASSERT(stage < 3);
 
 	trans = btrfs_start_transaction(root, 1);
 	if (stage == 2) {
@@ -1351,7 +1351,7 @@ static int find_inode_ref(struct btrfs_root *root, struct btrfs_key *key,
 	int slot;
 	int ret;
 
-	ASSERT(index_ret);
+	UASSERT(index_ret);
 
 	btrfs_init_path(&path);
 	ret = btrfs_search_slot(NULL, root, key, &path, 0, 0);
@@ -1945,7 +1945,7 @@ recover:
 	recover_ret = btrfs_search_slot(NULL, root, &key, path, 0, 0);
 
 	/* This really shouldn't happen, or we have a big problem */
-	ASSERT(recover_ret == 0);
+	UASSERT(recover_ret == 0);
 	return ret;
 }
 
@@ -2193,7 +2193,7 @@ static int __count_dir_isize(struct btrfs_root *root, u64 ino, int type,
 	int cur = 0;
 	int total = 0;
 
-	ASSERT(size_ret);
+	UASSERT(size_ret);
 	*size_ret = 0;
 
 	key.objectid = ino;
@@ -2247,7 +2247,7 @@ static int count_dir_isize(struct btrfs_root *root, u64 ino, u64 *size)
 	u64 index_size;
 	int ret;
 
-	ASSERT(size);
+	UASSERT(size);
 	ret = __count_dir_isize(root, ino, BTRFS_DIR_ITEM_KEY, &item_size);
 	if (ret)
 		goto out;
@@ -2451,7 +2451,7 @@ static int repair_inode_nlinks_lowmem(struct btrfs_root *root,
 	btrfs_item_key_to_cpu(path->nodes[0], &old_key, path->slots[0]);
 
 	if (name && namelen) {
-		ASSERT(namelen <= BTRFS_NAME_LEN);
+		UASSERT(namelen <= BTRFS_NAME_LEN);
 		memcpy(namebuf, name, namelen);
 		name_len = namelen;
 	} else {
@@ -2550,7 +2550,7 @@ static int repair_inode_gen_lowmem(struct btrfs_root *root,
 	}
 	transid = trans->transid;
 	btrfs_item_key_to_cpu(path->nodes[0], &key, path->slots[0]);
-	ASSERT(key.type == BTRFS_INODE_ITEM_KEY);
+	UASSERT(key.type == BTRFS_INODE_ITEM_KEY);
 
 	btrfs_release_path(path);
 
@@ -4188,8 +4188,8 @@ static int repair_extent_item_generation(struct btrfs_path *path)
 	int ret;
 
 	btrfs_item_key_to_cpu(path->nodes[0], &key, path->slots[0]);
-	ASSERT(key.type == BTRFS_METADATA_ITEM_KEY ||
-	       key.type == BTRFS_EXTENT_ITEM_KEY);
+	UASSERT(key.type == BTRFS_METADATA_ITEM_KEY ||
+		key.type == BTRFS_EXTENT_ITEM_KEY);
 
 	get_extent_item_generation(key.objectid, &new_gen);
 	ret = avoid_extents_overwrite();
cmds/filesystem-du.c +1 -1
index 0e1210e0..33b6d901 100644
@@ -87,7 +87,7 @@ static int add_shared_extent(u64 start, u64 len, struct rb_root *root)
 {
 	struct shared_extent *sh;
 
-	ASSERT(len != 0);
+	UASSERT(len != 0);
 
 	sh = calloc(1, sizeof(*sh));
 	if (!sh)
cmds/filesystem-usage.c +3 -3
index e483c104..d1e7eed1 100644
@@ -383,15 +383,15 @@ static void get_raid56_space_info(struct btrfs_ioctl_space_args *sargs,
 		size = info_ptr->size / (info_ptr->num_stripes - parities_count);
 
 		if (info_ptr->type & BTRFS_BLOCK_GROUP_DATA) {
-			ASSERT(l_data_ratio >= 0);
+			UASSERT(l_data_ratio >= 0);
 			*r_data_chunks += size;
 			*r_data_used += size * l_data_ratio;
 		} else if (info_ptr->type & BTRFS_BLOCK_GROUP_METADATA) {
-			ASSERT(l_metadata_ratio >= 0);
+			UASSERT(l_metadata_ratio >= 0);
 			*r_metadata_chunks += size;
 			*r_metadata_used += size * l_metadata_ratio;
 		} else if (info_ptr->type & BTRFS_BLOCK_GROUP_SYSTEM) {
-			ASSERT(l_system_ratio >= 0);
+			UASSERT(l_system_ratio >= 0);
 			*r_system_chunks += size;
 			*r_system_used += size * l_system_ratio;
 		}
cmds/qgroup.c +11 -11
index 49014d57..125362b8 100644
@@ -222,7 +222,7 @@ static void qgroup_setup_print_column(enum btrfs_qgroup_column_enum column)
 {
 	int i;
 
-	ASSERT(0 <= column && column <= BTRFS_QGROUP_ALL);
+	UASSERT(0 <= column && column <= BTRFS_QGROUP_ALL);
 
 	if (column < BTRFS_QGROUP_ALL) {
 		btrfs_qgroup_columns[column].need_print = 1;
@@ -332,7 +332,7 @@ static void print_qgroup_column(struct btrfs_qgroup *qgroup,
 	int unit_mode = btrfs_qgroup_columns[column].unit_mode;
 	int max_len = btrfs_qgroup_columns[column].max_len;
 
-	ASSERT(0 <= column && column < BTRFS_QGROUP_ALL);
+	UASSERT(0 <= column && column < BTRFS_QGROUP_ALL);
 
 	switch (column) {
 
@@ -617,9 +617,9 @@ static int qgroup_setup_comparer(struct btrfs_qgroup_comparer_set **comp_set,
 	struct btrfs_qgroup_comparer_set *set = *comp_set;
 	int size;
 
-	ASSERT(set != NULL);
-	ASSERT(comparer < BTRFS_QGROUP_COMP_MAX);
-	ASSERT(set->ncomps <= set->total);
+	UASSERT(set != NULL);
+	UASSERT(comparer < BTRFS_QGROUP_COMP_MAX);
+	UASSERT(set->ncomps <= set->total);
 
 	if (set->ncomps == set->total) {
 		void *tmp;
@@ -641,7 +641,7 @@ static int qgroup_setup_comparer(struct btrfs_qgroup_comparer_set **comp_set,
 		*comp_set = set;
 	}
 
-	ASSERT(set->comps[set->ncomps].comp_func == NULL);
+	UASSERT(set->comps[set->ncomps].comp_func == NULL);
 
 	set->comps[set->ncomps].comp_func = all_comp_funcs[comparer];
 	set->comps[set->ncomps].is_descending = is_descending;
@@ -1014,9 +1014,9 @@ static int qgroup_setup_filter(struct btrfs_qgroup_filter_set **filter_set,
 	struct btrfs_qgroup_filter_set *set = *filter_set;
 	int size;
 
-	ASSERT(set != NULL);
-	ASSERT(filter < BTRFS_QGROUP_FILTER_MAX);
-	ASSERT(set->nfilters <= set->total);
+	UASSERT(set != NULL);
+	UASSERT(filter < BTRFS_QGROUP_FILTER_MAX);
+	UASSERT(set->nfilters <= set->total);
 
 	if (set->nfilters == set->total) {
 		void *tmp;
@@ -1038,7 +1038,7 @@ static int qgroup_setup_filter(struct btrfs_qgroup_filter_set **filter_set,
 		*filter_set = set;
 	}
 
-	ASSERT(set->filters[set->nfilters].filter_func == NULL);
+	UASSERT(set->filters[set->nfilters].filter_func == NULL);
 	set->filters[set->nfilters].filter_func = all_filter_funcs[filter];
 	set->filters[set->nfilters].data = data;
 	set->nfilters++;
@@ -1114,7 +1114,7 @@ static void __update_columns_max_len(struct btrfs_qgroup *bq,
 	int len;
 	unsigned unit_mode = btrfs_qgroup_columns[column].unit_mode;
 
-	ASSERT(0 <= column && column < BTRFS_QGROUP_ALL);
+	UASSERT(0 <= column && column < BTRFS_QGROUP_ALL);
 
 	switch (column) {
 
cmds/replace.c +2 -2
index ad914306..2748b7fb 100644
@@ -519,7 +519,7 @@ time2string(char *buf, size_t s, __u64 t)
 	time_t t_time_t;
 
 	t_time_t = (time_t)t;
-	ASSERT((__u64)t_time_t == t);
+	UASSERT((__u64)t_time_t == t);
 	localtime_r(&t_time_t, &t_tm);
 	strftime(buf, s, "%e.%b %T", &t_tm);
 	return buf;
@@ -529,7 +529,7 @@ static char *
 progress2string(char *buf, size_t s, int progress_1000)
 {
 	snprintf(buf, s, "%d.%01d%%", progress_1000 / 10, progress_1000 % 10);
-	ASSERT(s > 0);
+	UASSERT(s > 0);
 	buf[s - 1] = '\0';
 	return buf;
 }
cmds/rescue-chunk-recover.c +3 -3
index 500509fd..6a1b6734 100644
@@ -1455,7 +1455,7 @@ open_ctree_with_broken_chunk(struct recover_control *rc)
 		goto out_devices;
 	}
 
-	ASSERT(!memcmp(disk_super->fsid, rc->fs_devices->fsid, BTRFS_FSID_SIZE));
+	UASSERT(!memcmp(disk_super->fsid, rc->fs_devices->fsid, BTRFS_FSID_SIZE));
 	fs_info->sectorsize = btrfs_super_sectorsize(disk_super);
 	fs_info->nodesize = btrfs_super_nodesize(disk_super);
 	fs_info->stripesize = btrfs_super_stripesize(disk_super);
@@ -1467,7 +1467,7 @@ open_ctree_with_broken_chunk(struct recover_control *rc)
 	features = btrfs_super_incompat_flags(disk_super);
 
 	if (features & BTRFS_FEATURE_INCOMPAT_METADATA_UUID)
-		ASSERT(!memcmp(disk_super->metadata_uuid,
+		UASSERT(!memcmp(disk_super->metadata_uuid,
 			       fs_info->fs_devices->metadata_uuid,
 			       BTRFS_FSID_SIZE));
 
@@ -1869,7 +1869,7 @@ static int check_one_csum(int fd, u64 start, u32 len, u32 tree_csum,
 	int csum_size = 0;
 	u8 expected_csum[BTRFS_CSUM_SIZE];
 
-	ASSERT(0);
+	UASSERT(0);
 
 	data = malloc(len);
 	if (!data)
cmds/rescue.c +2 -2
index 28a54a65..cbeaa6f2 100644
@@ -322,8 +322,8 @@ static int clear_uuid_tree(struct btrfs_fs_info *fs_info)
 		ret = btrfs_search_slot(trans, uuid_root, &key, &path, -1, 1);
 		if (ret < 0)
 			goto out;
-		ASSERT(ret > 0);
-		ASSERT(path.slots[0] == 0);
+		UASSERT(ret > 0);
+		UASSERT(path.slots[0] == 0);
 
 		nr = btrfs_header_nritems(path.nodes[0]);
 		if (nr == 0) {
cmds/subvolume-list.c +10 -10
index 750fc4e6..e0a7b339 100644
@@ -284,7 +284,7 @@ void btrfs_list_setup_print_column(enum btrfs_list_column_enum column)
 {
 	int i;
 
-	ASSERT(0 <= column && column <= BTRFS_LIST_ALL);
+	UASSERT(0 <= column && column <= BTRFS_LIST_ALL);
 
 	if (column < BTRFS_LIST_ALL) {
 		btrfs_list_columns[column].need_print = 1;
@@ -367,9 +367,9 @@ static int btrfs_list_setup_comparer(struct btrfs_list_comparer_set **comp_set,
 	struct btrfs_list_comparer_set *set = *comp_set;
 	int size;
 
-	ASSERT(set != NULL);
-	ASSERT(comparer < BTRFS_LIST_COMP_MAX);
-	ASSERT(set->ncomps <= set->total);
+	UASSERT(set != NULL);
+	UASSERT(comparer < BTRFS_LIST_COMP_MAX);
+	UASSERT(set->ncomps <= set->total);
 
 	if (set->ncomps == set->total) {
 		void *tmp;
@@ -391,7 +391,7 @@ static int btrfs_list_setup_comparer(struct btrfs_list_comparer_set **comp_set,
 		*comp_set = set;
 	}
 
-	ASSERT(set->comps[set->ncomps].comp_func == NULL);
+	UASSERT(set->comps[set->ncomps].comp_func == NULL);
 
 	set->comps[set->ncomps].comp_func = all_comp_funcs[comparer];
 	set->comps[set->ncomps].is_descending = is_descending;
@@ -1027,9 +1027,9 @@ static void btrfs_list_setup_filter(struct btrfs_list_filter_set **filter_set,
 	struct btrfs_list_filter_set *set = *filter_set;
 	int size;
 
-	ASSERT(set != NULL);
-	ASSERT(filter < BTRFS_LIST_FILTER_MAX);
-	ASSERT(set->nfilters <= set->total);
+	UASSERT(set != NULL);
+	UASSERT(filter < BTRFS_LIST_FILTER_MAX);
+	UASSERT(set->nfilters <= set->total);
 
 	if (set->nfilters == set->total) {
 		void *tmp;
@@ -1051,7 +1051,7 @@ static void btrfs_list_setup_filter(struct btrfs_list_filter_set **filter_set,
 		*filter_set = set;
 	}
 
-	ASSERT(set->filters[set->nfilters].filter_func == NULL);
+	UASSERT(set->filters[set->nfilters].filter_func == NULL);
 
 	if (filter == BTRFS_LIST_FILTER_DELETED)
 		set->only_deleted = 1;
@@ -1129,7 +1129,7 @@ static void print_subvolume_column(struct root_info *subv,
 	char tstr[256];
 	char uuidparse[BTRFS_UUID_UNPARSED_SIZE];
 
-	ASSERT(0 <= column && column < BTRFS_LIST_ALL);
+	UASSERT(0 <= column && column < BTRFS_LIST_ALL);
 
 	switch (column) {
 	case BTRFS_LIST_OBJECTID:
common/device-utils.c +2 -2
index cb1a7a9d..2e8aeb8b 100644
@@ -539,7 +539,7 @@ ssize_t btrfs_direct_pio(int rw, int fd, void *buf, size_t count, off_t offset)
 	int ret;
 	ssize_t ret_rw;
 
-	ASSERT(rw == READ || rw == WRITE);
+	UASSERT(rw == READ || rw == WRITE);
 
 	if (fstat(fd, &stat_buf) == -1) {
 		error("fstat failed: %m");
@@ -579,7 +579,7 @@ ssize_t btrfs_direct_pio(int rw, int fd, void *buf, size_t count, off_t offset)
 	}
 
 	if (rw == WRITE) {
-		ASSERT(iosize == count);
+		UASSERT(iosize == count);
 		memcpy(bounce_buf, buf, count);
 		ret_rw = pwrite(fd, bounce_buf, iosize, offset);
 	} else {
common/messages.h +6 -0
index da97c045..b512544f 100644
@@ -145,4 +145,10 @@ enum common_error {
 __attribute__ ((format (printf, 2, 3)))
 void error_msg(enum common_error error, const char *msg, ...);
 
+#ifndef BTRFS_DISABLE_BACKTRACE
+#define	UASSERT(c) assert_trace(#c, __FILE__, __func__, __LINE__, (long)(c))
+#else
+#define UASSERT(c) assert(c)
+#endif
+
 #endif
common/units.c +2 -2
index 8d708cdd..27eac098 100644
@@ -79,7 +79,7 @@ int pretty_size_snprintf(u64 size, char *str, size_t str_size, unsigned unit_mod
 	/* Unknown mode */
 	if (!base) {
 		internal_error("unknown unit base, mode %u", unit_mode);
-		ASSERT(0);
+		UASSERT(0);
 		return -1;
 	}
 
@@ -135,7 +135,7 @@ int pretty_size_snprintf(u64 size, char *str, size_t str_size, unsigned unit_mod
 	if (num_divs >= ARRAY_SIZE(unit_suffix_binary)) {
 		str[0] = '\0';
 		internal_error("unsupported unit suffix, index %d", num_divs);
-		ASSERT(0);
+		UASSERT(0);
 		return -1;
 	}
 
convert/common.c +2 -2
index 1a85085f..f104d93f 100644
@@ -44,7 +44,7 @@ static int reserve_free_space(struct cache_tree *free_tree, u64 len,
 	struct cache_extent *cache;
 	int found = 0;
 
-	ASSERT(ret_start != NULL);
+	UASSERT(ret_start != NULL);
 	cache = first_cache_extent(free_tree);
 	while (cache) {
 		if (cache->size > len) {
@@ -807,7 +807,7 @@ int make_convert_btrfs(int fd, struct btrfs_mkfs_config *cfg,
 	int ret;
 
 	/* Source filesystem must be opened, checked and analyzed in advance */
-	ASSERT(!cache_tree_empty(used_space));
+	UASSERT(!cache_tree_empty(used_space));
 
 	/*
 	 * reserve space for temporary superblock first
convert/main.c +1 -1
index 3f54ea30..16520914 100644
@@ -1167,7 +1167,7 @@ static int do_convert(const char *devname, u32 convert_flags, u32 nodesize,
 	if (ret)
 		goto fail;
 
-	ASSERT(cctx.total_bytes != 0);
+	UASSERT(cctx.total_bytes != 0);
 	blocksize = cctx.blocksize;
 	if (blocksize < 4096) {
 		error("block size is too small: %u < 4096", blocksize);
image/main.c +1 -1
index 43ee660d..7fa215c1 100644
@@ -1399,7 +1399,7 @@ static int restore_one_work(struct mdrestore_struct *mdres,
 	int compress_method = mdres->compress_method;
 	int ret;
 
-	ASSERT(is_power_of_2(bufsize));
+	UASSERT(is_power_of_2(bufsize));
 
 	if (compress_method == COMPRESS_ZLIB) {
 		strm.zalloc = Z_NULL;
libbtrfs/send-stream.c +2 -1
index 2e89814a..16aef3ab 100644
@@ -26,6 +26,7 @@
 #include "libbtrfs/send-stream.h"
 #include "libbtrfs/ctree.h"
 #include "libbtrfs/crc32c.h"
+#include "common/messages.h"
 
 struct btrfs_send_stream {
 	char read_buf[BTRFS_SEND_BUF_SIZE];
@@ -108,7 +109,7 @@ static int read_cmd(struct btrfs_send_stream *sctx)
 
 	memset(sctx->cmd_attrs, 0, sizeof(sctx->cmd_attrs));
 
-	ASSERT(sizeof(*sctx->cmd_hdr) <= sizeof(sctx->read_buf));
+	UASSERT(sizeof(*sctx->cmd_hdr) <= sizeof(sctx->read_buf));
 	ret = read_buf(sctx, sctx->read_buf, sizeof(*sctx->cmd_hdr));
 	if (ret < 0)
 		goto out;
mkfs/main.c +2 -2
index 686c6b2f..4856cf96 100644
@@ -272,7 +272,7 @@ static int __recow_root(struct btrfs_trans_handle *trans, struct btrfs_root *roo
 			goto out;
 		ret = 0;
 		btrfs_item_key_to_cpu(path.nodes[0], &found_key, 0);
-		ASSERT(btrfs_comp_cpu_keys(&key, &found_key) == 0);
+		UASSERT(btrfs_comp_cpu_keys(&key, &found_key) == 0);
 
 next:
 		ret = btrfs_next_leaf(root, &path);
@@ -782,7 +782,7 @@ static int create_uuid_tree(struct btrfs_trans_handle *trans)
 	};
 	int ret = 0;
 
-	ASSERT(fs_info->uuid_root == NULL);
+	UASSERT(fs_info->uuid_root == NULL);
 	root = btrfs_create_tree(trans, fs_info, &key);
 	if (IS_ERR(root)) {
 		ret = PTR_ERR(root);
Signature · 1 line
2.39.1
#5 lore raw

PATCH 5/11 btrfs-progs: move BTRFS_DISABLE_BACKTRACE check in print_trace

In reply to Josef Bacik

Everybody who calls print_trace wraps it around this check, move the check instead to print_trace and remove the check from all the callers.

---
 common/messages.c    |  3 ---
 include/kerncompat.h | 10 +++-------
 2 files changed, 3 insertions(+), 10 deletions(-)
common/messages.c +0 -3
index 2d9d55c0..4ef7a34a 100644
@@ -96,10 +96,7 @@ void internal_error(const char *fmt, ...)
 	vfprintf(stderr, fmt, vargs);
 	va_end(vargs);
 	fputc('\n', stderr);
-
-#ifndef BTRFS_DISABLE_BACKTRACE
 	print_trace();
-#endif
 }
 
 static bool should_print(int level)
include/kerncompat.h +3 -7
index 62b6a357..cb2a9400 100644
@@ -94,17 +94,17 @@
 #define BUILD_ASSERT(x)
 #endif
 
-#ifndef BTRFS_DISABLE_BACKTRACE
-#define MAX_BACKTRACE	16
 static inline void print_trace(void)
 {
+#ifndef BTRFS_DISABLE_BACKTRACE
+#define MAX_BACKTRACE	16
 	void *array[MAX_BACKTRACE];
 	int size;
 
 	size = backtrace(array, MAX_BACKTRACE);
 	backtrace_symbols_fd(array, size, 2);
-}
 #endif
+}
 
 static inline void warning_trace(const char *assertion, const char *filename,
 			      const char *func, unsigned line, long val)
@@ -114,9 +114,7 @@ static inline void warning_trace(const char *assertion, const char *filename,
 	fprintf(stderr,
 		"%s:%u: %s: Warning: assertion `%s` failed, value %ld\n",
 		filename, line, func, assertion, val);
-#ifndef BTRFS_DISABLE_BACKTRACE
 	print_trace();
-#endif
 }
 
 static inline void bugon_trace(const char *assertion, const char *filename,
@@ -127,9 +125,7 @@ static inline void bugon_trace(const char *assertion, const char *filename,
 	fprintf(stderr,
 		"%s:%u: %s: BUG_ON `%s` triggered, value %ld\n",
 		filename, line, func, assertion, val);
-#ifndef BTRFS_DISABLE_BACKTRACE
 	print_trace();
-#endif
 	abort();
 	exit(1);
 }
Signature · 1 line
2.39.1
#8 lore raw

PATCH 7/11 btrfs-progs: consolidate the btrfs message helpers

In reply to Josef Bacik

These helpers all do variations on the same thing, so add a helper to just do the printf part, and a macro to handle the special prefix and postfix, and then make the helpers just use the macro and new helper.

---
 common/messages.c | 32 +-------------------------------
 common/messages.h | 30 +++++++++++++++++++++++-------
 2 files changed, 24 insertions(+), 38 deletions(-)
common/messages.c +1 -31
index 5e7f2dfa..d6dc219b 100644
@@ -19,9 +19,6 @@
 #include "common/messages.h"
 #include "common/utils.h"
 
-#define PREFIX_ERROR		"ERROR: "
-#define PREFIX_WARNING		"WARNING: "
-
 static const char *common_error_string[] = {
 	[ERROR_MSG_MEMORY]	= "not enough memory",
 	[ERROR_MSG_START_TRANS] = "failed to start transaction",
@@ -29,40 +26,13 @@ static const char *common_error_string[] = {
 };
 
 __attribute__ ((format (printf, 1, 2)))
-void __btrfs_warning(const char *fmt, ...)
-{
-	va_list args;
-
-	fputs(PREFIX_WARNING, stderr);
-	va_start(args, fmt);
-	vfprintf(stderr, fmt, args);
-	va_end(args);
-	fputc('\n', stderr);
-}
-
-__attribute__ ((format (printf, 1, 2)))
-void __btrfs_error(const char *fmt, ...)
+void __btrfs_printf(const char *fmt, ...)
 {
 	va_list args;
 
-	fputs(PREFIX_ERROR, stderr);
 	va_start(args, fmt);
 	vfprintf(stderr, fmt, args);
 	va_end(args);
-	fputc('\n', stderr);
-}
-
-__attribute__ ((format (printf, 1, 2)))
-void internal_error(const char *fmt, ...)
-{
-	va_list vargs;
-
-	va_start(vargs, fmt);
-	fputs("INTERNAL " PREFIX_ERROR, stderr);
-	vfprintf(stderr, fmt, vargs);
-	va_end(vargs);
-	fputc('\n', stderr);
-	print_trace();
 }
 
 static bool should_print(int level)
common/messages.h +23 -7
index 6a105484..4bb9866e 100644
@@ -40,6 +40,28 @@
 #define DO_ABORT_ON_ERROR	do { } while (0)
 #endif
 
+#define PREFIX_ERROR		"ERROR: "
+#define PREFIX_WARNING		"WARNING: "
+
+#define __btrfs_msg(prefix, fmt, ...)					\
+	do {								\
+		fputs((prefix), stderr);				\
+		__btrfs_printf((fmt), ##__VA_ARGS__);			\
+		fputc('\n', stderr);					\
+	} while (0)
+
+#define __btrfs_warning(fmt, ...) \
+	__btrfs_msg(PREFIX_WARNING, fmt, ##__VA_ARGS__)
+
+#define __btrfs_error(fmt, ...) \
+	__btrfs_msg(PREFIX_ERROR, fmt, ##__VA_ARGS__)
+
+#define internal_error(fmt, ...)						\
+	do {									\
+		__btrfs_msg("INTERNAL " PREFIX_ERROR, fmt, ##__VA_ARGS__);	\
+		print_trace();							\
+	} while (0)
+
 #define error(fmt, ...)							\
 	do {								\
 		PRINT_TRACE_ON_ERROR;					\
@@ -87,13 +109,7 @@
 	} while (0)
 
 __attribute__ ((format (printf, 1, 2)))
-void __btrfs_warning(const char *fmt, ...);
-
-__attribute__ ((format (printf, 1, 2)))
-void __btrfs_error(const char *fmt, ...);
-
-__attribute__ ((format (printf, 1, 2)))
-void internal_error(const char *fmt, ...);
+void __btrfs_printf(const char *fmt, ...);
 
 /*
  * Level of messages that must be printed by default (in case the verbosity
Signature · 1 line
2.39.1
#6 lore raw

PATCH 6/11 btrfs-progs: remove the _on() related message helpers

In reply to Josef Bacik

We have different helpers for warning_on and error_on(), which take the condition and then do the printf. However we can just check the condition in the macro and call the normal warning or error helper, so clean this usage up and delete the unneeded message helpers.

---
 common/messages.c | 34 ----------------------------------
 common/messages.h | 20 ++++++--------------
 2 files changed, 6 insertions(+), 48 deletions(-)
common/messages.c +0 -34
index 4ef7a34a..5e7f2dfa 100644
@@ -52,40 +52,6 @@ void __btrfs_error(const char *fmt, ...)
 	fputc('\n', stderr);
 }
 
-__attribute__ ((format (printf, 2, 3)))
-int __btrfs_warning_on(int condition, const char *fmt, ...)
-{
-	va_list args;
-
-	if (!condition)
-		return 0;
-
-	fputs(PREFIX_WARNING, stderr);
-	va_start(args, fmt);
-	vfprintf(stderr, fmt, args);
-	va_end(args);
-	fputc('\n', stderr);
-
-	return 1;
-}
-
-__attribute__ ((format (printf, 2, 3)))
-int __btrfs_error_on(int condition, const char *fmt, ...)
-{
-	va_list args;
-
-	if (!condition)
-		return 0;
-
-	fputs(PREFIX_ERROR, stderr);
-	va_start(args, fmt);
-	vfprintf(stderr, fmt, args);
-	va_end(args);
-	fputc('\n', stderr);
-
-	return 1;
-}
-
 __attribute__ ((format (printf, 1, 2)))
 void internal_error(const char *fmt, ...)
 {
common/messages.h +6 -14
index b512544f..6a105484 100644
@@ -50,13 +50,11 @@
 
 #define error_on(cond, fmt, ...)					\
 	do {								\
-		if ((cond))						\
+		if ((cond)) {						\
 			PRINT_TRACE_ON_ERROR;				\
-		if ((cond))						\
 			PRINT_VERBOSE_ERROR;				\
-		__btrfs_error_on((cond), (fmt), ##__VA_ARGS__);		\
-		if ((cond))						\
-			DO_ABORT_ON_ERROR;				\
+			__btrfs_error((fmt), ##__VA_ARGS__);		\
+		}							\
 	} while (0)
 
 #define error_btrfs_util(err)						\
@@ -81,11 +79,11 @@
 
 #define warning_on(cond, fmt, ...)					\
 	do {								\
-		if ((cond))						\
+		if ((cond)) {						\
 			PRINT_TRACE_ON_ERROR;				\
-		if ((cond))						\
 			PRINT_VERBOSE_ERROR;				\
-		__btrfs_warning_on((cond), (fmt), ##__VA_ARGS__);	\
+			__btrfs_warning((fmt), ##__VA_ARGS__);		\
+		}							\
 	} while (0)
 
 __attribute__ ((format (printf, 1, 2)))
@@ -94,12 +92,6 @@ void __btrfs_warning(const char *fmt, ...);
 __attribute__ ((format (printf, 1, 2)))
 void __btrfs_error(const char *fmt, ...);
 
-__attribute__ ((format (printf, 2, 3)))
-int __btrfs_warning_on(int condition, const char *fmt, ...);
-
-__attribute__ ((format (printf, 2, 3)))
-int __btrfs_error_on(int condition, const char *fmt, ...);
-
 __attribute__ ((format (printf, 1, 2)))
 void internal_error(const char *fmt, ...);
 
Signature · 1 line
2.39.1
#10 lore raw

PATCH 9/11 btrfs-progs: remove fs_info argument from btrfs_check_* helpers

In reply to Josef Bacik

This can be pulled out of the extent buffer that is passed in, drop the fs_info argument from the function.

---
 check/main.c            | 12 ++++++------
 check/mode-lowmem.c     | 10 +++++-----
 kernel-shared/ctree.c   | 12 ++++++------
 kernel-shared/ctree.h   |  6 ++----
 kernel-shared/disk-io.c |  4 ++--
 5 files changed, 21 insertions(+), 23 deletions(-)
check/main.c +6 -6
index 1a9ad50c..8c3a10a1 100644
@@ -1921,9 +1921,9 @@ static int walk_down_tree(struct btrfs_root *root, struct btrfs_path *path,
 		}
 
 		if (btrfs_is_leaf(next))
-			status = btrfs_check_leaf(gfs_info, NULL, next);
+			status = btrfs_check_leaf(NULL, next);
 		else
-			status = btrfs_check_node(gfs_info, NULL, next);
+			status = btrfs_check_node(NULL, next);
 		if (status != BTRFS_TREE_BLOCK_CLEAN) {
 			free_extent_buffer(next);
 			err = -EIO;
@@ -3702,9 +3702,9 @@ static int check_fs_root(struct btrfs_root *root,
 
 	/* We may not have checked the root block, lets do that now */
 	if (btrfs_is_leaf(root->node))
-		status = btrfs_check_leaf(gfs_info, NULL, root->node);
+		status = btrfs_check_leaf(NULL, root->node);
 	else
-		status = btrfs_check_node(gfs_info, NULL, root->node);
+		status = btrfs_check_node(NULL, root->node);
 	if (status != BTRFS_TREE_BLOCK_CLEAN)
 		return -EIO;
 
@@ -4608,9 +4608,9 @@ static int check_block(struct btrfs_root *root,
 	rec->info_level = level;
 
 	if (btrfs_is_leaf(buf))
-		status = btrfs_check_leaf(gfs_info, &rec->parent_key, buf);
+		status = btrfs_check_leaf(&rec->parent_key, buf);
 	else
-		status = btrfs_check_node(gfs_info, &rec->parent_key, buf);
+		status = btrfs_check_node(&rec->parent_key, buf);
 
 	if (status != BTRFS_TREE_BLOCK_CLEAN) {
 		if (opt_check_repair)
check/mode-lowmem.c +5 -5
index f0e5f8d6..1672da26 100644
@@ -2695,7 +2695,7 @@ static int check_inode_item(struct btrfs_root *root, struct btrfs_path *path)
 		 * we need to bail otherwise we could end up stuck.
 		 */
 		if (path->slots[0] == 0 &&
-		    btrfs_check_leaf(gfs_info, NULL, path->nodes[0]))
+		    btrfs_check_leaf(NULL, path->nodes[0]))
 			ret = -EIO;
 
 		if (ret < 0) {
@@ -5001,7 +5001,7 @@ static int walk_down_tree(struct btrfs_root *root, struct btrfs_path *path,
 		if (*level == 0) {
 			/* skip duplicate check */
 			if (check || !check_all) {
-				ret = btrfs_check_leaf(gfs_info, NULL, cur);
+				ret = btrfs_check_leaf(NULL, cur);
 				if (ret != BTRFS_TREE_BLOCK_CLEAN) {
 					err |= -EIO;
 					break;
@@ -5018,7 +5018,7 @@ static int walk_down_tree(struct btrfs_root *root, struct btrfs_path *path,
 			break;
 		}
 		if (check || !check_all) {
-			ret = btrfs_check_node(gfs_info, NULL, cur);
+			ret = btrfs_check_node(NULL, cur);
 			if (ret != BTRFS_TREE_BLOCK_CLEAN) {
 				err |= -EIO;
 				break;
@@ -5066,9 +5066,9 @@ static int walk_down_tree(struct btrfs_root *root, struct btrfs_path *path,
 			break;
 
 		if (btrfs_is_leaf(next))
-			status = btrfs_check_leaf(gfs_info, NULL, next);
+			status = btrfs_check_leaf(NULL, next);
 		else
-			status = btrfs_check_node(gfs_info, NULL, next);
+			status = btrfs_check_node(NULL, next);
 		if (status != BTRFS_TREE_BLOCK_CLEAN) {
 			free_extent_buffer(next);
 			err |= -EIO;
kernel-shared/ctree.c +6 -6
index 7d1b1316..fb56a863 100644
@@ -612,9 +612,9 @@ static void generic_err(const struct extent_buffer *buf, int slot,
 }
 
 enum btrfs_tree_block_status
-btrfs_check_node(struct btrfs_fs_info *fs_info,
-		 struct btrfs_key *parent_key, struct extent_buffer *node)
+btrfs_check_node(struct btrfs_key *parent_key, struct extent_buffer *node)
 {
+	struct btrfs_fs_info *fs_info = node->fs_info;
 	unsigned long nr = btrfs_header_nritems(node);
 	struct btrfs_key key, next_key;
 	int slot;
@@ -683,9 +683,9 @@ fail:
 }
 
 enum btrfs_tree_block_status
-btrfs_check_leaf(struct btrfs_fs_info *fs_info,
-		 struct btrfs_key *parent_key, struct extent_buffer *leaf)
+btrfs_check_leaf(struct btrfs_key *parent_key, struct extent_buffer *leaf)
 {
+	struct btrfs_fs_info *fs_info = leaf->fs_info;
 	/* No valid key type is 0, so all key should be larger than this key */
 	struct btrfs_key prev_key = {0, 0, 0};
 	struct btrfs_key key;
@@ -811,9 +811,9 @@ static int noinline check_block(struct btrfs_fs_info *fs_info,
 		parent_key_ptr = &key;
 	}
 	if (level == 0)
-		ret = btrfs_check_leaf(fs_info, parent_key_ptr, path->nodes[0]);
+		ret = btrfs_check_leaf(parent_key_ptr, path->nodes[0]);
 	else
-		ret = btrfs_check_node(fs_info, parent_key_ptr, path->nodes[level]);
+		ret = btrfs_check_node(parent_key_ptr, path->nodes[level]);
 	if (ret == BTRFS_TREE_BLOCK_CLEAN)
 		return 0;
 	return -EIO;
kernel-shared/ctree.h +2 -4
index df7526d4..13264387 100644
@@ -2705,11 +2705,9 @@ int btrfs_comp_cpu_keys(const struct btrfs_key *k1, const struct btrfs_key *k2);
 int btrfs_del_ptr(struct btrfs_root *root, struct btrfs_path *path,
 		int level, int slot);
 enum btrfs_tree_block_status
-btrfs_check_node(struct btrfs_fs_info *fs_info,
-		 struct btrfs_key *parent_key, struct extent_buffer *buf);
+btrfs_check_node(struct btrfs_key *parent_key, struct extent_buffer *buf);
 enum btrfs_tree_block_status
-btrfs_check_leaf(struct btrfs_fs_info *fs_info,
-		 struct btrfs_key *parent_key, struct extent_buffer *buf);
+btrfs_check_leaf(struct btrfs_key *parent_key, struct extent_buffer *buf);
 void reada_for_search(struct btrfs_fs_info *fs_info, struct btrfs_path *path,
 		      int level, int slot, u64 objectid);
 struct extent_buffer *read_node_slot(struct btrfs_fs_info *fs_info,
kernel-shared/disk-io.c +2 -2
index 3d2574d9..b5ad89c2 100644
@@ -389,9 +389,9 @@ struct extent_buffer* read_tree_block(struct btrfs_fs_info *fs_info, u64 bytenr,
 			 * btrfs ins dump-tree.
 			 */
 			if (btrfs_header_level(eb))
-				ret = btrfs_check_node(fs_info, NULL, eb);
+				ret = btrfs_check_node(NULL, eb);
 			else
-				ret = btrfs_check_leaf(fs_info, NULL, eb);
+				ret = btrfs_check_leaf(NULL, eb);
 			if (!ret || candidate_mirror == mirror_num) {
 				btrfs_set_buffer_uptodate(eb);
 				return eb;
Signature · 1 line
2.39.1
#9 lore raw

PATCH 8/11 btrfs-progs: rename the qgroup structs to match the kernel

In reply to Josef Bacik

Now that the libbtrfs stuff has it's own local copy of ctree.h and ioctl.h, let's rename these qgroup struct members to match the kernel names, this way it'll make it easier to sync the kernel code into btrfs-progs.

---
 check/qgroup-verify.c      | 16 ++++----
 cmds/qgroup.c              | 20 ++++------
 kernel-shared/ctree.h      | 80 +++++++++++++++++++-------------------
 kernel-shared/print-tree.c | 18 ++++-----
 4 files changed, 64 insertions(+), 70 deletions(-)
check/qgroup-verify.c +8 -8
index 3d7b9ddf..db49e3c9 100644
@@ -870,12 +870,12 @@ static struct qgroup_count *alloc_count(struct btrfs_disk_key *key,
 		c->key = *key;
 
 		item = &c->diskinfo;
-		item->referenced = btrfs_qgroup_info_referenced(leaf, disk);
+		item->referenced = btrfs_qgroup_info_rfer(leaf, disk);
 		item->referenced_compressed =
-			btrfs_qgroup_info_referenced_compressed(leaf, disk);
-		item->exclusive = btrfs_qgroup_info_exclusive(leaf, disk);
+			btrfs_qgroup_info_rfer_cmpr(leaf, disk);
+		item->exclusive = btrfs_qgroup_info_excl(leaf, disk);
 		item->exclusive_compressed =
-			btrfs_qgroup_info_exclusive_compressed(leaf, disk);
+			btrfs_qgroup_info_excl_cmpr(leaf, disk);
 		INIT_LIST_HEAD(&c->groups);
 		INIT_LIST_HEAD(&c->members);
 		INIT_LIST_HEAD(&c->bad_list);
@@ -1594,14 +1594,14 @@ static int repair_qgroup_info(struct btrfs_fs_info *info,
 	btrfs_set_qgroup_info_generation(path.nodes[0], info_item,
 					 trans->transid);
 
-	btrfs_set_qgroup_info_referenced(path.nodes[0], info_item,
+	btrfs_set_qgroup_info_rfer(path.nodes[0], info_item,
 					 count->info.referenced);
-	btrfs_set_qgroup_info_referenced_compressed(path.nodes[0], info_item,
+	btrfs_set_qgroup_info_rfer_cmpr(path.nodes[0], info_item,
 					    count->info.referenced_compressed);
 
-	btrfs_set_qgroup_info_exclusive(path.nodes[0], info_item,
+	btrfs_set_qgroup_info_excl(path.nodes[0], info_item,
 					count->info.exclusive);
-	btrfs_set_qgroup_info_exclusive_compressed(path.nodes[0], info_item,
+	btrfs_set_qgroup_info_excl_cmpr(path.nodes[0], info_item,
 					   count->info.exclusive_compressed);
 
 	btrfs_mark_buffer_dirty(path.nodes[0]);
cmds/qgroup.c +8 -12
index 125362b8..ab4e9ecf 100644
@@ -807,12 +807,11 @@ static int update_qgroup_info(int fd, struct qgroup_lookup *qgroup_lookup, u64 q
 		return PTR_ERR(bq);
 
 	bq->info.generation = btrfs_stack_qgroup_info_generation(info);
-	bq->info.referenced = btrfs_stack_qgroup_info_referenced(info);
+	bq->info.referenced = btrfs_stack_qgroup_info_rfer(info);
 	bq->info.referenced_compressed =
-			btrfs_stack_qgroup_info_referenced_compressed(info);
-	bq->info.exclusive = btrfs_stack_qgroup_info_exclusive(info);
-	bq->info.exclusive_compressed =
-			btrfs_stack_qgroup_info_exclusive_compressed(info);
+		btrfs_stack_qgroup_info_rfer_cmpr(info);
+	bq->info.exclusive = btrfs_stack_qgroup_info_excl(info);
+	bq->info.exclusive_compressed = btrfs_stack_qgroup_info_excl_cmpr(info);
 
 	return 0;
 }
@@ -828,13 +827,10 @@ static int update_qgroup_limit(int fd, struct qgroup_lookup *qgroup_lookup,
 		return PTR_ERR(bq);
 
 	bq->limit.flags = btrfs_stack_qgroup_limit_flags(limit);
-	bq->limit.max_referenced =
-			btrfs_stack_qgroup_limit_max_referenced(limit);
-	bq->limit.max_exclusive =
-			btrfs_stack_qgroup_limit_max_exclusive(limit);
-	bq->limit.rsv_referenced =
-			btrfs_stack_qgroup_limit_rsv_referenced(limit);
-	bq->limit.rsv_exclusive = btrfs_stack_qgroup_limit_rsv_exclusive(limit);
+	bq->limit.max_referenced = btrfs_stack_qgroup_limit_max_rfer(limit);
+	bq->limit.max_exclusive = btrfs_stack_qgroup_limit_max_excl(limit);
+	bq->limit.rsv_referenced = btrfs_stack_qgroup_limit_rsv_rfer(limit);
+	bq->limit.rsv_exclusive = btrfs_stack_qgroup_limit_rsv_excl(limit);
 
 	return 0;
 }
kernel-shared/ctree.h +40 -40

108 lines not on this page · raw message

kernel-shared/print-tree.c +8 -10
index 3fb6a37c..37a1f74c 100644
@@ -1089,12 +1089,10 @@ static void print_qgroup_info(struct extent_buffer *eb, int slot)
 		"\t\treferenced %llu referenced_compressed %llu\n"
 		"\t\texclusive %llu exclusive_compressed %llu\n",
 		(unsigned long long)btrfs_qgroup_info_generation(eb, qg_info),
-		(unsigned long long)btrfs_qgroup_info_referenced(eb, qg_info),
-		(unsigned long long)btrfs_qgroup_info_referenced_compressed(eb,
-								       qg_info),
-		(unsigned long long)btrfs_qgroup_info_exclusive(eb, qg_info),
-		(unsigned long long)btrfs_qgroup_info_exclusive_compressed(eb,
-								      qg_info));
+		(unsigned long long)btrfs_qgroup_info_rfer(eb, qg_info),
+		(unsigned long long)btrfs_qgroup_info_rfer_cmpr(eb, qg_info),
+		(unsigned long long)btrfs_qgroup_info_excl(eb, qg_info),
+		(unsigned long long)btrfs_qgroup_info_excl_cmpr(eb, qg_info));
 }
 
 static void print_qgroup_limit(struct extent_buffer *eb, int slot)
@@ -1106,10 +1104,10 @@ static void print_qgroup_limit(struct extent_buffer *eb, int slot)
 		"\t\tmax_referenced %lld max_exclusive %lld\n"
 		"\t\trsv_referenced %lld rsv_exclusive %lld\n",
 		(unsigned long long)btrfs_qgroup_limit_flags(eb, qg_limit),
-		(long long)btrfs_qgroup_limit_max_referenced(eb, qg_limit),
-		(long long)btrfs_qgroup_limit_max_exclusive(eb, qg_limit),
-		(long long)btrfs_qgroup_limit_rsv_referenced(eb, qg_limit),
-		(long long)btrfs_qgroup_limit_rsv_exclusive(eb, qg_limit));
+		(long long)btrfs_qgroup_limit_max_rfer(eb, qg_limit),
+		(long long)btrfs_qgroup_limit_max_excl(eb, qg_limit),
+		(long long)btrfs_qgroup_limit_rsv_rfer(eb, qg_limit),
+		(long long)btrfs_qgroup_limit_rsv_excl(eb, qg_limit));
 }
 
 static void print_persistent_item(struct extent_buffer *eb, void *ptr,
Signature · 1 line
2.39.1
#11 lore raw

PATCH 10/11 btrfs-progs: add a btrfs check helper for checking blocks

In reply to Josef Bacik

btrfs check wants to be able to record corrupted extents if it finds any bad blocks. This has been done directly inside of the btrfs_check_leaf/btrfs_check_node helpers, but these are going to be sync'ed from the kernel in the future. Add another helper and move the corrupt block handling into this helper and keep it inside of the check code.

---
 check/main.c          | 16 +++-------------
 check/mode-lowmem.c   | 11 ++++-------
 check/repair.c        | 29 +++++++++++++++++++++++++++++
 check/repair.h        |  3 ++-
 kernel-shared/ctree.c | 22 ++--------------------
 5 files changed, 40 insertions(+), 41 deletions(-)
check/main.c +3 -13
index 8c3a10a1..467c8a57 100644
@@ -1920,10 +1920,7 @@ static int walk_down_tree(struct btrfs_root *root, struct btrfs_path *path,
 			goto out;
 		}
 
-		if (btrfs_is_leaf(next))
-			status = btrfs_check_leaf(NULL, next);
-		else
-			status = btrfs_check_node(NULL, next);
+		status = btrfs_check_block_for_repair(next, NULL);
 		if (status != BTRFS_TREE_BLOCK_CLEAN) {
 			free_extent_buffer(next);
 			err = -EIO;
@@ -3701,10 +3698,7 @@ static int check_fs_root(struct btrfs_root *root,
 	wc->root_level = level;
 
 	/* We may not have checked the root block, lets do that now */
-	if (btrfs_is_leaf(root->node))
-		status = btrfs_check_leaf(NULL, root->node);
-	else
-		status = btrfs_check_node(NULL, root->node);
+	status = btrfs_check_block_for_repair(root->node, NULL);
 	if (status != BTRFS_TREE_BLOCK_CLEAN)
 		return -EIO;
 
@@ -4607,11 +4601,7 @@ static int check_block(struct btrfs_root *root,
 	}
 	rec->info_level = level;
 
-	if (btrfs_is_leaf(buf))
-		status = btrfs_check_leaf(&rec->parent_key, buf);
-	else
-		status = btrfs_check_node(&rec->parent_key, buf);
-
+	status = btrfs_check_block_for_repair(buf, &rec->parent_key);
 	if (status != BTRFS_TREE_BLOCK_CLEAN) {
 		if (opt_check_repair)
 			status = try_to_fix_bad_block(root, buf, status);
check/mode-lowmem.c +4 -7
index 1672da26..3cf8d97f 100644
@@ -2695,7 +2695,7 @@ static int check_inode_item(struct btrfs_root *root, struct btrfs_path *path)
 		 * we need to bail otherwise we could end up stuck.
 		 */
 		if (path->slots[0] == 0 &&
-		    btrfs_check_leaf(NULL, path->nodes[0]))
+		    btrfs_check_block_for_repair(path->nodes[0], NULL))
 			ret = -EIO;
 
 		if (ret < 0) {
@@ -5001,7 +5001,7 @@ static int walk_down_tree(struct btrfs_root *root, struct btrfs_path *path,
 		if (*level == 0) {
 			/* skip duplicate check */
 			if (check || !check_all) {
-				ret = btrfs_check_leaf(NULL, cur);
+				ret = btrfs_check_block_for_repair(cur, NULL);
 				if (ret != BTRFS_TREE_BLOCK_CLEAN) {
 					err |= -EIO;
 					break;
@@ -5018,7 +5018,7 @@ static int walk_down_tree(struct btrfs_root *root, struct btrfs_path *path,
 			break;
 		}
 		if (check || !check_all) {
-			ret = btrfs_check_node(NULL, cur);
+			ret = btrfs_check_block_for_repair(cur, NULL);
 			if (ret != BTRFS_TREE_BLOCK_CLEAN) {
 				err |= -EIO;
 				break;
@@ -5065,10 +5065,7 @@ static int walk_down_tree(struct btrfs_root *root, struct btrfs_path *path,
 		if (ret < 0)
 			break;
 
-		if (btrfs_is_leaf(next))
-			status = btrfs_check_leaf(NULL, next);
-		else
-			status = btrfs_check_node(NULL, next);
+		status = btrfs_check_block_for_repair(next, NULL);
 		if (status != BTRFS_TREE_BLOCK_CLEAN) {
 			free_extent_buffer(next);
 			err |= -EIO;
check/repair.c +29 -0
index f84df9cf..71b2a277 100644
@@ -299,3 +299,32 @@ out:
 	extent_io_tree_cleanup(&used);
 	return ret;
 }
+
+enum btrfs_tree_block_status btrfs_check_block_for_repair(struct extent_buffer *eb,
+							  struct btrfs_key *first_key)
+{
+	struct btrfs_fs_info *fs_info = eb->fs_info;
+	enum btrfs_tree_block_status status;
+
+	if (btrfs_is_leaf(eb))
+		status = btrfs_check_leaf(first_key, eb);
+	else
+		status = btrfs_check_node(first_key, eb);
+
+	if (status == BTRFS_TREE_BLOCK_CLEAN)
+		return status;
+
+	if (btrfs_header_owner(eb) == BTRFS_EXTENT_TREE_OBJECTID) {
+		struct btrfs_key key;
+
+		if (first_key)
+			memcpy(&key, first_key, sizeof(struct btrfs_key));
+		else
+			btrfs_node_key_to_cpu(eb, &key, 0);
+		btrfs_add_corrupt_extent_record(fs_info, &key,
+						eb->start, eb->len,
+						btrfs_header_level(eb));
+	}
+	return status;
+
+}
check/repair.h +2 -1
index 3e6ffcf6..d4222600 100644
@@ -43,5 +43,6 @@ int btrfs_mark_used_tree_blocks(struct btrfs_fs_info *fs_info,
 				struct extent_io_tree *tree);
 int btrfs_mark_used_blocks(struct btrfs_fs_info *fs_info,
 			   struct extent_io_tree *tree);
-
+enum btrfs_tree_block_status btrfs_check_block_for_repair(struct extent_buffer *eb,
+							  struct btrfs_key *first_key);
 #endif
kernel-shared/ctree.c +2 -20
index fb56a863..c1c2059b 100644
@@ -668,17 +668,8 @@ btrfs_check_node(struct btrfs_key *parent_key, struct extent_buffer *node)
 			goto fail;
 		}
 	}
-	return BTRFS_TREE_BLOCK_CLEAN;
+	ret = BTRFS_TREE_BLOCK_CLEAN;
 fail:
-	if (btrfs_header_owner(node) == BTRFS_EXTENT_TREE_OBJECTID) {
-		if (parent_key)
-			memcpy(&key, parent_key, sizeof(struct btrfs_key));
-		else
-			btrfs_node_key_to_cpu(node, &key, 0);
-		btrfs_add_corrupt_extent_record(fs_info, &key,
-						node->start, node->len,
-						btrfs_header_level(node));
-	}
 	return ret;
 }
 
@@ -782,17 +773,8 @@ btrfs_check_leaf(struct btrfs_key *parent_key, struct extent_buffer *leaf)
 		prev_key.offset = key.offset;
 	}
 
-	return BTRFS_TREE_BLOCK_CLEAN;
+	ret = BTRFS_TREE_BLOCK_CLEAN;
 fail:
-	if (btrfs_header_owner(leaf) == BTRFS_EXTENT_TREE_OBJECTID) {
-		if (parent_key)
-			memcpy(&key, parent_key, sizeof(struct btrfs_key));
-		else
-			btrfs_item_key_to_cpu(leaf, &key, 0);
-
-		btrfs_add_corrupt_extent_record(fs_info, &key,
-						leaf->start, leaf->len, 0);
-	}
 	return ret;
 }
 
Signature · 1 line
2.39.1
#12 lore raw

PATCH 11/11 btrfs-progs: remove parent_key arg from btrfs_check_* helpers

In reply to Josef Bacik

Now that this is unused by these helpers and only used by the repair related code we can remove this argument from the main helpers.

---
 check/repair.c          |  4 ++--
 kernel-shared/ctree.c   | 17 ++++-------------
 kernel-shared/ctree.h   |  6 ++----
 kernel-shared/disk-io.c |  4 ++--
 4 files changed, 10 insertions(+), 21 deletions(-)
check/repair.c +2 -2
index 71b2a277..8c1e2027 100644
@@ -307,9 +307,9 @@ enum btrfs_tree_block_status btrfs_check_block_for_repair(struct extent_buffer *
 	enum btrfs_tree_block_status status;
 
 	if (btrfs_is_leaf(eb))
-		status = btrfs_check_leaf(first_key, eb);
+		status = btrfs_check_leaf(eb);
 	else
-		status = btrfs_check_node(first_key, eb);
+		status = btrfs_check_node(eb);
 
 	if (status == BTRFS_TREE_BLOCK_CLEAN)
 		return status;
kernel-shared/ctree.c +4 -13
index c1c2059b..911ec51c 100644
@@ -611,8 +611,7 @@ static void generic_err(const struct extent_buffer *buf, int slot,
 	fprintf(stderr, "\n");
 }
 
-enum btrfs_tree_block_status
-btrfs_check_node(struct btrfs_key *parent_key, struct extent_buffer *node)
+enum btrfs_tree_block_status btrfs_check_node(struct extent_buffer *node)
 {
 	struct btrfs_fs_info *fs_info = node->fs_info;
 	unsigned long nr = btrfs_header_nritems(node);
@@ -673,8 +672,7 @@ fail:
 	return ret;
 }
 
-enum btrfs_tree_block_status
-btrfs_check_leaf(struct btrfs_key *parent_key, struct extent_buffer *leaf)
+enum btrfs_tree_block_status btrfs_check_leaf(struct extent_buffer *leaf)
 {
 	struct btrfs_fs_info *fs_info = leaf->fs_info;
 	/* No valid key type is 0, so all key should be larger than this key */
@@ -781,21 +779,14 @@ fail:
 static int noinline check_block(struct btrfs_fs_info *fs_info,
 				struct btrfs_path *path, int level)
 {
-	struct btrfs_key key;
-	struct btrfs_key *parent_key_ptr = NULL;
 	enum btrfs_tree_block_status ret;
 
 	if (path->skip_check_block)
 		return 0;
-	if (path->nodes[level + 1]) {
-		btrfs_node_key_to_cpu(path->nodes[level + 1], &key,
-				     path->slots[level + 1]);
-		parent_key_ptr = &key;
-	}
 	if (level == 0)
-		ret = btrfs_check_leaf(parent_key_ptr, path->nodes[0]);
+		ret = btrfs_check_leaf(path->nodes[0]);
 	else
-		ret = btrfs_check_node(parent_key_ptr, path->nodes[level]);
+		ret = btrfs_check_node(path->nodes[level]);
 	if (ret == BTRFS_TREE_BLOCK_CLEAN)
 		return 0;
 	return -EIO;
kernel-shared/ctree.h +2 -4
index 13264387..d81d7c02 100644
@@ -2704,10 +2704,8 @@ int btrfs_convert_one_bg(struct btrfs_trans_handle *trans, u64 bytenr);
 int btrfs_comp_cpu_keys(const struct btrfs_key *k1, const struct btrfs_key *k2);
 int btrfs_del_ptr(struct btrfs_root *root, struct btrfs_path *path,
 		int level, int slot);
-enum btrfs_tree_block_status
-btrfs_check_node(struct btrfs_key *parent_key, struct extent_buffer *buf);
-enum btrfs_tree_block_status
-btrfs_check_leaf(struct btrfs_key *parent_key, struct extent_buffer *buf);
+enum btrfs_tree_block_status btrfs_check_node(struct extent_buffer *buf);
+enum btrfs_tree_block_status btrfs_check_leaf(struct extent_buffer *buf);
 void reada_for_search(struct btrfs_fs_info *fs_info, struct btrfs_path *path,
 		      int level, int slot, u64 objectid);
 struct extent_buffer *read_node_slot(struct btrfs_fs_info *fs_info,
kernel-shared/disk-io.c +2 -2
index b5ad89c2..7d165720 100644
@@ -389,9 +389,9 @@ struct extent_buffer* read_tree_block(struct btrfs_fs_info *fs_info, u64 bytenr,
 			 * btrfs ins dump-tree.
 			 */
 			if (btrfs_header_level(eb))
-				ret = btrfs_check_node(NULL, eb);
+				ret = btrfs_check_node(eb);
 			else
-				ret = btrfs_check_leaf(NULL, eb);
+				ret = btrfs_check_leaf(eb);
 			if (!ret || candidate_mirror == mirror_num) {
 				btrfs_set_buffer_uptodate(eb);
 				return eb;
Signature · 1 line
2.39.1
#7 lore raw

Re: [PATCH 06/11] btrfs-progs: remove the _on() related message helpers

In reply to Josef Bacik

common/messages.h line 59

Quoted 10 lines · Josef Bacik

#define error_on(cond, fmt, ...) \

common/messages.h +1 -5
 	do {								\
-		if ((cond))						\
+		if ((cond)) {						\
 			PRINT_TRACE_ON_ERROR;				\
-		if ((cond))						\
 			PRINT_VERBOSE_ERROR;				\
-		__btrfs_error_on((cond), (fmt), ##__VA_ARGS__);		\
-		if ((cond))						\
-			DO_ABORT_ON_ERROR;				\

The DO_ABORT_ON_ERROR got accidentally dropped, it should be there as it's how 'make D=abort' is implemented.

Quoted 3 lines
common/messages.h +2 -0
+			__btrfs_error((fmt), ##__VA_ARGS__);		\
+		}							\
 	} while (0)
#13 lore raw
In reply to Josef Bacik
Quoted 8 lines · Josef Bacik

Hello,

These a variety of fixes, cleanups, and api changes to make it easier to sync recent kernel changes into btrfs-progs. They're relatively straightforward, and have been run through the tests. Thanks,

Josef

Quoted 12 lines

Josef Bacik (11):
btrfs-progs: fix kerncompat.h include ordering for libbtrfs
btrfs-progs: use $SUDO_HELPER in convert tests for temp files
btrfs-progs: re-add __init to include/kerncompat.h
btrfs-progs: introduce UASSERT() for purely userspace code
btrfs-progs: move BTRFS_DISABLE_BACKTRACE check in print_trace
btrfs-progs: remove the _on() related message helpers
btrfs-progs: consolidate the btrfs message helpers
btrfs-progs: rename the qgroup structs to match the kernel
btrfs-progs: remove fs_info argument from btrfs_check_* helpers
btrfs-progs: add a btrfs check helper for checking blocks
btrfs-progs: remove parent_key arg from btrfs_check_* helpers

Added to devel, with some minor adjustments, thanks.