[dm-devel] [PATCH] Add a set_era_counter config key to the dm-cache era policy shim

Joe Thornber thornber at redhat.com
Thu Nov 7 15:51:23 UTC 2013


On Wed, Nov 06, 2013 at 08:59:38PM +0000, Mears, Morgan wrote:
> Add the ability to set the era counter maintained by the dm-cache era
> policy shim to an arbitrary 32-bit value, to allow era rollback after
> the underlying device is restored from a snapshot.

I wonder if we should pass in the old value, and have the call fail if
the old value is incorrect.  This would allow applications to spot if
they were competing to set the era.  Some thing like:

     set_era_counter <old value>:<new value>

> +	era->era_counter = new_era_counter;
> +	smp_wmb();

Please stop using smp_rmb() and smp_wmb().  Every time I see it used I
find bugs (and this is no exception).  Use higher level locking
abstractions (eg, spin locks), and only optimise if we have a
performance issue.

In general alarm bells ring if you use one of smp_*() without the
other.  See linux/Documentation/memory-barriers.txt for lots of
discussion.

- Joe




More information about the dm-devel mailing list