summaryrefslogtreecommitdiff
path: root/libbcachefs/super.h
diff options
context:
space:
mode:
authorKent Overstreet <kent.overstreet@gmail.com>2022-03-31 16:57:08 -0400
committerKent Overstreet <kent.overstreet@gmail.com>2022-03-31 16:57:08 -0400
commit70f2681838973f20a918b518f82d382b3556963d (patch)
tree6fe669df2e5cca41c4065bb717d0826250fa9219 /libbcachefs/super.h
parentcc1b64e992b52d19b24cdc7677fc451c60d2c9d4 (diff)
Update bcachefs sources to 5e392aed7a bcachefs: Kill bch2_alloc_write()v0.20
Diffstat (limited to 'libbcachefs/super.h')
-rw-r--r--libbcachefs/super.h6
1 files changed, 6 insertions, 0 deletions
diff --git a/libbcachefs/super.h b/libbcachefs/super.h
index 3f24ca5a..6d3efda2 100644
--- a/libbcachefs/super.h
+++ b/libbcachefs/super.h
@@ -26,6 +26,12 @@ static inline sector_t bucket_remainder(const struct bch_dev *ca, sector_t s)
return remainder;
}
+static inline size_t sector_to_bucket_and_offset(const struct bch_dev *ca, sector_t s,
+ u32 *offset)
+{
+ return div_u64_rem(s, ca->mi.bucket_size, offset);
+}
+
static inline bool bch2_dev_is_online(struct bch_dev *ca)
{
return !percpu_ref_is_zero(&ca->io_ref);