Skip to contentSkip to conversation

bcachefs: push cpuid variable down into bch2_inode_create()

PATCH New Brian Foster 1 participant 1 message Jan 25, 2023

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 bcachefs: push cpuid variable down into bch2_inode_create()

From: root <[email protected]>

The cpu id number only appears to be used by inode number sharding, which is isolated to the inode create function. Push it down a function to eliminate an unnecessary parameter.

---

Just a small, random cleanup from roving around the code...

Brian

 fs/bcachefs/fs-common.c | 3 +--
 fs/bcachefs/inode.c     | 3 ++-
 fs/bcachefs/inode.h     | 2 +-
 3 files changed, 4 insertions(+), 4 deletions(-)
fs/bcachefs/fs-common.c +1 -2
index 1f2e1fc4f6b2..abde0b5ea30e 100644
@@ -32,7 +32,6 @@ int bch2_create_trans(struct btree_trans *trans,
 	struct btree_iter inode_iter = { NULL };
 	subvol_inum new_inum = dir;
 	u64 now = bch2_current_time(c);
-	u64 cpu = raw_smp_processor_id();
 	u64 dir_target;
 	u32 snapshot;
 	unsigned dir_type = mode_to_type(mode);
@@ -53,7 +52,7 @@ int bch2_create_trans(struct btree_trans *trans,
 		if (flags & BCH_CREATE_TMPFILE)
 			new_inode->bi_flags |= BCH_INODE_UNLINKED;
 
-		ret = bch2_inode_create(trans, &inode_iter, new_inode, snapshot, cpu);
+		ret = bch2_inode_create(trans, &inode_iter, new_inode, snapshot);
 		if (ret)
 			goto err;
 
fs/bcachefs/inode.c +2 -1
index 560545a7ea03..9b3df4256219 100644
@@ -628,13 +628,14 @@ static inline u32 bkey_generation(struct bkey_s_c k)
 int bch2_inode_create(struct btree_trans *trans,
 		      struct btree_iter *iter,
 		      struct bch_inode_unpacked *inode_u,
-		      u32 snapshot, u64 cpu)
+		      u32 snapshot)
 {
 	struct bch_fs *c = trans->c;
 	struct bkey_s_c k;
 	u64 min, max, start, pos, *hint;
 	int ret = 0;
 	unsigned bits = (c->opts.inodes_32bit ? 31 : 63);
+	u64 cpu = raw_smp_processor_id();
 
 	if (c->opts.shard_inode_numbers) {
 		bits -= c->inode_shard_bits;
fs/bcachefs/inode.h +1 -1
index f5066afb4886..86cb32503a23 100644
@@ -101,7 +101,7 @@ void bch2_inode_init(struct bch_fs *, struct bch_inode_unpacked *,
 		     struct bch_inode_unpacked *);
 
 int bch2_inode_create(struct btree_trans *, struct btree_iter *,
-		      struct bch_inode_unpacked *, u32, u64);
+		      struct bch_inode_unpacked *, u32);
 
 int bch2_inode_rm(struct bch_fs *, subvol_inum);
 
Signature · 1 line
2.39.1