From: "Matias Bjørling" <mb@lightnvm.io>
To: Wenwei Tao <ww.tao0320@gmail.com>
Cc: linux-kernel@vger.kernel.org, linux-block@vger.kernel.org
Subject: Re: [PATCH] lightnvm: missing nvm_lock acquire
Date: Wed, 25 Nov 2015 15:27:38 +0100 [thread overview]
Message-ID: <5655C55A.8040001@lightnvm.io> (raw)
In-Reply-To: <CACygaLCKZgn=VzAd6NMoAix-RXTMJ_bKUC9A8uwtLZVJST_fwQ@mail.gmail.com>
On 11/25/2015 03:18 PM, Wenwei Tao wrote:
> Or we can add a new function
>
> static struct nvm_dev *nvm_find_nvm_dev_locked(const char *name)
> {
> struct nvm_dev *dev;
>
> + down_write(&nvm_lock);
> list_for_each_entry(dev, &nvm_devices, devices)
> if (!strcmp(name, dev->name))
> return dev;
> + up_write(&nvm_lock);
>
> return NULL;
> }
>
> use nvm_find_nvm_dev_locked() and nvm_find_nvm_dev() properly.
>
That could also work. Let's go with your original solution. I don't like
it completely, but on the other hand. The other iterators build up to
the locks in that way. So making a special case for the nvm_find_nvm_dev
properly makes the code harder to understand.
prev parent reply other threads:[~2015-11-25 14:27 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-11-24 15:24 [PATCH] lightnvm: missing nvm_lock acquire Wenwei Tao
2015-11-24 15:35 ` kbuild test robot
2015-11-24 18:36 ` Matias
2015-11-25 8:57 ` Wenwei Tao
2015-11-25 11:24 ` Matias Bjørling
2015-11-25 11:37 ` Matias Bjørling
2015-11-25 13:11 ` Wenwei Tao
2015-11-25 14:18 ` Wenwei Tao
2015-11-25 14:27 ` Matias Bjørling [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=5655C55A.8040001@lightnvm.io \
--to=mb@lightnvm.io \
--cc=linux-block@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=ww.tao0320@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.