From patchwork Tue Jul 19 13:20:38 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hannes Reinecke X-Patchwork-Id: 9237327 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 50A9C607DA for ; Tue, 19 Jul 2016 13:20:45 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 4349926C2F for ; Tue, 19 Jul 2016 13:20:45 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 3835B2705B; Tue, 19 Jul 2016 13:20:45 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.9 required=2.0 tests=BAYES_00,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 9B9B326D19 for ; Tue, 19 Jul 2016 13:20:44 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753520AbcGSNUo (ORCPT ); Tue, 19 Jul 2016 09:20:44 -0400 Received: from mx2.suse.de ([195.135.220.15]:59826 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753408AbcGSNUn (ORCPT ); Tue, 19 Jul 2016 09:20:43 -0400 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (charybdis-ext.suse.de [195.135.220.254]) by mx2.suse.de (Postfix) with ESMTP id B611BADC4; Tue, 19 Jul 2016 13:20:41 +0000 (UTC) From: Hannes Reinecke To: Jens Axboe Cc: linux-block@vger.kernel.org, linux-scsi@vger.kernel.org, Damien Le Moal , Hannes Reinecke Subject: [PATCH 5/6] block: Introduce BLKPREP_DONE Date: Tue, 19 Jul 2016 15:20:38 +0200 Message-Id: <1468934439-93579-6-git-send-email-hare@suse.de> X-Mailer: git-send-email 1.8.5.6 In-Reply-To: <1468934439-93579-1-git-send-email-hare@suse.de> References: <1468934439-93579-1-git-send-email-hare@suse.de> Sender: linux-block-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-block@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Add a new blkprep return code BLKPREP_DONE to signal completion without I/O error. Signed-off-by: Hannes Reinecke Reviewed-by: Damien Le Moal Tested-by: Damien Le Moal --- 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 e273194..4bcf30a 100644 --- a/block/blk-core.c +++ b/block/blk-core.c @@ -2462,9 +2462,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 b2e332a..f112926 100644 --- a/drivers/scsi/scsi_lib.c +++ b/drivers/scsi/scsi_lib.c @@ -1257,6 +1257,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 d5e3d8b..c351444 100644 --- a/include/linux/blkdev.h +++ b/include/linux/blkdev.h @@ -736,6 +736,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;