summaryrefslogtreecommitdiff
path: root/drivers
diff options
context:
space:
mode:
authorXiao Ni <xni@redhat.com>2023-01-31 08:17:09 +0300
committerSong Liu <song@kernel.org>2023-02-01 19:32:58 +0300
commitd19329133d25ad3dc32f8a62635692cb2f189014 (patch)
tree7bcddab105c6abfdd19916ae69a94d6f2f111a25 /drivers
parent1d1f25bfda432a6b61bd0205d426226bbbd73504 (diff)
downloadlinux-d19329133d25ad3dc32f8a62635692cb2f189014.tar.xz
md: Factor out is_md_suspended helper
This helper function will be used in next patch. It's easy for understanding. Signed-off-by: Xiao Ni <xni@redhat.com> Signed-off-by: Song Liu <song@kernel.org>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/md/md.c17
1 files changed, 12 insertions, 5 deletions
diff --git a/drivers/md/md.c b/drivers/md/md.c
index 272cc5d14906..5ec9fdd5e668 100644
--- a/drivers/md/md.c
+++ b/drivers/md/md.c
@@ -380,6 +380,13 @@ EXPORT_SYMBOL_GPL(md_new_event);
static LIST_HEAD(all_mddevs);
static DEFINE_SPINLOCK(all_mddevs_lock);
+static bool is_md_suspended(struct mddev *mddev)
+{
+ if (mddev->suspended)
+ return true;
+ else
+ return false;
+}
/* Rather than calling directly into the personality make_request function,
* IO requests come here first so that we can check if the device is
* being suspended pending a reconfiguration.
@@ -389,7 +396,7 @@ static DEFINE_SPINLOCK(all_mddevs_lock);
*/
static bool is_suspended(struct mddev *mddev, struct bio *bio)
{
- if (mddev->suspended)
+ if (is_md_suspended(mddev))
return true;
if (bio_data_dir(bio) != WRITE)
return false;
@@ -434,7 +441,7 @@ check_suspended:
goto check_suspended;
}
- if (atomic_dec_and_test(&mddev->active_io) && mddev->suspended)
+ if (atomic_dec_and_test(&mddev->active_io) && is_md_suspended(mddev))
wake_up(&mddev->sb_wait);
}
EXPORT_SYMBOL(md_handle_request);
@@ -6219,7 +6226,7 @@ EXPORT_SYMBOL_GPL(md_stop_writes);
static void mddev_detach(struct mddev *mddev)
{
md_bitmap_wait_behind_writes(mddev);
- if (mddev->pers && mddev->pers->quiesce && !mddev->suspended) {
+ if (mddev->pers && mddev->pers->quiesce && !is_md_suspended(mddev)) {
mddev->pers->quiesce(mddev, 1);
mddev->pers->quiesce(mddev, 0);
}
@@ -8531,7 +8538,7 @@ bool md_write_start(struct mddev *mddev, struct bio *bi)
return true;
wait_event(mddev->sb_wait,
!test_bit(MD_SB_CHANGE_PENDING, &mddev->sb_flags) ||
- mddev->suspended);
+ is_md_suspended(mddev));
if (test_bit(MD_SB_CHANGE_PENDING, &mddev->sb_flags)) {
percpu_ref_put(&mddev->writes_pending);
return false;
@@ -9259,7 +9266,7 @@ void md_check_recovery(struct mddev *mddev)
wake_up(&mddev->sb_wait);
}
- if (mddev->suspended)
+ if (is_md_suspended(mddev))
return;
if (mddev->bitmap)