From patchwork Thu Nov 17 09:31:20 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Johannes Thumshirn X-Patchwork-Id: 9433751 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 70D0860471 for ; Thu, 17 Nov 2016 09:37:31 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 5FF7129309 for ; Thu, 17 Nov 2016 09:37:31 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 54D962939E; Thu, 17 Nov 2016 09:37:31 +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=unavailable 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 E9E1B29309 for ; Thu, 17 Nov 2016 09:37:30 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932950AbcKQJcr (ORCPT ); Thu, 17 Nov 2016 04:32:47 -0500 Received: from mx2.suse.de ([195.135.220.15]:55690 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753493AbcKQJbx (ORCPT ); Thu, 17 Nov 2016 04:31:53 -0500 X-Virus-Scanned: by amavisd-new at test-mx.suse.de X-Amavis-Alert: BAD HEADER SECTION, Duplicate header field: "References" Received: from relay2.suse.de (charybdis-ext.suse.de [195.135.220.254]) by mx2.suse.de (Postfix) with ESMTP id 2C72BACDE; Thu, 17 Nov 2016 09:31:51 +0000 (UTC) From: Johannes Thumshirn To: James Bottomley , "Martin K . Petersen" Cc: Hannes Reinecke , Christoph Hellwig , Johannes Thumshirn , Jens Axboe , Hannes Reinecke , linux-block@vger.kernel.org (open list:BLOCK LAYER), linux-kernel@vger.kernel.org (open list), linux-scsi@vger.kernel.org (open list:SCSI SUBSYSTEM) Subject: [PATCH v4 10/15] scsi: fc: Use bsg_destroy_job Date: Thu, 17 Nov 2016 10:31:20 +0100 Message-Id: <9aede92a31caaa415d15a38982c3c3bc81549c0f.1479374720.git.jthumshirn@suse.de> X-Mailer: git-send-email 1.8.5.6 In-Reply-To: References: In-Reply-To: References: 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 fc_destroy_bsgjob() and bsg_destroy_job() are now 1:1 copies, so use the later. As bsg_destroy_job() comes from bsg-lib we need to select it in Kconfig once CONFOG_SCSI_FC_ATTRS is active. Signed-off-by: Johannes Thumshirn Reviewed-by: Hannes Reinecke --- block/bsg-lib.c | 7 +++++-- drivers/scsi/Kconfig | 1 + drivers/scsi/scsi_transport_fc.c | 25 +++---------------------- include/linux/bsg-lib.h | 1 + 4 files changed, 10 insertions(+), 24 deletions(-) diff --git a/block/bsg-lib.c b/block/bsg-lib.c index 632fb40..9f1e8fd 100644 --- a/block/bsg-lib.c +++ b/block/bsg-lib.c @@ -32,9 +32,12 @@ * bsg_destroy_job - routine to teardown/delete a bsg job * @job: bsg_job that is to be torn down */ -static void bsg_destroy_job(struct kref *kref) +void bsg_destroy_job(struct kref *kref) { struct bsg_job *job = container_of(kref, struct bsg_job, kref); + struct request *rq = job->req; + + blk_end_request_all(rq, rq->errors); put_device(job->dev); /* release reference for the request */ @@ -42,6 +45,7 @@ static void bsg_destroy_job(struct kref *kref) kfree(job->reply_payload.sg_list); kfree(job); } +EXPORT_SYMBOL_GPL(bsg_destroy_job); /** * bsg_job_done - completion routine for bsg requests @@ -85,7 +89,6 @@ static void bsg_softirq_done(struct request *rq) { struct bsg_job *job = rq->special; - blk_end_request_all(rq, rq->errors); kref_put(&job->kref, bsg_destroy_job); } diff --git a/drivers/scsi/Kconfig b/drivers/scsi/Kconfig index 3b416c9..dfa9334 100644 --- a/drivers/scsi/Kconfig +++ b/drivers/scsi/Kconfig @@ -263,6 +263,7 @@ config SCSI_SPI_ATTRS config SCSI_FC_ATTRS tristate "FiberChannel Transport Attributes" depends on SCSI && NET + select BLK_DEV_BSGLIB select SCSI_NETLINK help If you wish to export transport-specific information about diff --git a/drivers/scsi/scsi_transport_fc.c b/drivers/scsi/scsi_transport_fc.c index 10a2254..0f350b7 100644 --- a/drivers/scsi/scsi_transport_fc.c +++ b/drivers/scsi/scsi_transport_fc.c @@ -30,6 +30,7 @@ #include #include #include +#include #include #include #include @@ -3554,26 +3555,6 @@ struct fc_vport * * BSG support */ - -/** - * fc_destroy_bsgjob - routine to teardown/delete a fc bsg job - * @job: fc_bsg_job that is to be torn down - */ -static void -fc_destroy_bsgjob(struct kref *kref) -{ - struct bsg_job *job = container_of(kref, struct bsg_job, kref); - struct request *rq = job->req; - - blk_end_request_all(rq, rq->errors); - - put_device(job->dev); /* release reference for the request */ - - kfree(job->request_payload.sg_list); - kfree(job->reply_payload.sg_list); - kfree(job); -} - /** * fc_bsg_jobdone - completion routine for bsg requests that the LLD has * completed @@ -3617,7 +3598,7 @@ static void fc_bsg_softirq_done(struct request *rq) { struct bsg_job *job = rq->special; - kref_put(&job->kref, fc_destroy_bsgjob); + kref_put(&job->kref, bsg_destroy_job); } /** @@ -3642,7 +3623,7 @@ static void fc_bsg_softirq_done(struct request *rq) /* call LLDD to abort the i/o as it has timed out */ err = i->f->bsg_timeout(job); if (err == -EAGAIN) { - kref_put(&job->kref, fc_destroy_bsgjob); + kref_put(&job->kref, bsg_destroy_job); return BLK_EH_RESET_TIMER; } else if (err) printk(KERN_ERR "ERROR: FC BSG request timeout - LLD " diff --git a/include/linux/bsg-lib.h b/include/linux/bsg-lib.h index 58e0717..67f7de6 100644 --- a/include/linux/bsg-lib.h +++ b/include/linux/bsg-lib.h @@ -69,5 +69,6 @@ void bsg_job_done(struct bsg_job *job, int result, int bsg_setup_queue(struct device *dev, struct request_queue *q, char *name, bsg_job_fn *job_fn, int dd_job_size); void bsg_request_fn(struct request_queue *q); +void bsg_destroy_job(struct kref *kref); #endif