linux-bcachefs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Nikita Ofitserov via B4 Relay <devnull+himikof.gmail.com@kernel.org>
To: Kent Overstreet <kent.overstreet@linux.dev>
Cc: linux-bcachefs@vger.kernel.org, Nikita Ofitserov <himikof@gmail.com>
Subject: [PATCH 06/12] bcachefs: Refactor/rename btree_type_has_ptrs
Date: Wed, 27 Aug 2025 01:49:12 +0300	[thread overview]
Message-ID: <20250827-better-progress-v1-6-74c24de7988a@gmail.com> (raw)
In-Reply-To: <20250827-better-progress-v1-0-74c24de7988a@gmail.com>

From: Nikita Ofitserov <himikof@gmail.com>

The new name (btree_type_has_data_ptrs) better reflects the meaning.
Also introduce the explicit mask constant.

Signed-off-by: Nikita Ofitserov <himikof@gmail.com>
---
 fs/bcachefs/backpointers.c | 2 +-
 fs/bcachefs/btree_gc.c     | 2 +-
 fs/bcachefs/btree_types.h  | 8 ++++----
 fs/bcachefs/migrate.c      | 2 +-
 fs/bcachefs/move.c         | 2 +-
 5 files changed, 8 insertions(+), 8 deletions(-)

