diff options
author | Kent Overstreet <kent.overstreet@gmail.com> | 2022-04-03 17:50:01 -0400 |
---|---|---|
committer | Kent Overstreet <kent.overstreet@linux.dev> | 2023-10-22 17:09:30 -0400 |
commit | f0ac7df23d04f3c6d4cd82899aad7f06f6a0b1d4 (patch) | |
tree | e11cada7a81e2d1daab091b4552a498055bdce31 /fs/bcachefs/quota.c | |
parent | d1d7737fd9df0cc57cd276b0189faf8c92c1426f (diff) | |
download | linux-stable-f0ac7df23d04f3c6d4cd82899aad7f06f6a0b1d4.tar.gz linux-stable-f0ac7df23d04f3c6d4cd82899aad7f06f6a0b1d4.tar.bz2 linux-stable-f0ac7df23d04f3c6d4cd82899aad7f06f6a0b1d4.zip |
bcachefs: Convert .key_invalid methods to printbufs
Signed-off-by: Kent Overstreet <kent.overstreet@gmail.com>
Diffstat (limited to 'fs/bcachefs/quota.c')
-rw-r--r-- | fs/bcachefs/quota.c | 19 |
1 files changed, 13 insertions, 6 deletions
diff --git a/fs/bcachefs/quota.c b/fs/bcachefs/quota.c index ca029a00e7b8..5f370da2f3d2 100644 --- a/fs/bcachefs/quota.c +++ b/fs/bcachefs/quota.c @@ -57,15 +57,22 @@ const struct bch_sb_field_ops bch_sb_field_ops_quota = { .to_text = bch2_sb_quota_to_text, }; -const char *bch2_quota_invalid(const struct bch_fs *c, struct bkey_s_c k) +int bch2_quota_invalid(const struct bch_fs *c, struct bkey_s_c k, + struct printbuf *err) { - if (k.k->p.inode >= QTYP_NR) - return "invalid quota type"; + if (k.k->p.inode >= QTYP_NR) { + pr_buf(err, "invalid quota type (%llu >= %u)", + k.k->p.inode, QTYP_NR); + return -EINVAL; + } - if (bkey_val_bytes(k.k) != sizeof(struct bch_quota)) - return "incorrect value size"; + if (bkey_val_bytes(k.k) != sizeof(struct bch_quota)) { + pr_buf(err, "incorrect value size (%zu != %zu)", + bkey_val_bytes(k.k), sizeof(struct bch_quota)); + return -EINVAL; + } - return NULL; + return 0; } void bch2_quota_to_text(struct printbuf *out, struct bch_fs *c, |