lkml.org 
[lkml]   [2016]   [Dec]   [14]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
Date
SubjectRe: [PATCH 5/8] dax: refactor locking out of size calculation routines
On Wed, Dec 14, 2016 at 7:01 AM, Johannes Thumshirn <jthumshirn@suse.de> wrote:
> Hi Dan,
>
> On Sat, Dec 10, 2016 at 10:28:51PM -0800, Dan Williams wrote:
>> In preparation for other callers of these routines make the locking the
>> responsibility of the caller.
>>
>> Signed-off-by: Dan Williams <dan.j.williams@intel.com>
>> ---
>> drivers/dax/dax.c | 30 ++++++++++++++++++++++++------
>> 1 file changed, 24 insertions(+), 6 deletions(-)
>>
>> diff --git a/drivers/dax/dax.c b/drivers/dax/dax.c
>> index d878a56cf3e3..5b65eaff6ace 100644
>> --- a/drivers/dax/dax.c
>> +++ b/drivers/dax/dax.c
>> @@ -90,11 +90,11 @@ static unsigned long long dax_region_avail_size(
>> unsigned long long size;
>> struct resource *res;
>>
>> - mutex_lock(&dax_region->lock);
>> + WARN_ON_ONCE(!mutex_is_locked(&dax_region->lock));
>
> I'd prefer it a lockdep_assert_held(&dex_region->lock). This of cause has the
> drawback that it won't trigger w/o lockdep but enabled, but I don't think it's
> the responibility of a production kernel to have this warnings anyway. On the
> flip side you get all the lockdep beauty for free with it.

True, yes, it's only a developer debug warning. I'll change it and fix
up the other pattern like this in libnvdimm.

\
 
 \ /
  Last update: 2016-12-14 17:06    [W:0.073 / U:0.188 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site