dm: fix dm_wq_work() to only use __split_and_process_bio() if appropriate [Linux 5.0]

dm: fix dm_wq_work() to only use __split_and_process_bio() if appropriate [Linux 5.0]

This Linux kernel change "dm: fix dm_wq_work() to only use __split_and_process_bio() if appropriate" is included in the Linux 5.0 release. This change is authored by Mike Snitzer <snitzer [at] redhat.com> on Thu Jan 17 14:33:01 2019 -0500. The commit for this change in Linux stable tree is 6548c7c (patch).

dm: fix dm_wq_work() to only use __split_and_process_bio() if appropriate

Otherwise targets that don't support/expect IO splitting could resubmit
bios using code paths with unnecessary IO splitting complexity.

Depends-on: 24113d487843 ("dm: avoid indirect call in __dm_make_request")
Fixes: 978e51ba38e00 ("dm: optimize bio-based NVMe IO submission")
Signed-off-by: Mike Snitzer <snitzer@redhat.com>

There are 18 lines of Linux source code added/deleted in this change. Code changes to Linux kernel are as follows.

 drivers/md/dm.c | 18 ++++++++++++------
 1 file changed, 12 insertions(+), 6 deletions(-)

diff --git a/drivers/md/dm.c b/drivers/md/dm.c
index fbadda6..a010002 100644
--- a/drivers/md/dm.c
+++ b/drivers/md/dm.c
@@ -1725,6 +1725,15 @@ static blk_qc_t __process_bio(struct mapped_device *md,
    return ret;
 }

+static blk_qc_t dm_process_bio(struct mapped_device *md,
+                  struct dm_table *map, struct bio *bio)
+{
+   if (dm_get_md_type(md) == DM_TYPE_NVME_BIO_BASED)
+       return __process_bio(md, map, bio);
+   else
+       return __split_and_process_bio(md, map, bio);
+}
+
 static blk_qc_t dm_make_request(struct request_queue *q, struct bio *bio)
 {
    struct mapped_device *md = q->queuedata;
@@ -1745,10 +1754,7 @@ static blk_qc_t dm_make_request(struct request_queue *q, struct bio *bio)
        return ret;
    }

-   if (dm_get_md_type(md) == DM_TYPE_NVME_BIO_BASED)
-       ret = __process_bio(md, map, bio);
-   else
-       ret = __split_and_process_bio(md, map, bio);
+   ret = dm_process_bio(md, map, bio);

    dm_put_live_table(md, srcu_idx);
    return ret;
@@ -2427,9 +2433,9 @@ static void dm_wq_work(struct work_struct *work)
            break;

        if (dm_request_based(md))
-           generic_make_request(c);
+           (void) generic_make_request(c);
        else
-           __split_and_process_bio(md, map, c);
+           (void) dm_process_bio(md, map, c);
    }

    dm_put_live_table(md, srcu_idx);

Leave a Reply

Your email address will not be published. Required fields are marked *