All of lore.kernel.org
 help / color / mirror / Atom feed
From: Johannes Thumshirn <jthumshirn@suse.de>
To: "Martin K . Petersen" <martin.petersen@oracle.com>
Cc: Christoph Hellwig <hch@infradead.org>,
	Hannes Reinecke <hare@suse.de>,
	Linux Kernel Mailinglist <linux-kernel@vger.kernel.org>,
	Linux SCSI Mailinglist <linux-scsi@vger.kernel.org>,
	Johannes Thumshirn <jthumshirn@suse.de>,
	Jens Axboe <axboe@kernel.dk>,
	"James E.J. Bottomley" <jejb@linux.vnet.ibm.com>,
	linux-block@vger.kernel.org (open list:BLOCK LAYER)
Subject: [PATCH v2 11/16] scsi: fc: Use bsg_destroy_job
Date: Wed, 12 Oct 2016 15:06:37 +0200	[thread overview]
Message-ID: <7c7473dfa0f74f7bdf442d5669a57204ecf812e4.1476276823.git.jthumshirn@suse.de> (raw)
In-Reply-To: <cover.1476276823.git.jthumshirn@suse.de>
In-Reply-To: <cover.1476276823.git.jthumshirn@suse.de>

fc_destroy_bsgjob() and bsg_destroy_job() are now 1:1 copies, so use the
later.

Signed-off-by: Johannes Thumshirn <jthumshirn@suse.de>
---
 block/bsg-lib.c                  |  3 ++-
 drivers/scsi/scsi_transport_fc.c | 20 ++------------------
 include/linux/bsg-lib.h          |  1 +
 3 files changed, 5 insertions(+), 19 deletions(-)

diff --git a/block/bsg-lib.c b/block/bsg-lib.c
index 632fb40..6b99c7f 100644
--- a/block/bsg-lib.c
+++ b/block/bsg-lib.c
@@ -32,7 +32,7 @@
  * 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);
 
@@ -42,6 +42,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
diff --git a/drivers/scsi/scsi_transport_fc.c b/drivers/scsi/scsi_transport_fc.c
index a0e150a..4b9324f 100644
--- a/drivers/scsi/scsi_transport_fc.c
+++ b/drivers/scsi/scsi_transport_fc.c
@@ -30,6 +30,7 @@
 #include <linux/slab.h>
 #include <linux/delay.h>
 #include <linux/kernel.h>
+#include <linux/bsg-lib.h>
 #include <scsi/scsi_device.h>
 #include <scsi/scsi_host.h>
 #include <scsi/scsi_transport.h>
@@ -3554,23 +3555,6 @@ fc_vport_sched_delete(struct work_struct *work)
  * 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);
