summaryrefslogtreecommitdiff
path: root/fs/bcachefs/inode.c
diff options
context:
space:
mode:
Diffstat (limited to 'fs/bcachefs/inode.c')
-rw-r--r--fs/bcachefs/inode.c21
1 files changed, 14 insertions, 7 deletions
diff --git a/fs/bcachefs/inode.c b/fs/bcachefs/inode.c
index c5892e42aaec..463d647b359e 100644
--- a/fs/bcachefs/inode.c
+++ b/fs/bcachefs/inode.c
@@ -479,16 +479,23 @@ struct btree_iter *bch2_inode_create(struct btree_trans *trans,
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();
- unsigned bits = (c->opts.inodes_32bit
- ? 31 : 63) - c->inode_shard_bits;
+ if (c->opts.shard_inode_numbers) {
+ u64 cpu = raw_smp_processor_id();
- min = (cpu << bits);
- max = (cpu << bits) | ~(ULLONG_MAX << bits);
+ bits -= c->inode_shard_bits;
- min = max_t(u64, min, BLOCKDEV_INODE_MAX);
- hint = c->unused_inode_hints + cpu;
+ min = (cpu << bits);
+ max = (cpu << bits) | ~(ULLONG_MAX << bits);
+
+ min = max_t(u64, min, BLOCKDEV_INODE_MAX);
+ hint = c->unused_inode_hints + cpu;
+ } else {
+ min = BLOCKDEV_INODE_MAX;
+ max = ~(ULLONG_MAX << bits);
+ hint = c->unused_inode_hints;
+ }
start = READ_ONCE(*hint);