From: Neil Brown <neilb@cse.unsw.edu.au>
To: Linus Torvalds <torvalds@transmeta.com>
Cc: linux-raid@vger.kernel.org, Reuben Farrelly <reuben@reub.net>
Subject: PATCH - md 3 of 3 - Make ITERATE_MDDEV work on non-SMP
Date: Thu, 20 Jun 2002 10:07:12 +1000 (EST) [thread overview]
Message-ID: <15633.7344.603781.403606@notabene.cse.unsw.edu.au> (raw)
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.
----------- Diffstat output ------------
./drivers/md/md.c | 22 +++++++++++-----------
1 files changed, 11 insertions(+), 11 deletions(-)
--- ./drivers/md/md.c 2002/06/19 23:29:01 1.3
+++ ./drivers/md/md.c 2002/06/19 23:53:56 1.4
@@ -144,17 +144,17 @@
*/
#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];
reply other threads:[~2002-06-20 0:07 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=15633.7344.603781.403606@notabene.cse.unsw.edu.au \
--to=neilb@cse.unsw.edu.au \
--cc=linux-raid@vger.kernel.org \
--cc=reuben@reub.net \
--cc=torvalds@transmeta.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).