Commit 112d21fd authored by Kent Overstreet's avatar Kent Overstreet
Browse files

bcachefs: switch to rhashtable for vfs inodes hash



the standard vfs inode hash table suffers from painful lock contention -
this is long overdue

Signed-off-by: default avatarKent Overstreet <kent.overstreet@linux.dev>
parent 88d2ae0e
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -361,7 +361,7 @@ int bch2_set_acl(struct mnt_idmap *idmap,
	bch2_trans_begin(trans);
	acl = _acl;

	ret   = bch2_subvol_is_ro_trans(trans, inode->ei_subvol) ?:
	ret   = bch2_subvol_is_ro_trans(trans, inode->ei_inum.subvol) ?:
		bch2_inode_peek(trans, &inode_iter, &inode_u, inode_inum(inode),
			      BTREE_ITER_intent);
	if (ret)
+1 −0
Original line number Diff line number Diff line
@@ -1023,6 +1023,7 @@ struct bch_fs {
	/* fs.c */
	struct list_head	vfs_inodes_list;
	struct mutex		vfs_inodes_lock;
	struct rhashtable	vfs_inodes_table;

	/* VFS IO PATH - fs-io.c */
	struct bio_set		writepage_bioset;
+1 −1
Original line number Diff line number Diff line
@@ -486,7 +486,7 @@ static void bch2_writepage_io_alloc(struct bch_fs *c,
	op->nr_replicas		= nr_replicas;
	op->res.nr_replicas	= nr_replicas;
	op->write_point		= writepoint_hashed(inode->ei_last_dirtied);
	op->subvol		= inode->ei_subvol;
	op->subvol		= inode->ei_inum.subvol;
	op->pos			= POS(inode->v.i_ino, sector);
	op->end_io		= bch2_writepage_io_done;
	op->devs_need_flush	= &inode->ei_devs_need_flush;
+1 −1
Original line number Diff line number Diff line
@@ -500,7 +500,7 @@ static __always_inline long bch2_dio_write_loop(struct dio_write *dio)
		dio->op.target		= dio->op.opts.foreground_target;
		dio->op.write_point	= writepoint_hashed((unsigned long) current);
		dio->op.nr_replicas	= dio->op.opts.data_replicas;
		dio->op.subvol		= inode->ei_subvol;
		dio->op.subvol		= inode->ei_inum.subvol;
		dio->op.pos		= POS(inode->v.i_ino, (u64) req->ki_pos >> 9);
		dio->op.devs_need_flush	= &inode->ei_devs_need_flush;

+3 −3
Original line number Diff line number Diff line
@@ -267,7 +267,7 @@ static int __bch2_truncate_folio(struct bch_inode_info *inode,
		 * XXX: we're doing two index lookups when we end up reading the
		 * folio
		 */
		ret = range_has_data(c, inode->ei_subvol,
		ret = range_has_data(c, inode->ei_inum.subvol,
				POS(inode->v.i_ino, (index << PAGE_SECTORS_SHIFT)),
				POS(inode->v.i_ino, (index << PAGE_SECTORS_SHIFT) + PAGE_SECTORS));
		if (ret <= 0)
@@ -618,7 +618,7 @@ static noinline int __bchfs_fallocate(struct bch_inode_info *inode, int mode,
		bch2_trans_begin(trans);

		ret = bch2_subvolume_get_snapshot(trans,
					inode->ei_subvol, &snapshot);
					inode->ei_inum.subvol, &snapshot);
		if (ret)
			goto bkey_err;

@@ -823,7 +823,7 @@ static int quota_reserve_range(struct bch_inode_info *inode,
retry:
	bch2_trans_begin(trans);

	ret = bch2_subvolume_get_snapshot(trans, inode->ei_subvol, &snapshot);
	ret = bch2_subvolume_get_snapshot(trans, inode->ei_inum.subvol, &snapshot);
	if (ret)
		goto err;

Loading