-
-	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
@@ -3640,7 +3624,7 @@ fc_bsg_job_timeout(struct request *req)
 		/* 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
-- 
1.8.5.6

WARNING: multiple messages have this Message-ID (diff)
From: Johannes Thumshirn <jthumshirn@suse.de>
To: "Martin K . Petersen" <martin.petersen@oracle.com>
Cc: Christoph Hellwig <hch@infradead.org>,
	Hannes Reinecke <hare@suse.de>,
	Linux Kernel Mailinglist <linux-kernel@vger.kernel.org>,
	Linux SCSI Mailinglist <linux-scsi@vger.kernel.org>,
	Johannes Thumshirn <jthumshirn@suse.de>,
	Jens Axboe <axboe@kernel.dk>,
	"James E.J. Bottomley" <jejb@linux.vnet.ibm.com>,
	"open list:BLOCK LAYER" <linux-block@vger.kernel.org>
Subject: [PATCH v2 11/16] scsi: fc: Use bsg_destroy_job
Date: Wed, 12 Oct 2016 15:06:37 +0200	[thread overview]
Message-ID: <7c7473dfa0f74f7bdf442d5669a57204ecf812e4.1476276823.git.jthumshirn@suse.de> (raw)
In-Reply-To: <cover.1476276823.git.jthumshirn@suse.de>
In-Reply-To: <cover.1476276823.git.jthumshirn@suse.de>

fc_destroy_bsgjob() and bsg_destroy_job() are now 1:1 copies, so use the
later.

Signed-off-by: Johannes Thumshirn <jthumshirn@suse.de>
---
 block/bsg-lib.c                  |  3 ++-
 drivers/scsi/scsi_transport_fc.c | 20 ++------------------
 include/linux/bsg-lib.h          |  1 +
 3 files changed, 5 insertions(+), 19 deletions(-)

diff --git a/block/bsg-lib.c b/block/bsg-lib.c
index 632fb40..6b99c7f 100644
--- a/block/bsg-lib.c
+++ b/block/bsg-lib.c
@@ -32,7 +32,7 @@
  * 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);
 
@@ -42,6 +42,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
diff --git a/drivers/scsi/scsi_transport_fc.c b/drivers/scsi/scsi_transport_fc.c
index a0e150a..4b9324f 100644
--- a/drivers/scsi/scsi_transport_fc.c
+++ b/drivers/scsi/scsi_transport_fc.c
@@ -30,6 +30,7 @@
 #include <linux/slab.h>
 #include <linux/delay.h>
 #include <linux/kernel.h>
+#include <linux/bsg-lib.h>
 #include <scsi/scsi_device.h>
 #include <scsi/scsi_host.h>
 #include <scsi/scsi_transport.h>
@@ -3554,23 +3555,6 @@ fc_vport_sched_delete(struct work_struct *work)
  * 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);
-
-	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
@@ -3640,7 +3624,7 @@ fc_bsg_job_timeout(struct request *req)
 		/* 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
-- 
1.8.5.6


  parent reply	other threads:[~2016-10-12 13:06 UTC|newest]

Thread overview: 90+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-10-12 13:06 [PATCH v2 00/16] Convert FibreChannel bsg code to use bsg-lib Johannes Thumshirn
2016-10-12 13:06 ` [PATCH v2 01/16] scsi: Get rid of struct fc_bsg_buffer Johannes Thumshirn
2016-10-13  9:01   ` Hannes Reinecke
2016-10-12 13:06 ` [PATCH v2 02/16] scsi: don't use fc_bsg_job::request and fc_bsg_job::reply directly Johannes Thumshirn
2016-10-12 13:06   ` Johannes Thumshirn
2016-10-13 11:25   ` Hannes Reinecke
2016-10-13 11:25     ` Hannes Reinecke
2016-10-13 11:25     ` Hannes Reinecke
2016-10-13 15:15   ` Steffen Maier
2016-10-13 15:15     ` Steffen Maier
2016-10-13 15:15     ` Steffen Maier
2016-10-13 16:24     ` Johannes Thumshirn
2016-10-13 16:24       ` Johannes Thumshirn
2016-10-13 16:24       ` Johannes Thumshirn
2016-10-28  9:53       ` Steffen Maier
2016-10-28  9:53         ` Steffen Maier
2016-10-28  9:53         ` Steffen Maier
2016-10-28 11:31         ` Hannes Reinecke
2016-10-28 11:31           ` Hannes Reinecke
2016-10-28 11:31           ` Hannes Reinecke
2016-10-28 13:53           ` Steffen Maier
2016-10-28 13:53             ` Steffen Maier
2016-10-28 13:53             ` Steffen Maier
2016-10-28 16:29             ` Andreas Krebbel1
2016-10-28 16:29               ` Andreas Krebbel1
2016-10-28 16:29               ` Andreas Krebbel1
2016-10-30 17:56         ` Johannes Thumshirn
2016-10-30 17:56           ` Johannes Thumshirn
2016-10-30 17:56           ` Johannes Thumshirn
2016-10-12 13:06 ` [PATCH v2 03/16] scsi: fc: Export fc_bsg_jobdone and use it in FC drivers Johannes Thumshirn
2016-10-12 13:06   ` Johannes Thumshirn
2016-10-13 11:27   ` Hannes Reinecke
2016-10-13 11:27     ` Hannes Reinecke
2016-10-13 11:27     ` Hannes Reinecke
2016-10-12 13:06 ` [PATCH v2 04/16] scsi: Unify interfaces of fc_bsg_jobdone and bsg_job_done Johannes Thumshirn
2016-10-12 13:06   ` Johannes Thumshirn
2016-10-13 11:33   ` Hannes Reinecke
2016-10-13 11:33     ` Hannes Reinecke
2016-10-13 11:33     ` Hannes Reinecke
2016-10-12 13:06 ` [PATCH v2 05/16] scsi: fc: provide fc_bsg_to_shost() helper Johannes Thumshirn
2016-10-12 13:06   ` Johannes Thumshirn
2016-10-13 11:34   ` Hannes Reinecke
2016-10-13 11:34     ` Hannes Reinecke
2016-10-13 11:34     ` Hannes Reinecke
2016-10-12 13:06 ` [PATCH v2 06/16] scsi: fc: provide fc_bsg_to_rport() helper Johannes Thumshirn
2016-10-12 13:06   ` Johannes Thumshirn
2016-10-13 11:34   ` Hannes Reinecke
2016-10-13 11:34     ` Hannes Reinecke
2016-10-13 11:34     ` Hannes Reinecke
2016-10-12 13:06 ` [PATCH v2 07/16] scsi: libfc: don't set FC_RQST_STATE_DONE before calling fc_bsg_jobdone() Johannes Thumshirn
2016-10-12 13:06   ` Johannes Thumshirn
2016-10-13 11:38   ` Hannes Reinecke
2016-10-13 11:38     ` Hannes Reinecke
2016-10-12 13:06 ` [PATCH v2 08/16] scsi: fc: implement kref backed reference counting Johannes Thumshirn
2016-10-13 11:42   ` Hannes Reinecke
2016-10-13 14:40     ` Johannes Thumshirn
2016-10-12 13:06 ` [PATCH v2 09/16] block: add reference counting for struct bsg_job Johannes Thumshirn
2016-10-12 13:06   ` Johannes Thumshirn
2016-10-13 11:43   ` Hannes Reinecke
2016-10-13 11:43     ` Hannes Reinecke
2016-10-12 13:06 ` [PATCH v2 10/16] scsi: change FC drivers to use 'struct bsg_job' Johannes Thumshirn
2016-10-12 13:06   ` Johannes Thumshirn
2016-10-13 11:44   ` Hannes Reinecke
2016-10-13 11:44     ` Hannes Reinecke
2016-10-13 11:44     ` Hannes Reinecke
2016-10-12 13:06 ` Johannes Thumshirn [this message]
2016-10-12 13:06   ` [PATCH v2 11/16] scsi: fc: Use bsg_destroy_job Johannes Thumshirn
2016-10-13 11:45   ` Hannes Reinecke
2016-10-13 11:45     ` Hannes Reinecke
2016-10-12 13:06 ` [PATCH v2 12/16] scsi: fc: use bsg_softirq_done Johannes Thumshirn
2016-10-12 13:06   ` Johannes Thumshirn
2016-10-13 11:45   ` Hannes Reinecke
2016-10-13 11:45     ` Hannes Reinecke
2016-10-12 13:06 ` [PATCH v2 13/16] scsi: fc: use bsg_job_done Johannes Thumshirn
2016-10-12 13:06   ` Johannes Thumshirn
2016-10-13 11:46   ` Hannes Reinecke
2016-10-13 11:46     ` Hannes Reinecke
2016-10-13 11:46     ` Hannes Reinecke
2016-10-12 13:06 ` [PATCH v2 14/16] block: add bsg_job_put() and bsg_job_get() Johannes Thumshirn
2016-10-12 13:06   ` Johannes Thumshirn
2016-10-13 11:47   ` Hannes Reinecke
2016-10-13 11:47     ` Hannes Reinecke
2016-10-12 13:06 ` [PATCH v2 15/16] scsi: fc: move FC transport's bsg code to bsg-lib Johannes Thumshirn
2016-10-13 11:49   ` Hannes Reinecke
2016-10-12 13:06 ` [PATCH v2 16/16] block: unexport bsg_softirq_done() again Johannes Thumshirn
2016-10-12 13:06   ` Johannes Thumshirn
2016-10-13 11:50   ` Hannes Reinecke
2016-10-13 11:50     ` Hannes Reinecke
2016-10-12 15:54 ` [PATCH v2 00/16] Convert FibreChannel bsg code to use bsg-lib Steffen Maier
2016-10-13  7:39   ` Johannes Thumshirn

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=7c7473dfa0f74f7bdf442d5669a57204ecf812e4.1476276823.git.jthumshirn@suse.de \
    --to=jthumshirn@suse.de \
    --cc=axboe@kernel.dk \
    --cc=hare@suse.de \
    --cc=hch@infradead.org \
    --cc=jejb@linux.vnet.ibm.com \
    --cc=linux-block@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-scsi@vger.kernel.org \
    --cc=martin.petersen@oracle.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.