From: Tomas Henzl <thenzl@redhat.com>
To: "'linux-scsi@vger.kernel.org'" <linux-scsi@vger.kernel.org>,
James Bottomley <jejb@kernel.org>
Cc: "Stephen M. Cameron" <scameron@beardog.cce.hp.com>,
stephenmcameron@gmail.com, mikem@beardog.cce.hp.com
Subject: Re: [PATCH 1/3] hpsa: remove unneeded loop
Date: Mon, 26 Aug 2013 12:57:38 +0200 [thread overview]
Message-ID: <521B34A2.9020003@redhat.com> (raw)
In-Reply-To: <51FA5E7A.9050000@redhat.com>
Hi James,
I've gotten mail that you have accepted patches 2/3 and 3/3 from this series.
This one has been accepted by Steve also, so please consider taking also this 1/3.
Thanks, Tomas
On 08/01/2013 03:11 PM, Tomas Henzl wrote:
> From: Tomas Henzl <thenzl@redhat.com>
>
> The cmd_pool_bits is protected everywhere with a spinlock,
> we don't need the test_and_set_bit, set_bit is enough and the loop
> can be removed too.
>
> Signed-off-by: Tomas Henzl <thenzl@redhat.com>
> ---
> drivers/scsi/hpsa.c | 15 ++++++---------
> 1 file changed, 6 insertions(+), 9 deletions(-)
>
> diff --git a/drivers/scsi/hpsa.c b/drivers/scsi/hpsa.c
> index 796482b..d7df01e 100644
> --- a/drivers/scsi/hpsa.c
> +++ b/drivers/scsi/hpsa.c
> @@ -2662,15 +2662,12 @@ static struct CommandList *cmd_alloc(struct ctlr_info *h)
> unsigned long flags;
>
> spin_lock_irqsave(&h->lock, flags);
> - do {
> - i = find_first_zero_bit(h->cmd_pool_bits, h->nr_cmds);
> - if (i == h->nr_cmds) {
> - spin_unlock_irqrestore(&h->lock, flags);
> - return NULL;
> - }
> - } while (test_and_set_bit
> - (i & (BITS_PER_LONG - 1),
> - h->cmd_pool_bits + (i / BITS_PER_LONG)) != 0);
> + i = find_first_zero_bit(h->cmd_pool_bits, h->nr_cmds);
> + if (i == h->nr_cmds) {
> + spin_unlock_irqrestore(&h->lock, flags);
> + return NULL;
> + }
> + set_bit(i & (BITS_PER_LONG - 1), h->cmd_pool_bits + (i / BITS_PER_LONG));
> h->nr_allocs++;
> spin_unlock_irqrestore(&h->lock, flags);
>
prev parent reply other threads:[~2013-08-26 10:58 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-08-01 13:11 [PATCH 1/3] hpsa: remove unneeded loop Tomas Henzl
2013-08-01 13:14 ` [PATCH 2/3] hpsa: fix a race in cmd_free/scsi_done Tomas Henzl
2013-08-01 13:46 ` scameron
2013-08-01 13:14 ` [PATCH 3/3] hpsa: remove unneeded variable Tomas Henzl
2013-08-01 13:48 ` scameron
2013-08-01 13:39 ` [PATCH 1/3] hpsa: remove unneeded loop scameron
2013-08-01 14:05 ` Tomas Henzl
2013-08-01 14:21 ` scameron
2013-08-01 14:59 ` Tomas Henzl
2013-08-01 15:19 ` scameron
2013-08-01 15:39 ` Tomas Henzl
2013-08-01 16:18 ` scameron
2013-08-02 11:13 ` Tomas Henzl
2013-08-06 15:46 ` scameron
2013-08-07 12:23 ` Tomas Henzl
2013-08-26 10:57 ` Tomas Henzl [this message]
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=521B34A2.9020003@redhat.com \
--to=thenzl@redhat.com \
--cc=jejb@kernel.org \
--cc=linux-scsi@vger.kernel.org \
--cc=mikem@beardog.cce.hp.com \
--cc=scameron@beardog.cce.hp.com \
--cc=stephenmcameron@gmail.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.