summaryrefslogtreecommitdiffstats
path: root/drivers/md/dm-rq.c
diff options
context:
space:
mode:
authorChristoph Hellwig <hch@lst.de>2017-04-26 09:40:37 +0200
committerMike Snitzer <snitzer@redhat.com>2017-05-01 18:19:03 -0400
commit7ed8578a96ad98231d8bf6388f776e034673e18a (patch)
tree91d1d822e1e9c1e04343486df3860b93b9c57836 /drivers/md/dm-rq.c
parentb79f10eefd4bc450a595b93c75e3a9d159ac3885 (diff)
downloadlinux-stable-7ed8578a96ad98231d8bf6388f776e034673e18a.tar.gz
linux-stable-7ed8578a96ad98231d8bf6388f776e034673e18a.tar.bz2
linux-stable-7ed8578a96ad98231d8bf6388f776e034673e18a.zip
dm rq: change ->rq_end_io calling conventions
Instead of returning either a DM_ENDIO_* constant or an error code, add a new DM_ENDIO_DONE value that means keep errno as is. This allows us to easily keep the existing error code in case where we can't push back, and it also preparares for the new block level status codes with strict type checking. Signed-off-by: Christoph Hellwig <hch@lst.de> Signed-off-by: Mike Snitzer <snitzer@redhat.com>
Diffstat (limited to 'drivers/md/dm-rq.c')
-rw-r--r--drivers/md/dm-rq.c17
1 files changed, 10 insertions, 7 deletions
diff --git a/drivers/md/dm-rq.c b/drivers/md/dm-rq.c
index d445b712970b..920e854caba9 100644
--- a/drivers/md/dm-rq.c
+++ b/drivers/md/dm-rq.c
@@ -287,7 +287,7 @@ static void dm_requeue_original_request(struct dm_rq_target_io *tio, bool delay_
static void dm_done(struct request *clone, int error, bool mapped)
{
- int r = error;
+ int r = DM_ENDIO_DONE;
struct dm_rq_target_io *tio = clone->end_io_data;
dm_request_endio_fn rq_end_io = NULL;
@@ -298,7 +298,7 @@ static void dm_done(struct request *clone, int error, bool mapped)
r = rq_end_io(tio->ti, clone, error, &tio->info);
}
- if (unlikely(r == -EREMOTEIO)) {
+ if (unlikely(error == -EREMOTEIO)) {
if (req_op(clone) == REQ_OP_WRITE_SAME &&
!clone->q->limits.max_write_same_sectors)
disable_write_same(tio->md);
@@ -307,16 +307,19 @@ static void dm_done(struct request *clone, int error, bool mapped)
disable_write_zeroes(tio->md);
}
- if (r <= 0)
+ switch (r) {
+ case DM_ENDIO_DONE:
/* The target wants to complete the I/O */
- dm_end_request(clone, r);
- else if (r == DM_ENDIO_INCOMPLETE)
+ dm_end_request(clone, error);
+ break;
+ case DM_ENDIO_INCOMPLETE:
/* The target will handle the I/O */
return;
- else if (r == DM_ENDIO_REQUEUE)
+ case DM_ENDIO_REQUEUE:
/* The target wants to requeue the I/O */
dm_requeue_original_request(tio, false);
- else {
+ break;
+ default:
DMWARN("unimplemented target endio return value: %d", r);
BUG();
}