diff options
Diffstat (limited to 'fs')
-rw-r--r-- | fs/bcachefs/inode.c | 27 | ||||
-rw-r--r-- | fs/bcachefs/inode.h | 3 | ||||
-rw-r--r-- | fs/bcachefs/quota.c | 2 |
3 files changed, 29 insertions, 3 deletions
diff --git a/fs/bcachefs/inode.c b/fs/bcachefs/inode.c index 8114b6e4f202..4548de6e97b2 100644 --- a/fs/bcachefs/inode.c +++ b/fs/bcachefs/inode.c @@ -318,7 +318,7 @@ int bch2_inode_unpack(struct bkey_s_c k, return bch2_inode_unpack_slowpath(k, unpacked); } -int bch2_inode_peek(struct btree_trans *trans, +static int bch2_inode_peek_nowarn(struct btree_trans *trans, struct btree_iter *iter, struct bch_inode_unpacked *inode, subvol_inum inum, unsigned flags) @@ -349,7 +349,17 @@ int bch2_inode_peek(struct btree_trans *trans, return 0; err: bch2_trans_iter_exit(trans, iter); - if (!bch2_err_matches(ret, BCH_ERR_transaction_restart)) + return ret; +} + +int bch2_inode_peek(struct btree_trans *trans, + struct btree_iter *iter, + struct bch_inode_unpacked *inode, + subvol_inum inum, unsigned flags) +{ + int ret = bch2_inode_peek_nowarn(trans, iter, inode, inum, flags); + + if (ret && !bch2_err_matches(ret, BCH_ERR_transaction_restart)) bch_err_msg(trans->c, ret, "looking up inum %u:%llu:", inum.subvol, inum.inum); return ret; } @@ -880,6 +890,19 @@ err: return ret; } +int bch2_inode_find_by_inum_nowarn_trans(struct btree_trans *trans, + subvol_inum inum, + struct bch_inode_unpacked *inode) +{ + struct btree_iter iter; + int ret; + + ret = bch2_inode_peek_nowarn(trans, &iter, inode, inum, 0); + if (!ret) + bch2_trans_iter_exit(trans, &iter); + return ret; +} + int bch2_inode_find_by_inum_trans(struct btree_trans *trans, subvol_inum inum, struct bch_inode_unpacked *inode) diff --git a/fs/bcachefs/inode.h b/fs/bcachefs/inode.h index 22b24405649f..a7464e1b6960 100644 --- a/fs/bcachefs/inode.h +++ b/fs/bcachefs/inode.h @@ -118,6 +118,9 @@ int bch2_inode_create(struct btree_trans *, struct btree_iter *, int bch2_inode_rm(struct bch_fs *, subvol_inum); +int bch2_inode_find_by_inum_nowarn_trans(struct btree_trans *, + subvol_inum, + struct bch_inode_unpacked *); int bch2_inode_find_by_inum_trans(struct btree_trans *, subvol_inum, struct bch_inode_unpacked *); int bch2_inode_find_by_inum(struct bch_fs *, subvol_inum, diff --git a/fs/bcachefs/quota.c b/fs/bcachefs/quota.c index ca99772aedc6..60d27f726519 100644 --- a/fs/bcachefs/quota.c +++ b/fs/bcachefs/quota.c @@ -572,7 +572,7 @@ static int bch2_fs_quota_read_inode(struct btree_trans *trans, if (!s_t.master_subvol) goto advance; - ret = bch2_inode_find_by_inum_trans(trans, + ret = bch2_inode_find_by_inum_nowarn_trans(trans, (subvol_inum) { le32_to_cpu(s_t.master_subvol), k.k->p.offset, |