Re: [PATCH 1/5] locking: Introduce range reader/writer lock

From: Davidlohr Bueso
Date: Tue Mar 28 2017 - 12:39:59 EST


On Tue, 28 Mar 2017, Laurent Dufour wrote:
+#define __RANGE_RWLOCK_INITIALIZER(start, last) { \
+ .node = { \
+ .start = (start) \
+ ,.last = (last) \
+ } \
+ }

Hi Davidlohr,

This macro doesn't expand correctly because the field name ".start" is
replaced by the start parameter. Should rather be :

#define __RANGE_RWLOCK_INITIALIZER(__start, __last) { \
.node = { \
.start = (__start) \
,.last = (__last) \
} \
}

By the way, should the other fields set as in __range_rwlock_init() ?

Indeed.

+/*
+ * lock for writing
+ */
+void range_write_lock(struct range_rwlock_tree *tree, struct range_rwlock *lock);
+int range_write_lock_interruptible(struct range_rwlock_tree *tree,
+ struct range_rwlock *lock);
+int range_write_lock_killable(struct range_rwlock_tree *tree,
+ struct range_rwlock *lock);
+int range_read_trylock(struct range_rwlock_tree *tree, struct range_rwlock *lock);
^^^^
range_write_trylock(...) isn't it ?


Duh, yeah.

I'll wait to see if there are any more concerns and send a v2 with your corrections.

Thanks,
Davidlohr