Add a new blkprep return code BLKPREP_DONE to signal completion
without I/O error.

Signed-off-by: Hannes Reinecke <h...@suse.de>
---
 block/blk-core.c        | 6 +++++-
 drivers/scsi/scsi_lib.c | 1 +
 include/linux/blkdev.h  | 1 +
 3 files changed, 7 insertions(+), 1 deletion(-)

diff --git a/block/blk-core.c b/block/blk-core.c
index d3d3db9..33ea429 100644
--- a/block/blk-core.c
+++ b/block/blk-core.c
@@ -2460,9 +2460,13 @@ struct request *blk_peek_request(struct request_queue *q)
 
                        rq = NULL;
                        break;
-               } else if (ret == BLKPREP_KILL || ret == BLKPREP_INVALID) {
+               } else if (ret == BLKPREP_KILL || ret == BLKPREP_INVALID ||
+                          ret == BLKPREP_DONE) {
                        int err = (ret == BLKPREP_INVALID) ? -EREMOTEIO : -EIO;
 
+                       if (ret == BLKPREP_DONE)
+                               err = 0;
+
                        rq->cmd_flags |= REQ_QUIET;
                        /*
                         * Mark this request as started so we don't trigger
diff --git a/drivers/scsi/scsi_lib.c b/drivers/scsi/scsi_lib.c
index 8106515..1cc75fb 100644
--- a/drivers/scsi/scsi_lib.c
+++ b/drivers/scsi/scsi_lib.c
@@ -1346,6 +1346,7 @@ scsi_prep_return(struct request_queue *q, struct request 
*req, int ret)
        case BLKPREP_KILL:
        case BLKPREP_INVALID:
                req->errors = DID_NO_CONNECT << 16;
+       case BLKPREP_DONE:
                /* release the command and kill it */
                if (req->special) {
                        struct scsi_cmnd *cmd = req->special;
diff --git a/include/linux/blkdev.h b/include/linux/blkdev.h
index f58bcdc..0dead8d 100644
--- a/include/linux/blkdev.h
+++ b/include/linux/blkdev.h
@@ -735,6 +735,7 @@ enum {
        BLKPREP_KILL,           /* fatal error, kill, return -EIO */
        BLKPREP_DEFER,          /* leave on queue */
        BLKPREP_INVALID,        /* invalid command, kill, return -EREMOTEIO */
+       BLKPREP_DONE,           /* complete w/o error */
 };
 
 extern unsigned long blk_max_low_pfn, blk_max_pfn;
-- 
1.8.5.6

--
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to