dm: introduce a new DM_MAPIO_KILL return value
authorChristoph Hellwig <hch@lst.de>
Wed, 26 Apr 2017 07:40:39 +0000 (09:40 +0200)
committerMike Snitzer <snitzer@redhat.com>
Mon, 1 May 2017 22:19:03 +0000 (18:19 -0400)
This untangles the DM_MAPIO_* values returned from ->clone_and_map_rq
from the error codes used by the block layer.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Mike Snitzer <snitzer@redhat.com>
drivers/md/dm-rq.c
drivers/md/dm-target.c
include/linux/device-mapper.h

index 920e854caba9849ceeb4bd1bcb6c6a8c6b28c067..a48130b90157c6f3656c024684eddfc01d295302 100644 (file)
@@ -504,14 +504,12 @@ static int map_request(struct dm_rq_target_io *tio)
                /* The target wants to requeue the I/O after a delay */
                dm_requeue_original_request(tio, true);
                break;
-       default:
-               if (r > 0) {
-                       DMWARN("unimplemented target map return value: %d", r);
-                       BUG();
-               }
-
+       case DM_MAPIO_KILL:
                /* The target wants to complete the I/O */
-               dm_kill_unmapped_request(rq, r);
+               dm_kill_unmapped_request(rq, -EIO);
+       default:
+               DMWARN("unimplemented target map return value: %d", r);
+               BUG();
        }
 
        return r;
index 43d3445b121d79adb4344221d4d2cb3b27492bc5..6264ff00dcf0edcb182b59d7ead753fbac59117a 100644 (file)
@@ -135,7 +135,7 @@ static int io_err_clone_and_map_rq(struct dm_target *ti, struct request *rq,
                                   union map_info *map_context,
                                   struct request **clone)
 {
-       return -EIO;
+       return DM_MAPIO_KILL;
 }
 
 static void io_err_release_clone_rq(struct request *clone)
index 5a02fc0ff311d6d02a558f48fe1475c8246adeea..78ad0624cdaed55e4aab0a306be96f5e48541fb8 100644 (file)
@@ -604,6 +604,7 @@ extern struct ratelimit_state dm_ratelimit_state;
 #define DM_MAPIO_REMAPPED      1
 #define DM_MAPIO_REQUEUE       DM_ENDIO_REQUEUE
 #define DM_MAPIO_DELAY_REQUEUE 3
+#define DM_MAPIO_KILL          4
 
 #define dm_sector_div64(x, y)( \
 { \