summaryrefslogtreecommitdiff
path: root/fs/bcachefs/buckets.h
diff options
context:
space:
mode:
authorKent Overstreet <kent.overstreet@gmail.com>2019-08-29 11:34:01 -0400
committerKent Overstreet <kent.overstreet@linux.dev>2023-10-22 17:08:26 -0400
commit06ab329c150f9eebc68cdb156a9591084b16ec55 (patch)
tree7cf7e4c4744f1e78cfbe3c25136054e82f898cdc /fs/bcachefs/buckets.h
parentad7e137ebc3dcadbaa37d2f464728c915e039e1d (diff)
bcachefs: Improve pointer marking checks and error messages
Importantly, we don't want to use bch2_fs_inconsistent_on() for errors that fsck can repair, becuase that will just put us in RO mode and prevent fsck from actually fixing stuff. Probably want to get rid of it in the future. Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
Diffstat (limited to 'fs/bcachefs/buckets.h')
-rw-r--r--fs/bcachefs/buckets.h9
1 files changed, 9 insertions, 0 deletions
diff --git a/fs/bcachefs/buckets.h b/fs/bcachefs/buckets.h
index 296d250e58dd..e93cda51d705 100644
--- a/fs/bcachefs/buckets.h
+++ b/fs/bcachefs/buckets.h
@@ -94,6 +94,15 @@ static inline struct bucket *PTR_BUCKET(struct bch_dev *ca,
return __bucket(ca, PTR_BUCKET_NR(ca, ptr), gc);
}
+static inline enum bch_data_type ptr_data_type(const struct bkey *k,
+ const struct bch_extent_ptr *ptr)
+{
+ if (k->type == KEY_TYPE_btree_ptr)
+ return BCH_DATA_BTREE;
+
+ return ptr->cached ? BCH_DATA_CACHED : BCH_DATA_USER;
+}
+
static inline struct bucket_mark ptr_bucket_mark(struct bch_dev *ca,
const struct bch_extent_ptr *ptr)
{