summaryrefslogtreecommitdiff
path: root/fs/bcachefs/io_read.c
diff options
context:
space:
mode:
authorKent Overstreet <kent.overstreet@linux.dev>2025-05-24 23:33:39 +0300
committerKent Overstreet <kent.overstreet@linux.dev>2025-06-01 07:03:12 +0300
commit18dad454cd16cbb4c219dbd19a0008af52eb294a (patch)
tree8719893c0092c15af59b41afcbdb37e90ff6a602 /fs/bcachefs/io_read.c
parent9cb49fbf734609c79ba29c43d98e1230ecd1361a (diff)
downloadlinux-18dad454cd16cbb4c219dbd19a0008af52eb294a.tar.xz
bcachefs: Replace rcu_read_lock() with guards
The new guard(), scoped_guard() allow for more natural code. Some of the uses with creative flow control have been left. Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
Diffstat (limited to 'fs/bcachefs/io_read.c')
-rw-r--r--fs/bcachefs/io_read.c3
1 files changed, 1 insertions, 2 deletions
diff --git a/fs/bcachefs/io_read.c b/fs/bcachefs/io_read.c
index cc708d46557e..fb83c6942485 100644
--- a/fs/bcachefs/io_read.c
+++ b/fs/bcachefs/io_read.c
@@ -56,7 +56,7 @@ static bool bch2_target_congested(struct bch_fs *c, u16 target)
if (!target)
return false;
- rcu_read_lock();
+ guard(rcu)();
devs = bch2_target_to_mask(c, target) ?:
&c->rw_devs[BCH_DATA_user];
@@ -73,7 +73,6 @@ static bool bch2_target_congested(struct bch_fs *c, u16 target)
total += max(congested, 0LL);
nr++;
}
- rcu_read_unlock();
return get_random_u32_below(nr * CONGESTED_MAX) < total;
}