From: Christoph Hellwig <hch@infradead.org>
To: Lee Duncan <lduncan@suse.com>
Cc: linux-scsi@vger.kernel.org, JBottomley@Parallels.com,
hare@suse.com, jthumshirn@suse.de
Subject: Re: [PATCHv3] Update scsi host to use ida for host number
Date: Tue, 1 Sep 2015 23:48:30 -0700 [thread overview]
Message-ID: <20150902064830.GA17978@infradead.org> (raw)
In-Reply-To: <1441152208-20634-1-git-send-email-lduncan@suse.com>
On Tue, Sep 01, 2015 at 05:03:28PM -0700, Lee Duncan wrote:
> +static int host_get_index(int *index)
> +{
> + int error = -ENOMEM;
> +
> + do {
> + if (!ida_pre_get(&host_index_ida, GFP_KERNEL))
> + break;
> + spin_lock(&host_index_lock);
> + error = ida_get_new(&host_index_ida, index);
> + spin_unlock(&host_index_lock);
> + } while (error == -EAGAIN);
> +
> + return error;
> +}
> +
> +static inline void host_put_index(int index)
> +{
> + spin_lock(&host_index_lock);
> + ida_remove(&host_index_ida, index);
> + spin_unlock(&host_index_lock);
> +}
I really hate how this pattern (and the equivalent for IDA) are
spread all over. Any chance to have some simple_ida/simple_idr helpers
instead of duplicating it again an again.
Besides that why aren't we using and idr here and use it for host lookup
as well?
next prev parent reply other threads:[~2015-09-02 6:48 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-09-02 0:03 [PATCHv3] Update scsi host to use ida for host number Lee Duncan
2015-09-02 6:48 ` Christoph Hellwig [this message]
2015-09-03 16:06 ` Lee Duncan
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=20150902064830.GA17978@infradead.org \
--to=hch@infradead.org \
--cc=JBottomley@Parallels.com \
--cc=hare@suse.com \
--cc=jthumshirn@suse.de \
--cc=lduncan@suse.com \
--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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).