[dm-devel] [PATCHES]: dm lock optimization

Mikulas Patocka mpatocka at redhat.com
Wed May 2 00:03:35 UTC 2012



On Mon, 23 Apr 2012, Joe Thornber wrote:

> On Wed, Apr 18, 2012 at 11:03:33PM -0400, Mikulas Patocka wrote:
> > Hi
> > 
> > I placed dm lock optimization patches here
> > 
> > http://people.redhat.com/mpatocka/patches/kernel/dm-lock-optimization/
> 
> Just a heads up that sparse gives some warnings with these patches:
> 
> drivers/md/dm.c:689:24: warning: context imbalance in 'dm_get_live_table_fast' - wrong count at exit
> drivers/md/dm.c:695:13: warning: context imbalance in 'dm_put_live_table_fast' - unexpected unlock
> drivers/md/dm.c:1789:17: warning: context imbalance in 'dm_request_fn' - unexpected unlock
> 
> - Joe

I couldn't figure out how to shut up sparse warnings. For RCU you can mark 
functions that take/release RCU with __acquires(RCU)/__releases(RCU), but 
I didn't find out how to do it for SRCU.

If I use "__acquires(&md->io_barrier)"
struct dm_table *dm_get_live_table(struct mapped_device *md, int 
*srcu_idx) __acquires(&md->io_barrier)
{
        *srcu_idx = srcu_read_lock(&md->io_barrier);
        return rcu_dereference(md->map);
}
it doens't work and I get an error:
drivers/md/dm.c:557:9: warning: context imbalance in 'dm_get_live_table': 
unexpected unlock
drivers/md/dm.c:557:9:    default context: wanted 1, got 0

Maybe it is a bug in sparse, maybe I am using a wrong tag? Is there a 
reference of all sparse tags somewhere?

Mikulas




More information about the dm-devel mailing list