All of lore.kernel.org
 help / color / mirror / Atom feed
From: Josef Bacik <josef@toxicpanda.com>
To: linux-btrfs@vger.kernel.org, kernel-team@fb.com
Subject: [PATCH v3 07/29] btrfs-progs: make btrfs_qgroup_level helper match the kernel
Date: Wed, 23 Nov 2022 17:37:15 -0500	[thread overview]
Message-ID: <976e6937a7bf48d19ecc5788a28955fdab0366f5.1669242804.git.josef@toxicpanda.com> (raw)
In-Reply-To: <cover.1669242804.git.josef@toxicpanda.com>

We return __u16 in the kernel, as this is actually the size of
btrfs_qgroup_level.  Adjust the existing helpers and update all the
callers to deal with the new size appropriately.  This will make syncing
the kernel code cleaner.

Signed-off-by: Josef Bacik <josef@toxicpanda.com>
---
 check/qgroup-verify.c      |  6 +++---
 cmds/qgroup.c              | 16 ++++++++--------
 kernel-shared/ctree.h      |  2 +-
 kernel-shared/print-tree.c |  4 ++--
 libbtrfs/ctree.h           |  2 +-
 libbtrfsutil/btrfs_tree.h  |  2 +-
 6 files changed, 16 insertions(+), 16 deletions(-)

