From: scameron@beardog.cce.hp.com
To: Akinobu Mita <akinobu.mita@gmail.com>
Cc: linux-kernel@vger.kernel.org, akpm@linux-foundation.org,
iss_storagedev@hp.com,
"James E.J. Bottomley" <JBottomley@parallels.com>,
linux-scsi@vger.kernel.org, scameron@beardog.cce.hp.com
Subject: Re: [PATCH] hpsa: use find_first_zero_bit
Date: Fri, 20 Jan 2012 09:41:36 -0600 [thread overview]
Message-ID: <20120120154136.GH21002@beardog.cce.hp.com> (raw)
In-Reply-To: <1327072528-8479-5-git-send-email-akinobu.mita@gmail.com>
On Sat, Jan 21, 2012 at 12:15:27AM +0900, Akinobu Mita wrote:
> Use find_first_zero_bit to find the first cleared bit in a memory region.
>
> This also includes the following minor changes.
> - Use bitmap_zero
> - Reduce unnecessary atomic bitops usage
Ack.
This isn't performance sensitive code though, hpsa_find_target_lun()
only gets called during device discovery when a multi-lun device
like a tape drive with an auto changer is encountered.
I tried it out and it doesn't conflict with any of the patches
I sent up yesterday, and it works with a tape drive/autochanger.
-- steve
>
> Signed-off-by: Akinobu Mita <akinobu.mita@gmail.com>
> Cc: "Stephen M. Cameron" <scameron@beardog.cce.hp.com>
> Cc: iss_storagedev@hp.com
> Cc: "James E.J. Bottomley" <JBottomley@parallels.com>
> Cc: linux-scsi@vger.kernel.org
> ---
> drivers/scsi/hpsa.c | 18 ++++++++----------
> 1 files changed, 8 insertions(+), 10 deletions(-)
>
> diff --git a/drivers/scsi/hpsa.c b/drivers/scsi/hpsa.c
> index 7d14443..7f79ed8 100644
> --- a/drivers/scsi/hpsa.c
> +++ b/drivers/scsi/hpsa.c
> @@ -577,21 +577,19 @@ static int hpsa_find_target_lun(struct ctlr_info *h,
> int i, found = 0;
> DECLARE_BITMAP(lun_taken, HPSA_MAX_DEVICES);
>
> - memset(&lun_taken[0], 0, HPSA_MAX_DEVICES >> 3);
> + bitmap_zero(lun_taken, HPSA_MAX_DEVICES);
>
> for (i = 0; i < h->ndevices; i++) {
> if (h->dev[i]->bus == bus && h->dev[i]->target != -1)
> - set_bit(h->dev[i]->target, lun_taken);
> + __set_bit(h->dev[i]->target, lun_taken);
> }
>
> - for (i = 0; i < HPSA_MAX_DEVICES; i++) {
> - if (!test_bit(i, lun_taken)) {
> - /* *bus = 1; */
> - *target = i;
> - *lun = 0;
> - found = 1;
> - break;
> - }
> + i = find_first_zero_bit(lun_taken, HPSA_MAX_DEVICES);
> + if (i < HPSA_MAX_DEVICES) {
> + /* *bus = 1; */
> + *target = i;
> + *lun = 0;
> + found = 1;
> }
> return !found;
> }
> --
> 1.7.4.4
next prev parent reply other threads:[~2012-01-20 15:41 UTC|newest]
Thread overview: 26+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-01-20 15:15 [PATCH] percpu: use bitmap_clear Akinobu Mita
2012-01-20 15:15 ` [Ocfs2-devel] [PATCH] ocfs2: use find_last_bit Akinobu Mita
2012-01-20 15:15 ` Akinobu Mita
2012-01-20 15:15 ` [PATCH] ocfs2: use bitmap_weight() Akinobu Mita
2012-01-20 15:15 ` [Ocfs2-devel] " Akinobu Mita
2012-01-20 15:15 ` [PATCH] xen-blkfront: use bitmap_set() and bitmap_clear() Akinobu Mita
2012-01-20 15:15 ` Akinobu Mita
2012-01-20 15:27 ` Akinobu Mita
2012-01-20 15:27 ` Akinobu Mita
2012-01-20 15:28 ` Konrad Rzeszutek Wilk
2012-01-20 15:28 ` Konrad Rzeszutek Wilk
2012-01-20 15:41 ` Akinobu Mita
2012-01-20 15:41 ` Akinobu Mita
2012-01-20 16:09 ` Konrad Rzeszutek Wilk
2012-01-20 16:09 ` Konrad Rzeszutek Wilk
2012-01-20 23:11 ` Andrew Morton
2012-01-20 23:11 ` Andrew Morton
2012-01-20 23:55 ` Konrad Rzeszutek Wilk
2012-01-20 23:55 ` Konrad Rzeszutek Wilk
2012-01-21 0:04 ` Andrew Morton
2012-01-21 0:04 ` Andrew Morton
2012-01-20 15:15 ` [PATCH] hpsa: use find_first_zero_bit Akinobu Mita
2012-01-20 15:41 ` scameron [this message]
2012-01-20 15:15 ` [PATCH] sysctl: use bitmap library functions Akinobu Mita
2012-01-20 15:19 ` [PATCH] percpu: use bitmap_clear Christoph Lameter
2012-01-20 17:24 ` Tejun Heo
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=20120120154136.GH21002@beardog.cce.hp.com \
--to=scameron@beardog.cce.hp.com \
--cc=JBottomley@parallels.com \
--cc=akinobu.mita@gmail.com \
--cc=akpm@linux-foundation.org \
--cc=iss_storagedev@hp.com \
--cc=linux-kernel@vger.kernel.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.