mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2025-01-10 15:10:38 +00:00
bcachefs: Fix pathalogical behaviour with inode sharding by cpu ID
If the transactior restarts on a different CPU, it could end up needing to read in a different btree node, which makes another transaction restart more likely... Signed-off-by: Kent Overstreet <kent.overstreet@gmail.com>
This commit is contained in:
parent
d797ca3d8e
commit
bff796ae65
@ -23,6 +23,7 @@ int bch2_create_trans(struct btree_trans *trans, u64 dir_inum,
|
||||
struct btree_iter *inode_iter = NULL;
|
||||
struct bch_hash_info hash = bch2_hash_info_init(c, new_inode);
|
||||
u64 now = bch2_current_time(c);
|
||||
u64 cpu = raw_smp_processor_id();
|
||||
u64 dir_offset = 0;
|
||||
int ret;
|
||||
|
||||
@ -36,7 +37,7 @@ int bch2_create_trans(struct btree_trans *trans, u64 dir_inum,
|
||||
if (!name)
|
||||
new_inode->bi_flags |= BCH_INODE_UNLINKED;
|
||||
|
||||
inode_iter = bch2_inode_create(trans, new_inode, U32_MAX);
|
||||
inode_iter = bch2_inode_create(trans, new_inode, U32_MAX, cpu);
|
||||
ret = PTR_ERR_OR_ZERO(inode_iter);
|
||||
if (ret)
|
||||
goto err;
|
||||
|
@ -472,7 +472,7 @@ 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;
|
||||
@ -482,8 +482,6 @@ struct btree_iter *bch2_inode_create(struct btree_trans *trans,
|
||||
unsigned bits = (c->opts.inodes_32bit ? 31 : 63);
|
||||
|
||||
if (c->opts.shard_inode_numbers) {
|
||||
u64 cpu = raw_smp_processor_id();
|
||||
|
||||
bits -= c->inode_shard_bits;
|
||||
|
||||
min = (cpu << bits);
|
||||
|
@ -70,7 +70,7 @@ void bch2_inode_init(struct bch_fs *, struct bch_inode_unpacked *,
|
||||
struct bch_inode_unpacked *);
|
||||
|
||||
struct btree_iter *bch2_inode_create(struct btree_trans *,
|
||||
struct bch_inode_unpacked *, u32);
|
||||
struct bch_inode_unpacked *, u32, u64);
|
||||
|
||||
int bch2_inode_rm(struct bch_fs *, u64, bool);
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user