diff --git a/check/qgroup-verify.c b/check/qgroup-verify.c
index 906fabcb..d79f947f 100644
--- a/check/qgroup-verify.c
+++ b/check/qgroup-verify.c
@@ -1290,7 +1290,7 @@ static int report_qgroup_difference(struct qgroup_count *count, int verbose)
 	is_different = excl_diff || ref_diff;
 
 	if (verbose || (is_different && qgroup_printable(count))) {
-		printf("Counts for qgroup id: %llu/%llu %s\n",
+		printf("Counts for qgroup id: %u/%llu %s\n",
 		       btrfs_qgroup_level(count->qgroupid),
 		       btrfs_qgroup_subvid(count->qgroupid),
 		       is_different ? "are different" : "");
@@ -1564,7 +1564,7 @@ static int repair_qgroup_info(struct btrfs_fs_info *info,
 	struct btrfs_key key;
 
 	if (!silent)
-		printf("Repair qgroup %llu/%llu\n",
+		printf("Repair qgroup %u/%llu\n",
 			btrfs_qgroup_level(count->qgroupid),
 			btrfs_qgroup_subvid(count->qgroupid));
 
@@ -1578,7 +1578,7 @@ static int repair_qgroup_info(struct btrfs_fs_info *info,
 	key.offset = count->qgroupid;
 	ret = btrfs_search_slot(trans, root, &key, &path, 0, 1);
 	if (ret) {
-		error("could not find disk item for qgroup %llu/%llu",
+		error("could not find disk item for qgroup %u/%llu",
 		      btrfs_qgroup_level(count->qgroupid),
 		      btrfs_qgroup_subvid(count->qgroupid));
 		if (ret > 0)
diff --git a/cmds/qgroup.c b/cmds/qgroup.c
index 1d794427..c6c15da5 100644
--- a/cmds/qgroup.c
+++ b/cmds/qgroup.c
@@ -233,7 +233,7 @@ static int print_parent_column(struct btrfs_qgroup *qgroup)
 	int len = 0;
 
 	list_for_each_entry(list, &qgroup->qgroups, next_qgroup) {
-		len += printf("%llu/%llu",
+		len += printf("%u/%llu",
 			      btrfs_qgroup_level(list->qgroup->qgroupid),
 			      btrfs_qgroup_subvid(list->qgroup->qgroupid));
 		if (!list_is_last(&list->next_qgroup, &qgroup->qgroups))
@@ -251,7 +251,7 @@ static int print_child_column(struct btrfs_qgroup *qgroup)
 	int len = 0;
 
 	list_for_each_entry(list, &qgroup->members, next_member) {
-		len += printf("%llu/%llu",
+		len += printf("%u/%llu",
 			      btrfs_qgroup_level(list->member->qgroupid),
 			      btrfs_qgroup_subvid(list->member->qgroupid));
 		if (!list_is_last(&list->next_member, &qgroup->members))
@@ -288,7 +288,7 @@ static void print_qgroup_column(struct btrfs_qgroup *qgroup,
 	switch (column) {
 
 	case BTRFS_QGROUP_QGROUPID:
-		len = printf("%llu/%llu",
+		len = printf("%u/%llu",
 			     btrfs_qgroup_level(qgroup->qgroupid),
 			     btrfs_qgroup_subvid(qgroup->qgroupid));
 		print_qgroup_column_add_blank(BTRFS_QGROUP_QGROUPID, len);
@@ -732,7 +732,7 @@ static int update_qgroup_relation(struct qgroup_lookup *qgroup_lookup,
 
 	child = qgroup_tree_search(qgroup_lookup, child_id);
 	if (!child) {
-		error("cannot find the qgroup %llu/%llu",
+		error("cannot find the qgroup %u/%llu",
 		      btrfs_qgroup_level(child_id),
 		      btrfs_qgroup_subvid(child_id));
 		return -ENOENT;
@@ -740,7 +740,7 @@ static int update_qgroup_relation(struct qgroup_lookup *qgroup_lookup,
 
 	parent = qgroup_tree_search(qgroup_lookup, parent_id);
 	if (!parent) {
-		error("cannot find the qgroup %llu/%llu",
+		error("cannot find the qgroup %u/%llu",
 		      btrfs_qgroup_level(parent_id),
 		      btrfs_qgroup_subvid(parent_id));
 		return -ENOENT;
@@ -1001,7 +1001,7 @@ static void __update_columns_max_len(struct btrfs_qgroup *bq,
 	switch (column) {
 
 	case BTRFS_QGROUP_QGROUPID:
-		sprintf(tmp, "%llu/%llu",
+		sprintf(tmp, "%u/%llu",
 			btrfs_qgroup_level(bq->qgroupid),
 			btrfs_qgroup_subvid(bq->qgroupid));
 		len = strlen(tmp);
@@ -1033,7 +1033,7 @@ static void __update_columns_max_len(struct btrfs_qgroup *bq,
 	case BTRFS_QGROUP_PARENT:
 		len = 0;
 		list_for_each_entry(list, &bq->qgroups, next_qgroup) {
-			len += sprintf(tmp, "%llu/%llu",
+			len += sprintf(tmp, "%u/%llu",
 				btrfs_qgroup_level(list->qgroup->qgroupid),
 				btrfs_qgroup_subvid(list->qgroup->qgroupid));
 			if (!list_is_last(&list->next_qgroup, &bq->qgroups))
@@ -1045,7 +1045,7 @@ static void __update_columns_max_len(struct btrfs_qgroup *bq,
 	case BTRFS_QGROUP_CHILD:
 		len = 0;
 		list_for_each_entry(list, &bq->members, next_member) {
-			len += sprintf(tmp, "%llu/%llu",
+			len += sprintf(tmp, "%u/%llu",
 				btrfs_qgroup_level(list->member->qgroupid),
 				btrfs_qgroup_subvid(list->member->qgroupid));
 			if (!list_is_last(&list->next_member, &bq->members))
diff --git a/kernel-shared/ctree.h b/kernel-shared/ctree.h
index 4ade901a..61eaab55 100644
--- a/kernel-shared/ctree.h
+++ b/kernel-shared/ctree.h
@@ -1071,7 +1071,7 @@ enum btrfs_raid_types {
 
 #define BTRFS_QGROUP_LEVEL_SHIFT		48
 
-static inline u64 btrfs_qgroup_level(u64 qgroupid)
+static inline __u16 btrfs_qgroup_level(u64 qgroupid)
 {
 	return qgroupid >> BTRFS_QGROUP_LEVEL_SHIFT;
 }
diff --git a/kernel-shared/print-tree.c b/kernel-shared/print-tree.c
index 2cf1b283..e08c72df 100644
--- a/kernel-shared/print-tree.c
+++ b/kernel-shared/print-tree.c
@@ -706,7 +706,7 @@ void print_objectid(FILE *stream, u64 objectid, u8 type)
 		fprintf(stream, "%llu", (unsigned long long)objectid);
 		return;
 	case BTRFS_QGROUP_RELATION_KEY:
-		fprintf(stream, "%llu/%llu", btrfs_qgroup_level(objectid),
+		fprintf(stream, "%u/%llu", btrfs_qgroup_level(objectid),
 		       btrfs_qgroup_subvid(objectid));
 		return;
 	case BTRFS_UUID_KEY_SUBVOL:
@@ -815,7 +815,7 @@ void btrfs_print_key(struct btrfs_disk_key *disk_key)
 	case BTRFS_QGROUP_RELATION_KEY:
 	case BTRFS_QGROUP_INFO_KEY:
 	case BTRFS_QGROUP_LIMIT_KEY:
-		printf(" %llu/%llu)", btrfs_qgroup_level(offset),
+		printf(" %u/%llu)", btrfs_qgroup_level(offset),
 		       btrfs_qgroup_subvid(offset));
 		break;
 	case BTRFS_UUID_KEY_SUBVOL:
diff --git a/libbtrfs/ctree.h b/libbtrfs/ctree.h
index 69903f67..ed774ffa 100644
--- a/libbtrfs/ctree.h
+++ b/libbtrfs/ctree.h
@@ -1104,7 +1104,7 @@ enum btrfs_raid_types {
 
 #define BTRFS_QGROUP_LEVEL_SHIFT		48
 
-static inline u64 btrfs_qgroup_level(u64 qgroupid)
+static inline __u16 btrfs_qgroup_level(u64 qgroupid)
 {
 	return qgroupid >> BTRFS_QGROUP_LEVEL_SHIFT;
 }
diff --git a/libbtrfsutil/btrfs_tree.h b/libbtrfsutil/btrfs_tree.h
index 1df9efd6..5e1609e0 100644
--- a/libbtrfsutil/btrfs_tree.h
+++ b/libbtrfsutil/btrfs_tree.h
@@ -908,7 +908,7 @@ struct btrfs_free_space_info {
 #define BTRFS_FREE_SPACE_USING_BITMAPS (1ULL << 0)
 
 #define BTRFS_QGROUP_LEVEL_SHIFT		48
-static __inline__ __u64 btrfs_qgroup_level(__u64 qgroupid)
+static __inline__ __u16 btrfs_qgroup_level(__u64 qgroupid)
 {
 	return qgroupid >> BTRFS_QGROUP_LEVEL_SHIFT;
 }
-- 
2.26.3


  parent reply	other threads:[~2022-11-23 22:38 UTC|newest]

Thread overview: 40+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-11-23 22:37 [PATCH v3 00/29] prep and initial sync of kernel code Josef Bacik
2022-11-23 22:37 ` [PATCH v3 01/29] btrfs-progs: turn on more compiler warnings and use -Wall Josef Bacik
2022-11-24 20:59   ` David Sterba
2022-11-28 16:05     ` Josef Bacik
2022-11-23 22:37 ` [PATCH v3 02/29] btrfs-progs: fix make clean to clean convert properly Josef Bacik
2022-11-28  5:32   ` Anand Jain
2022-11-23 22:37 ` [PATCH v3 03/29] btrfs-progs: properly test for send_stream_version Josef Bacik
2022-11-28  7:34   ` Anand Jain
2022-11-28 17:19     ` David Sterba
2022-11-23 22:37 ` [PATCH v3 04/29] btrfs-progs: use -std=gnu11 Josef Bacik
2022-11-28  8:19   ` Anand Jain
2022-11-28 16:09     ` Josef Bacik
2022-11-28 17:53     ` David Sterba
2022-11-23 22:37 ` [PATCH v3 05/29] btrfs-progs: move btrfs_err_str into common/utils.h Josef Bacik
2022-11-28  8:56   ` Anand Jain
2022-11-23 22:37 ` [PATCH v3 06/29] btrfs-progs: rename qgroup items to match the kernel naming scheme Josef Bacik
2022-11-23 22:37 ` Josef Bacik [this message]
2022-11-23 22:37 ` [PATCH v3 08/29] btrfs-progs: move NO_RESULT definition into replace.c Josef Bacik
2022-11-23 22:37 ` [PATCH v3 09/29] btrfs-progs: rename BLOCK_* to IMAGE_BLOCK_* for metadump Josef Bacik
2022-11-23 22:37 ` [PATCH v3 10/29] btrfs-progs: rename btrfs_item_end to btrfs_item_data_end Josef Bacik
2022-11-23 22:37 ` [PATCH v3 11/29] btrfs-progs: copy ioctl.h into libbtrfs Josef Bacik
2022-11-23 22:37 ` [PATCH v3 12/29] btrfs-progs: sync uapi/btrfs.h into btrfs-progs Josef Bacik
2022-11-25  0:07   ` David Sterba
2022-11-23 22:37 ` [PATCH v3 13/29] btrfs-progs: stop using btrfs_root_item_v0 Josef Bacik
2022-11-23 22:37 ` [PATCH v3 14/29] btrfs-progs: make the find extent buffer helpers take fs_info Josef Bacik
2022-11-23 22:37 ` [PATCH v3 15/29] btrfs-progs: move dirty eb tracking to it's own io_tree Josef Bacik
2022-11-23 22:37 ` [PATCH v3 16/29] btrfs-progs: do not pass io_tree into verify_parent_transid Josef Bacik
2022-11-23 22:37 ` [PATCH v3 17/29] btrfs-progs: move extent cache code directly into btrfs_fs_info Josef Bacik
2022-11-23 22:37 ` [PATCH v3 18/29] btrfs-progs: delete state_private code Josef Bacik
2022-11-23 22:37 ` [PATCH v3 19/29] btrfs-progs: rename extent buffer flags to EXTENT_BUFFER_* Josef Bacik
2022-11-23 22:37 ` [PATCH v3 20/29] btrfs-progs: sync ondisk definitions from the kernel Josef Bacik
2022-11-23 22:37 ` [PATCH v3 21/29] btrfs-progs: sync compression.h " Josef Bacik
2022-11-23 22:37 ` [PATCH v3 22/29] btrfs-progs: sync messages.* " Josef Bacik
2022-11-23 22:37 ` [PATCH v3 23/29] btrfs-progs: replace btrfs_leaf_data with btrfs_item_nr_offset Josef Bacik
2022-11-23 22:37 ` [PATCH v3 24/29] btrfs-progs: don't use btrfs_header_csum helper Josef Bacik
2022-11-23 22:37 ` [PATCH v3 25/29] btrfs-progs: make write_extent_buffer take a const eb Josef Bacik
2022-11-23 22:37 ` [PATCH v3 26/29] btrfs-progs: sync accessors.[ch] from the kernel Josef Bacik
2022-11-23 22:37 ` [PATCH v3 27/29] btrfs-progs: sync file-item.h into progs Josef Bacik
2022-11-23 22:37 ` [PATCH v3 28/29] btrfs-progs: sync async-thread.[ch] from the kernel Josef Bacik
2022-11-23 22:37 ` [PATCH v3 29/29] btrfs-progs: sync extent-io-tree.[ch] and misc.h " Josef Bacik

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=976e6937a7bf48d19ecc5788a28955fdab0366f5.1669242804.git.josef@toxicpanda.com \
    --to=josef@toxicpanda.com \
    --cc=kernel-team@fb.com \
    --cc=linux-btrfs@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.