Commit 1a488e73 authored by Kent Overstreet's avatar Kent Overstreet Committed by Kent Overstreet

bcachefs: Kill BTREE_INSERT_NOUNLOCK

With the recent transaction restart changes, it's no longer needed - all
transaction commits have BTREE_INSERT_NOUNLOCK semantics.
Signed-off-by: default avatarKent Overstreet <kent.overstreet@gmail.com>
parent b253a90d
...@@ -336,8 +336,7 @@ int bch2_set_acl(struct mnt_idmap *idmap, ...@@ -336,8 +336,7 @@ int bch2_set_acl(struct mnt_idmap *idmap,
ret = bch2_inode_write(&trans, inode_iter, &inode_u) ?: ret = bch2_inode_write(&trans, inode_iter, &inode_u) ?:
bch2_trans_commit(&trans, NULL, bch2_trans_commit(&trans, NULL,
&inode->ei_journal_seq, &inode->ei_journal_seq, 0);
BTREE_INSERT_NOUNLOCK);
btree_err: btree_err:
bch2_trans_iter_put(&trans, inode_iter); bch2_trans_iter_put(&trans, inode_iter);
......
...@@ -406,7 +406,6 @@ static int btree_key_cache_flush_pos(struct btree_trans *trans, ...@@ -406,7 +406,6 @@ static int btree_key_cache_flush_pos(struct btree_trans *trans,
BTREE_UPDATE_INTERNAL_SNAPSHOT_NODE| BTREE_UPDATE_INTERNAL_SNAPSHOT_NODE|
BTREE_TRIGGER_NORUN) ?: BTREE_TRIGGER_NORUN) ?:
bch2_trans_commit(trans, NULL, NULL, bch2_trans_commit(trans, NULL, NULL,
BTREE_INSERT_NOUNLOCK|
BTREE_INSERT_NOCHECK_RW| BTREE_INSERT_NOCHECK_RW|
BTREE_INSERT_NOFAIL| BTREE_INSERT_NOFAIL|
BTREE_INSERT_USE_RESERVE| BTREE_INSERT_USE_RESERVE|
......
...@@ -15,7 +15,6 @@ bool bch2_btree_bset_insert_key(struct btree_iter *, struct btree *, ...@@ -15,7 +15,6 @@ bool bch2_btree_bset_insert_key(struct btree_iter *, struct btree *,
void bch2_btree_add_journal_pin(struct bch_fs *, struct btree *, u64); void bch2_btree_add_journal_pin(struct bch_fs *, struct btree *, u64);
enum btree_insert_flags { enum btree_insert_flags {
__BTREE_INSERT_NOUNLOCK,
__BTREE_INSERT_NOFAIL, __BTREE_INSERT_NOFAIL,
__BTREE_INSERT_NOCHECK_RW, __BTREE_INSERT_NOCHECK_RW,
__BTREE_INSERT_LAZY_RW, __BTREE_INSERT_LAZY_RW,
...@@ -29,11 +28,6 @@ enum btree_insert_flags { ...@@ -29,11 +28,6 @@ enum btree_insert_flags {
__BCH_HASH_SET_MUST_REPLACE, __BCH_HASH_SET_MUST_REPLACE,
}; };
/*
* Don't drop locks _after_ successfully updating btree:
*/
#define BTREE_INSERT_NOUNLOCK (1 << __BTREE_INSERT_NOUNLOCK)
/* Don't check for -ENOSPC: */ /* Don't check for -ENOSPC: */
#define BTREE_INSERT_NOFAIL (1 << __BTREE_INSERT_NOFAIL) #define BTREE_INSERT_NOFAIL (1 << __BTREE_INSERT_NOFAIL)
......
...@@ -1927,8 +1927,7 @@ static int __bch2_btree_node_update_key(struct btree_trans *trans, ...@@ -1927,8 +1927,7 @@ static int __bch2_btree_node_update_key(struct btree_trans *trans,
BTREE_INSERT_NOFAIL| BTREE_INSERT_NOFAIL|
BTREE_INSERT_NOCHECK_RW| BTREE_INSERT_NOCHECK_RW|
BTREE_INSERT_JOURNAL_RECLAIM| BTREE_INSERT_JOURNAL_RECLAIM|
BTREE_INSERT_JOURNAL_RESERVED| BTREE_INSERT_JOURNAL_RESERVED);
BTREE_INSERT_NOUNLOCK);
if (ret) if (ret)
goto err; goto err;
......
...@@ -524,8 +524,8 @@ static noinline int maybe_do_btree_merge(struct btree_trans *trans, struct btree ...@@ -524,8 +524,8 @@ static noinline int maybe_do_btree_merge(struct btree_trans *trans, struct btree
if (u64s_delta > 0) if (u64s_delta > 0)
return 0; return 0;
return bch2_foreground_maybe_merge(trans, iter, iter->level, return bch2_foreground_maybe_merge(trans, iter,
trans->flags & ~BTREE_INSERT_NOUNLOCK); iter->level, trans->flags);
} }
/* /*
......
...@@ -157,7 +157,6 @@ int __must_check bch2_write_inode(struct bch_fs *c, ...@@ -157,7 +157,6 @@ int __must_check bch2_write_inode(struct bch_fs *c,
bch2_inode_write(&trans, iter, &inode_u) ?: bch2_inode_write(&trans, iter, &inode_u) ?:
bch2_trans_commit(&trans, NULL, bch2_trans_commit(&trans, NULL,
&inode->ei_journal_seq, &inode->ei_journal_seq,
BTREE_INSERT_NOUNLOCK|
BTREE_INSERT_NOFAIL); BTREE_INSERT_NOFAIL);
/* /*
...@@ -295,8 +294,7 @@ __bch2_create(struct mnt_idmap *idmap, ...@@ -295,8 +294,7 @@ __bch2_create(struct mnt_idmap *idmap,
if (unlikely(ret)) if (unlikely(ret))
goto err_before_quota; goto err_before_quota;
ret = bch2_trans_commit(&trans, NULL, &journal_seq, ret = bch2_trans_commit(&trans, NULL, &journal_seq, 0);
BTREE_INSERT_NOUNLOCK);
if (unlikely(ret)) { if (unlikely(ret)) {
bch2_quota_acct(c, bch_qid(&inode_u), Q_INO, -1, bch2_quota_acct(c, bch_qid(&inode_u), Q_INO, -1,
KEY_TYPE_QUOTA_WARN); KEY_TYPE_QUOTA_WARN);
...@@ -417,8 +415,7 @@ static int __bch2_link(struct bch_fs *c, ...@@ -417,8 +415,7 @@ static int __bch2_link(struct bch_fs *c,
mutex_lock(&inode->ei_update_lock); mutex_lock(&inode->ei_update_lock);
bch2_trans_init(&trans, c, 4, 1024); bch2_trans_init(&trans, c, 4, 1024);
ret = __bch2_trans_do(&trans, NULL, &inode->ei_journal_seq, ret = __bch2_trans_do(&trans, NULL, &inode->ei_journal_seq, 0,
BTREE_INSERT_NOUNLOCK,
bch2_link_trans(&trans, bch2_link_trans(&trans,
dir->v.i_ino, dir->v.i_ino,
inode->v.i_ino, &dir_u, &inode_u, inode->v.i_ino, &dir_u, &inode_u,
...@@ -470,7 +467,6 @@ static int bch2_unlink(struct inode *vdir, struct dentry *dentry) ...@@ -470,7 +467,6 @@ static int bch2_unlink(struct inode *vdir, struct dentry *dentry)
bch2_trans_init(&trans, c, 4, 1024); bch2_trans_init(&trans, c, 4, 1024);
ret = __bch2_trans_do(&trans, NULL, &dir->ei_journal_seq, ret = __bch2_trans_do(&trans, NULL, &dir->ei_journal_seq,
BTREE_INSERT_NOUNLOCK|
BTREE_INSERT_NOFAIL, BTREE_INSERT_NOFAIL,
bch2_unlink_trans(&trans, bch2_unlink_trans(&trans,
dir->v.i_ino, &dir_u, dir->v.i_ino, &dir_u,
...@@ -591,8 +587,7 @@ static int bch2_rename2(struct mnt_idmap *idmap, ...@@ -591,8 +587,7 @@ static int bch2_rename2(struct mnt_idmap *idmap,
goto err; goto err;
} }
ret = __bch2_trans_do(&trans, NULL, &journal_seq, ret = __bch2_trans_do(&trans, NULL, &journal_seq, 0,
BTREE_INSERT_NOUNLOCK,
bch2_rename_trans(&trans, bch2_rename_trans(&trans,
src_dir->v.i_ino, &src_dir_u, src_dir->v.i_ino, &src_dir_u,
dst_dir->v.i_ino, &dst_dir_u, dst_dir->v.i_ino, &dst_dir_u,
...@@ -735,7 +730,6 @@ int bch2_setattr_nonsize(struct mnt_idmap *idmap, ...@@ -735,7 +730,6 @@ int bch2_setattr_nonsize(struct mnt_idmap *idmap,
ret = bch2_inode_write(&trans, inode_iter, &inode_u) ?: ret = bch2_inode_write(&trans, inode_iter, &inode_u) ?:
bch2_trans_commit(&trans, NULL, bch2_trans_commit(&trans, NULL,
&inode->ei_journal_seq, &inode->ei_journal_seq,
BTREE_INSERT_NOUNLOCK|
BTREE_INSERT_NOFAIL); BTREE_INSERT_NOFAIL);
btree_err: btree_err:
bch2_trans_iter_put(&trans, inode_iter); bch2_trans_iter_put(&trans, inode_iter);
......
...@@ -803,8 +803,7 @@ static int check_dirent(struct btree_trans *trans, struct btree_iter *iter, ...@@ -803,8 +803,7 @@ static int check_dirent(struct btree_trans *trans, struct btree_iter *iter,
ret = __write_inode(trans, &target, target_snapshot) ?: ret = __write_inode(trans, &target, target_snapshot) ?:
bch2_trans_commit(trans, NULL, NULL, bch2_trans_commit(trans, NULL, NULL,
BTREE_INSERT_NOFAIL| BTREE_INSERT_NOFAIL|
BTREE_INSERT_LAZY_RW| BTREE_INSERT_LAZY_RW);
BTREE_INSERT_NOUNLOCK);
if (ret) if (ret)
return ret; return ret;
return -EINTR; return -EINTR;
......
...@@ -760,7 +760,7 @@ static int bch2_set_quota(struct super_block *sb, struct kqid qid, ...@@ -760,7 +760,7 @@ static int bch2_set_quota(struct super_block *sb, struct kqid qid,
bkey_quota_init(&new_quota.k_i); bkey_quota_init(&new_quota.k_i);
new_quota.k.p = POS(qid.type, from_kqid(&init_user_ns, qid)); new_quota.k.p = POS(qid.type, from_kqid(&init_user_ns, qid));
ret = bch2_trans_do(c, NULL, NULL, BTREE_INSERT_NOUNLOCK, ret = bch2_trans_do(c, NULL, NULL, 0,
bch2_set_quota_trans(&trans, &new_quota, qdq)) ?: bch2_set_quota_trans(&trans, &new_quota, qdq)) ?:
__bch2_quota_set(c, bkey_i_to_s_c(&new_quota.k_i)); __bch2_quota_set(c, bkey_i_to_s_c(&new_quota.k_i));
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment