diff options
author | Kent Overstreet <kent.overstreet@linux.dev> | 2024-04-30 15:37:51 -0400 |
---|---|---|
committer | Kent Overstreet <kent.overstreet@linux.dev> | 2024-05-09 16:23:36 -0400 |
commit | 2c91ab7262e6b08bbc76b83ed1981602fa6ef835 (patch) | |
tree | f5973218363d57b32ee8112af9335a88a7f03799 /fs/bcachefs/sb-members.h | |
parent | 465bf6f42aac1474c6d58258501e55e8760c0a34 (diff) |
bcachefs: bch2_dev_get_ioref() checks for device not present
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
Diffstat (limited to 'fs/bcachefs/sb-members.h')
-rw-r--r-- | fs/bcachefs/sb-members.h | 15 |
1 files changed, 1 insertions, 14 deletions
diff --git a/fs/bcachefs/sb-members.h b/fs/bcachefs/sb-members.h index f2a7794b0b50..ae28b5d401e3 100644 --- a/fs/bcachefs/sb-members.h +++ b/fs/bcachefs/sb-members.h @@ -29,19 +29,6 @@ static inline bool bch2_dev_is_readable(struct bch_dev *ca) ca->mi.state != BCH_MEMBER_STATE_failed; } -static inline bool bch2_dev_get_ioref(struct bch_dev *ca, int rw) -{ - if (!percpu_ref_tryget(&ca->io_ref)) - return false; - - if (ca->mi.state == BCH_MEMBER_STATE_rw || - (ca->mi.state == BCH_MEMBER_STATE_ro && rw == READ)) - return true; - - percpu_ref_put(&ca->io_ref); - return false; -} - static inline unsigned dev_mask_nr(const struct bch_devs_mask *devs) { return bitmap_weight(devs->d, BCH_SB_MEMBERS_MAX); @@ -285,7 +272,7 @@ static inline struct bch_dev *bch2_dev_iterate(struct bch_fs *c, struct bch_dev return bch2_dev_tryget(c, dev_idx); } -static inline struct bch_dev *bch2_dev_get_ioref2(struct bch_fs *c, unsigned dev, int rw) +static inline struct bch_dev *bch2_dev_get_ioref(struct bch_fs *c, unsigned dev, int rw) { rcu_read_lock(); struct bch_dev *ca = bch2_dev_rcu(c, dev); |