Commit 23f308ae authored by Kent Overstreet's avatar Kent Overstreet

bcachefs: bch2_dev_safe() -> bch2_dev_rcu()

Signed-off-by: default avatarKent Overstreet <kent.overstreet@linux.dev>
parent 552aa548
...@@ -983,7 +983,7 @@ void bch2_extent_ptr_to_text(struct printbuf *out, struct bch_fs *c, const struc ...@@ -983,7 +983,7 @@ void bch2_extent_ptr_to_text(struct printbuf *out, struct bch_fs *c, const struc
{ {
out->atomic++; out->atomic++;
rcu_read_lock(); rcu_read_lock();
struct bch_dev *ca = bch2_dev_safe(c, ptr->dev); struct bch_dev *ca = bch2_dev_rcu(c, ptr->dev);
if (!ca) { if (!ca) {
prt_printf(out, "ptr: %u:%llu gen %u%s", ptr->dev, prt_printf(out, "ptr: %u:%llu gen %u%s", ptr->dev,
(u64) ptr->offset, ptr->gen, (u64) ptr->offset, ptr->gen,
......
...@@ -3,6 +3,7 @@ ...@@ -3,6 +3,7 @@
#include "bcachefs.h" #include "bcachefs.h"
#include "btree_cache.h" #include "btree_cache.h"
#include "disk_groups.h" #include "disk_groups.h"
#include "error.h"
#include "opts.h" #include "opts.h"
#include "replicas.h" #include "replicas.h"
#include "sb-members.h" #include "sb-members.h"
......
...@@ -210,7 +210,7 @@ static inline struct bch_dev *bch2_dev_locked(struct bch_fs *c, unsigned dev) ...@@ -210,7 +210,7 @@ static inline struct bch_dev *bch2_dev_locked(struct bch_fs *c, unsigned dev)
lockdep_is_held(&c->state_lock)); lockdep_is_held(&c->state_lock));
} }
static inline struct bch_dev *bch2_dev_safe(struct bch_fs *c, unsigned dev) static inline struct bch_dev *bch2_dev_rcu(struct bch_fs *c, unsigned dev)
{ {
return c && dev < c->sb.nr_devices return c && dev < c->sb.nr_devices
? rcu_dereference(c->devs[dev]) ? rcu_dereference(c->devs[dev])
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment