[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <5655C55A.8040001@lightnvm.io>
Date: Wed, 25 Nov 2015 15:27:38 +0100
From: Matias Bjørling <mb@...htnvm.io>
To: Wenwei Tao <ww.tao0320@...il.com>
CC: linux-kernel@...r.kernel.org, linux-block@...r.kernel.org
Subject: Re: [PATCH] lightnvm: missing nvm_lock acquire
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.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists