Add helper of dm_handle_requeue() for handling dm_io requeue.

Signed-off-by: Ming Lei <ming....@redhat.com>
---
 drivers/md/dm.c | 17 ++++++++++++-----
 1 file changed, 12 insertions(+), 5 deletions(-)

diff --git a/drivers/md/dm.c b/drivers/md/dm.c
index 2b75f1ef7386..a9e5e429c150 100644
--- a/drivers/md/dm.c
+++ b/drivers/md/dm.c
@@ -884,13 +884,11 @@ static int __noflush_suspending(struct mapped_device *md)
        return test_bit(DMF_NOFLUSH_SUSPENDING, &md->flags);
 }
 
-static void dm_io_complete(struct dm_io *io)
+static void dm_handle_requeue(struct dm_io *io)
 {
-       blk_status_t io_error;
-       struct mapped_device *md = io->md;
-       struct bio *bio = io->split_bio ? io->split_bio : io->orig_bio;
-
        if (io->status == BLK_STS_DM_REQUEUE) {
+               struct bio *bio = io->split_bio ? io->split_bio : io->orig_bio;
+               struct mapped_device *md = io->md;
                unsigned long flags;
                /*
                 * Target requested pushing back the I/O.
@@ -909,6 +907,15 @@ static void dm_io_complete(struct dm_io *io)
                }
                spin_unlock_irqrestore(&md->deferred_lock, flags);
        }
+}
+
+static void dm_io_complete(struct dm_io *io)
+{
+       struct bio *bio = io->split_bio ? io->split_bio : io->orig_bio;
+       struct mapped_device *md = io->md;
+       blk_status_t io_error;
+
+       dm_handle_requeue(io);
 
        io_error = io->status;
        if (dm_io_flagged(io, DM_IO_ACCOUNTED))
-- 
2.31.1

--
dm-devel mailing list
dm-devel@redhat.com
https://listman.redhat.com/mailman/listinfo/dm-devel

Reply via email to