bcachefs: Improve bch2_dev_bucket_missing()
More useful error message. Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
This commit is contained in:
@@ -15,9 +15,11 @@ void bch2_dev_missing(struct bch_fs *c, unsigned dev)
|
||||
bch2_fs_inconsistent(c, "pointer to nonexistent device %u", dev);
|
||||
}
|
||||
|
||||
void bch2_dev_bucket_missing(struct bch_fs *c, struct bpos bucket)
|
||||
void bch2_dev_bucket_missing(struct bch_dev *ca, u64 bucket)
|
||||
{
|
||||
bch2_fs_inconsistent(c, "pointer to nonexistent bucket %llu:%llu", bucket.inode, bucket.offset);
|
||||
bch2_fs_inconsistent(ca->fs,
|
||||
"pointer to nonexistent bucket %llu on device %s (valid range %u-%llu)",
|
||||
bucket, ca->name, ca->mi.first_bucket, ca->mi.nbuckets);
|
||||
}
|
||||
|
||||
#define x(t, n, ...) [n] = #t,
|
||||
|
||||
@@ -249,20 +249,23 @@ static inline struct bch_dev *bch2_dev_tryget(struct bch_fs *c, unsigned dev)
|
||||
static inline struct bch_dev *bch2_dev_bucket_tryget_noerror(struct bch_fs *c, struct bpos bucket)
|
||||
{
|
||||
struct bch_dev *ca = bch2_dev_tryget_noerror(c, bucket.inode);
|
||||
if (ca && !bucket_valid(ca, bucket.offset)) {
|
||||
if (ca && unlikely(!bucket_valid(ca, bucket.offset))) {
|
||||
bch2_dev_put(ca);
|
||||
ca = NULL;
|
||||
}
|
||||
return ca;
|
||||
}
|
||||
|
||||
void bch2_dev_bucket_missing(struct bch_fs *, struct bpos);
|
||||
void bch2_dev_bucket_missing(struct bch_dev *, u64);
|
||||
|
||||
static inline struct bch_dev *bch2_dev_bucket_tryget(struct bch_fs *c, struct bpos bucket)
|
||||
{
|
||||
struct bch_dev *ca = bch2_dev_bucket_tryget_noerror(c, bucket);
|
||||
if (!ca)
|
||||
bch2_dev_bucket_missing(c, bucket);
|
||||
struct bch_dev *ca = bch2_dev_tryget(c, bucket.inode);
|
||||
if (ca && unlikely(!bucket_valid(ca, bucket.offset))) {
|
||||
bch2_dev_bucket_missing(ca, bucket.offset);
|
||||
bch2_dev_put(ca);
|
||||
ca = NULL;
|
||||
}
|
||||
return ca;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user