diff options
author | Kent Overstreet <kent.overstreet@linux.dev> | 2025-06-13 22:34:35 -0400 |
---|---|---|
committer | Kent Overstreet <kent.overstreet@linux.dev> | 2025-06-30 17:43:55 -0400 |
commit | dbbca762f9e30ea2edcc7e03ceba0e0679b68134 (patch) | |
tree | e9472ce64b06ad91e66ea59f6cb53e4f22be2ad1 | |
parent | dd1e1de88de9c6d14a03df9bc0095fc21fe8f878 (diff) |
bcachefs: DEFINE_CLASS()es for dev refcounts
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
-rw-r--r-- | fs/bcachefs/sb-members.h | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/fs/bcachefs/sb-members.h b/fs/bcachefs/sb-members.h index 8d8a8a857648..5dcc2017f85b 100644 --- a/fs/bcachefs/sb-members.h +++ b/fs/bcachefs/sb-members.h @@ -240,6 +240,10 @@ static inline struct bch_dev *bch2_dev_tryget_noerror(struct bch_fs *c, unsigned return ca; } +DEFINE_CLASS(bch2_dev_tryget_noerror, struct bch_dev *, + bch2_dev_put(_T), bch2_dev_tryget_noerror(c, dev), + struct bch_fs *c, unsigned dev); + static inline struct bch_dev *bch2_dev_tryget(struct bch_fs *c, unsigned dev) { struct bch_dev *ca = bch2_dev_tryget_noerror(c, dev); @@ -248,6 +252,10 @@ static inline struct bch_dev *bch2_dev_tryget(struct bch_fs *c, unsigned dev) return ca; } +DEFINE_CLASS(bch2_dev_tryget, struct bch_dev *, + bch2_dev_put(_T), bch2_dev_tryget(c, dev), + 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); @@ -258,6 +266,10 @@ static inline struct bch_dev *bch2_dev_bucket_tryget_noerror(struct bch_fs *c, s return ca; } +DEFINE_CLASS(bch2_dev_bucket_tryget_noerror, struct bch_dev *, + bch2_dev_put(_T), bch2_dev_bucket_tryget_noerror(c, bucket), + struct bch_fs *c, struct bpos bucket); + 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) @@ -271,6 +283,10 @@ static inline struct bch_dev *bch2_dev_bucket_tryget(struct bch_fs *c, struct bp return ca; } +DEFINE_CLASS(bch2_dev_bucket_tryget, struct bch_dev *, + bch2_dev_put(_T), bch2_dev_bucket_tryget(c, bucket), + struct bch_fs *c, struct bpos bucket); + static inline struct bch_dev *bch2_dev_iterate_noerror(struct bch_fs *c, struct bch_dev *ca, unsigned dev_idx) { if (ca && ca->dev_idx == dev_idx) |