From patchwork Mon Apr 4 10:00:18 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hannes Reinecke X-Patchwork-Id: 8739591 Return-Path: X-Original-To: patchwork-linux-block@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 98B59C0553 for ; Mon, 4 Apr 2016 10:01:00 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 252C5201FA for ; Mon, 4 Apr 2016 10:00:55 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 4EFF02021F for ; Mon, 4 Apr 2016 10:00:53 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755030AbcDDKAt (ORCPT ); Mon, 4 Apr 2016 06:00:49 -0400 Received: from mx2.suse.de ([195.135.220.15]:60451 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754846AbcDDKAq (ORCPT ); Mon, 4 Apr 2016 06:00:46 -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 3A2A1ACFC; Mon, 4 Apr 2016 10:00:41 +0000 (UTC) From: Hannes Reinecke To: Jens Axboe Cc: linux-block@vger.kernel.org, "Martin K. Petersen" , Christoph Hellwig , Shaun Tancheff , Damien Le Moal , linux-scsi@vger.kernel.org, Sathya Prakash , Hannes Reinecke Subject: [PATCH 7/9] block: Introduce BLKPREP_DONE Date: Mon, 4 Apr 2016 12:00:18 +0200 Message-Id: <1459764020-126038-8-git-send-email-hare@suse.de> X-Mailer: git-send-email 1.8.5.6 In-Reply-To: <1459764020-126038-1-git-send-email-hare@suse.de> References: <1459764020-126038-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-Spam-Status: No, score=-7.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.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 --- 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;