Commit b5c8a738 authored by Neil Brown's avatar Neil Brown Committed by Linus Torvalds

[PATCH] Make ITERATE_MDDEV work on non-SMP

For an SMP kernel, spin_lock() et.al. are functions.
For a UP kernel, they are statements that must be terminated
by a ';'.  This is not quite the same thing, and hence spin_lock()
cannot be using inside a parenthesised expession.

This patch changes ITERATE_MDDEV to use gcc's "statement expressions"
instead which has the benefit of making the conditionals
more readable.
parent 6da79789
......@@ -144,17 +144,17 @@ static spinlock_t all_mddevs_lock = SPIN_LOCK_UNLOCKED;
*/
#define ITERATE_MDDEV(mddev,tmp) \
\
for (spin_lock(&all_mddevs_lock), \
(tmp = all_mddevs.next), \
(mddev = NULL); \
(void)(tmp != &all_mddevs && \
mddev_get(list_entry(tmp, mddev_t, all_mddevs))),\
spin_unlock(&all_mddevs_lock), \
(mddev ? mddev_put(mddev):(void)NULL), \
(mddev = list_entry(tmp, mddev_t, all_mddevs)), \
(tmp != &all_mddevs); \
spin_lock(&all_mddevs_lock), \
(tmp = tmp->next) \
for (({ spin_lock(&all_mddevs_lock); \
tmp = all_mddevs.next; \
mddev = NULL;}); \
({ if (tmp != &all_mddevs) \
mddev_get(list_entry(tmp, mddev_t, all_mddevs));\
spin_unlock(&all_mddevs_lock); \
if (mddev) mddev_put(mddev); \
mddev = list_entry(tmp, mddev_t, all_mddevs); \
tmp != &all_mddevs;}); \
({ spin_lock(&all_mddevs_lock); \
tmp = tmp->next;}) \
)
static mddev_t *mddev_map[MAX_MD_DEVS];
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment