summaryrefslogtreecommitdiff
path: root/libbcachefs/inode.c
diff options
context:
space:
mode:
authorKent Overstreet <kent.overstreet@gmail.com>2021-05-31 15:05:33 -0400
committerKent Overstreet <kent.overstreet@gmail.com>2021-05-31 15:05:33 -0400
commitb61ad35b974038fd1b0396c51a61d84891ae0523 (patch)
tree44a7509361fcafb2da3c4dc923735973da23a7b4 /libbcachefs/inode.c
parent4a2acdaf65c67d87133f93db0a7087f74134099c (diff)
Update bcachefs sources to 3913e0cac3 bcachefs: Journal space calculation fix
Diffstat (limited to 'libbcachefs/inode.c')
-rw-r--r--libbcachefs/inode.c21
1 files changed, 13 insertions, 8 deletions
diff --git a/libbcachefs/inode.c b/libbcachefs/inode.c
index c5892e4..6b43a97 100644
--- a/libbcachefs/inode.c
+++ b/libbcachefs/inode.c
@@ -472,23 +472,28 @@ static inline u32 bkey_generation(struct bkey_s_c k)
struct btree_iter *bch2_inode_create(struct btree_trans *trans,
struct bch_inode_unpacked *inode_u,
- u32 snapshot)
+ u32 snapshot, u64 cpu)
{
struct bch_fs *c = trans->c;
struct btree_iter *iter = NULL;
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) {
+ bits -= c->inode_shard_bits;
- min = (cpu << bits);
- max = (cpu << bits) | ~(ULLONG_MAX << bits);
+ min = (cpu << bits);
+ max = (cpu << bits) | ~(ULLONG_MAX << bits);
- min = max_t(u64, min, BLOCKDEV_INODE_MAX);
- hint = c->unused_inode_hints + cpu;
+ 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);