diff --git a/fs/bcachefs/backpointers.c b/fs/bcachefs/backpointers.c
index cb25cddb759b84bed48c653605ba195218f2140c..0d585e5662be3f02580558e9a590075ea73193d5 100644
--- a/fs/bcachefs/backpointers.c
+++ b/fs/bcachefs/backpointers.c
@@ -809,7 +809,7 @@ static int bch2_check_extents_to_backpointers_pass(struct btree_trans *trans,
 	for (enum btree_id btree_id = 0;
 	     btree_id < btree_id_nr_alive(c);
 	     btree_id++) {
-		int level, depth = btree_type_has_ptrs(btree_id) ? 0 : 1;
+		int level, depth = btree_type_has_data_ptrs(btree_id) ? 0 : 1;
 
 		ret = commit_do(trans, NULL, NULL,
 				BCH_TRANS_COMMIT_no_enospc,
diff --git a/fs/bcachefs/btree_gc.c b/fs/bcachefs/btree_gc.c
index 2b1b6b7ffdf0af7ec0bf4cbaf68cc9a53a20cfce..006bdd5c90bc805219d4e38923135986425ccf17 100644
--- a/fs/bcachefs/btree_gc.c
+++ b/fs/bcachefs/btree_gc.c
@@ -1228,7 +1228,7 @@ int bch2_gc_gens(struct bch_fs *c)
 	}
 
 	for (unsigned i = 0; i < BTREE_ID_NR; i++)
-		if (btree_type_has_ptrs(i)) {
+		if (btree_type_has_data_ptrs(i)) {
 			c->gc_gens_btree = i;
 			c->gc_gens_pos = POS_MIN;
 
diff --git a/fs/bcachefs/btree_types.h b/fs/bcachefs/btree_types.h
index ad9bd18fe9b6e51987da74d373830dca98df56ec..d06991c16d5c24c586e9449efa9553e2b8593bd4 100644
--- a/fs/bcachefs/btree_types.h
+++ b/fs/bcachefs/btree_types.h
@@ -886,15 +886,15 @@ static inline bool btree_type_has_snapshot_field(enum btree_id btree)
 	return BIT_ULL(btree) & mask;
 }
 
-static inline bool btree_type_has_ptrs(enum btree_id btree)
-{
-	const u64 mask = 0
+static const u64 btree_has_data_ptrs_mask = 0
 #define x(name, nr, flags, ...)	|((!!((flags) & BTREE_IS_data)) << nr)
 	BCH_BTREE_IDS()
 #undef x
 	;
 
-	return BIT_ULL(btree) & mask;
+static inline bool btree_type_has_data_ptrs(enum btree_id btree)
+{
+	return BIT_ULL(btree) & btree_has_data_ptrs_mask;
 }
 
 static inline bool btree_type_uses_write_buffer(enum btree_id btree)
diff --git a/fs/bcachefs/migrate.c b/fs/bcachefs/migrate.c
index 892990b4a6a6b16785e5030e5dc7cf15b05c0fc5..41657deb0e3807f4968272491faea09d05ec2299 100644
--- a/fs/bcachefs/migrate.c
+++ b/fs/bcachefs/migrate.c
@@ -122,7 +122,7 @@ static int bch2_dev_usrdata_drop(struct bch_fs *c,
 	CLASS(btree_trans, trans)(c);
 
 	for (unsigned id = 0; id < BTREE_ID_NR; id++) {
-		if (!btree_type_has_ptrs(id))
+		if (!btree_type_has_data_ptrs(id))
 			continue;
 
 		/* Stripe keys have pointers, but are handled separately */
diff --git a/fs/bcachefs/move.c b/fs/bcachefs/move.c
index 62aeb54ef11b33814f2d06e5ec2787b656a67c30..c30e74a3f89450b08b3a8b89a863752611482c69 100644
--- a/fs/bcachefs/move.c
+++ b/fs/bcachefs/move.c
@@ -671,7 +671,7 @@ static int bch2_move_data(struct bch_fs *c,
 		unsigned min_depth_this_btree = min_depth;
 
 		/* Stripe keys have pointers, but are handled separately */
-		if (!btree_type_has_ptrs(id) ||
+		if (!btree_type_has_data_ptrs(id) ||
 		    id == BTREE_ID_stripes)
 			min_depth_this_btree = max(min_depth_this_btree, 1);
 

-- 
2.50.1



  parent reply	other threads:[~2025-08-26 22:50 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-08-26 22:49 [PATCH 00/12] Accounting for accurate progress reporting Nikita Ofitserov via B4 Relay
2025-08-26 22:49 ` [PATCH 01/12] bcachefs: Relax restrictions on the number of accounting counters Nikita Ofitserov via B4 Relay
2025-08-26 22:49 ` [PATCH 02/12] bcachefs: Introduce btree node number accounting Nikita Ofitserov via B4 Relay
2025-08-26 22:49 ` [PATCH 03/12] bcachefs: Use explicit node counts in progress reporting Nikita Ofitserov via B4 Relay
2025-08-26 22:49 ` [PATCH 04/12] bcachefs: Introduce btree_leaf_has_triggers_mask Nikita Ofitserov via B4 Relay
2025-08-26 22:49 ` [PATCH 05/12] bcachefs: Better progress reporting for btree iteration without leaves Nikita Ofitserov via B4 Relay
2025-08-26 22:49 ` Nikita Ofitserov via B4 Relay [this message]
2025-08-26 22:49 ` [PATCH 07/12] bcachefs: More accurate progress reporting for inner node iteration Nikita Ofitserov via B4 Relay
2025-08-26 22:49 ` [PATCH 08/12] bcachefs: Fix progress reporting for unknown btrees Nikita Ofitserov via B4 Relay
2025-08-26 22:49 ` [PATCH 09/12] bcachefs: Partially fix old device removal with " Nikita Ofitserov via B4 Relay
2025-08-26 22:49 ` [PATCH 10/12] bcachefs: Improve check_allocations pass speed not in fsck Nikita Ofitserov via B4 Relay
2025-08-26 22:49 ` [PATCH 11/12] bcachefs: Fix missing c->usage updates from early recovery Nikita Ofitserov via B4 Relay
2025-08-26 22:49 ` [PATCH 12/12] bcachefs: Fix online hidden (sb+journal) data accounting Nikita Ofitserov via B4 Relay
2025-08-27 17:17 ` [PATCH 00/12] Accounting for accurate progress reporting Kent Overstreet

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=20250827-better-progress-v1-6-74c24de7988a@gmail.com \
    --to=devnull+himikof.gmail.com@kernel.org \
    --cc=himikof@gmail.com \
    --cc=kent.overstreet@linux.dev \
    --cc=linux-bcachefs@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).