diff options
author | Kent Overstreet <kent.overstreet@gmail.com> | 2019-03-14 03:49:16 +0300 |
---|---|---|
committer | Kent Overstreet <kent.overstreet@linux.dev> | 2023-10-23 00:08:18 +0300 |
commit | 0564b16782b39d6f59e06f427f32826db69e75a2 (patch) | |
tree | a94a6de3e1ccf5c65c27dcadfb535b3756bfa0a6 /fs/bcachefs/quota.c | |
parent | 94d290e40c255ea854ec1050dbf9a8b60340a749 (diff) | |
download | linux-0564b16782b39d6f59e06f427f32826db69e75a2.tar.xz |
bcachefs: convert bch2_btree_insert_at() usage to bch2_trans_commit()
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
Diffstat (limited to 'fs/bcachefs/quota.c')
-rw-r--r-- | fs/bcachefs/quota.c | 19 |
1 files changed, 12 insertions, 7 deletions
diff --git a/fs/bcachefs/quota.c b/fs/bcachefs/quota.c index 113a2ca88ffc..492ab73c39e7 100644 --- a/fs/bcachefs/quota.c +++ b/fs/bcachefs/quota.c @@ -708,7 +708,8 @@ static int bch2_set_quota(struct super_block *sb, struct kqid qid, struct qc_dqblk *qdq) { struct bch_fs *c = sb->s_fs_info; - struct btree_iter iter; + struct btree_trans trans; + struct btree_iter *iter; struct bkey_s_c k; struct bkey_i_quota new_quota; int ret; @@ -719,9 +720,11 @@ static int bch2_set_quota(struct super_block *sb, struct kqid qid, bkey_quota_init(&new_quota.k_i); new_quota.k.p = POS(qid.type, from_kqid(&init_user_ns, qid)); - bch2_btree_iter_init(&iter, c, BTREE_ID_QUOTAS, new_quota.k.p, - BTREE_ITER_SLOTS|BTREE_ITER_INTENT); - k = bch2_btree_iter_peek_slot(&iter); + bch2_trans_init(&trans, c); + + iter = bch2_trans_get_iter(&trans, BTREE_ID_QUOTAS, new_quota.k.p, + BTREE_ITER_SLOTS|BTREE_ITER_INTENT); + k = bch2_btree_iter_peek_slot(iter); ret = btree_iter_err(k); if (unlikely(ret)) @@ -743,9 +746,11 @@ static int bch2_set_quota(struct super_block *sb, struct kqid qid, if (qdq->d_fieldmask & QC_INO_HARD) new_quota.v.c[Q_INO].hardlimit = cpu_to_le64(qdq->d_ino_hardlimit); - ret = bch2_btree_insert_at(c, NULL, NULL, 0, - BTREE_INSERT_ENTRY(&iter, &new_quota.k_i)); - bch2_btree_iter_unlock(&iter); + bch2_trans_update(&trans, BTREE_INSERT_ENTRY(iter, &new_quota.k_i)); + + ret = bch2_trans_commit(&trans, NULL, NULL, 0); + + bch2_trans_exit(&trans); if (ret) return ret; |