All of lore.kernel.org
 help / color / mirror / Atom feed
From: Christoph Hellwig <hch@infradead.org>
To: James Bottomley <James.Bottomley@HansenPartnership.com>
Cc: linux-scsi@vger.kernel.org, Bart Van Assche <bvanassche@acm.org>
Subject: [PATCH 5/6] scsi: remove a useless get/put_device pair in scsi_next_command
Date: Thu, 06 Feb 2014 10:43:11 -0800	[thread overview]
Message-ID: <20140206184418.063744285@bombadil.infradead.org> (raw)
In-Reply-To: 20140206184306.997538898@bombadil.infradead.org

[-- Attachment #1: 0005-scsi-remove-a-useless-get-put_device-pair-in-scsi_ne.patch --]
[-- Type: text/plain, Size: 1008 bytes --]

From: Bart Van Assche <bvanassche@acm.org>

Eliminate a get_device() / put_device() pair from scsi_next_command().
Both are atomic operations hence removing these slightly improves
performance.

[hch: slight changes due to different context]

Signed-off-by: Bart Van Assche <bvanassche@acm.org>
Signed-off-by: Christoph Hellwig <hch@lst.de>
---
 drivers/scsi/scsi_lib.c |    5 -----
 1 file changed, 5 deletions(-)

diff --git a/drivers/scsi/scsi_lib.c b/drivers/scsi/scsi_lib.c
index 7d35678..91ca414 100644
--- a/drivers/scsi/scsi_lib.c
+++ b/drivers/scsi/scsi_lib.c
@@ -526,14 +526,9 @@ void scsi_next_command(struct scsi_cmnd *cmd)
 	struct scsi_device *sdev = cmd->device;
 	struct request_queue *q = sdev->request_queue;
 
-	/* need to hold a reference on the device before we let go of the cmd */
-	get_device(&sdev->sdev_gendev);
-
 	scsi_put_command(cmd);
-	put_device(&sdev->sdev_gendev);
 	scsi_run_queue(q);
 
-	/* ok to remove device now */
 	put_device(&sdev->sdev_gendev);
 }
 
-- 
1.7.10.4



  parent reply	other threads:[~2014-02-06 18:44 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-02-06 18:43 [PATCH 0/6] first batch of SCSI data path micro-optimizations Christoph Hellwig
2014-02-06 18:43 ` [PATCH 1/6] scsi: avoid useless free_list lock roundtrips Christoph Hellwig
2014-02-12 10:53   ` Hannes Reinecke
2014-02-06 18:43 ` [PATCH 2/6] scsi: avoid taking host_lock in scsi_run_queue unless nessecary Christoph Hellwig
2014-02-12 11:08   ` Hannes Reinecke
2014-02-12 15:52     ` Christoph Hellwig
2014-02-06 18:43 ` [PATCH 3/6] scsi: do not manipulate device reference counts in scsi_get/put_command Christoph Hellwig
2014-02-12 11:37   ` Hannes Reinecke
2014-02-12 15:58     ` Christoph Hellwig
2014-02-06 18:43 ` [PATCH 4/6] scsi: remove a useless get/put_device pair in scsi_request_fn Christoph Hellwig
2014-02-12 11:38   ` Hannes Reinecke
2014-02-06 18:43 ` Christoph Hellwig [this message]
2014-02-12 11:39   ` [PATCH 5/6] scsi: remove a useless get/put_device pair in scsi_next_command Hannes Reinecke
2014-02-06 18:43 ` [PATCH 6/6] scsi: remove a useless get/put_device pair in scsi_requeue_command Christoph Hellwig
2014-02-12 11:40   ` Hannes Reinecke
2014-02-12 15:58     ` Christoph Hellwig

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=20140206184418.063744285@bombadil.infradead.org \
    --to=hch@infradead.org \
    --cc=James.Bottomley@HansenPartnership.com \
    --cc=bvanassche@acm.org \
    --cc=linux-scsi@vger.kernel.org \
    /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.