From: Al Viro <viro@ZenIV.linux.org.uk>
To: Linus Torvalds <torvalds@linux-foundation.org>
Cc: linux-fsdevel@vger.kernel.org,
Tetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp>
Subject: [PATCH] fix __swap_writepage() compile failure on old gcc versions
Date: Sat, 14 Jun 2014 07:12:41 +0100 [thread overview]
Message-ID: <20140614061241.GJ18016@ZenIV.linux.org.uk> (raw)
In-Reply-To: <20140613144843.GH18016@ZenIV.linux.org.uk>
On Fri, Jun 13, 2014 at 03:48:43PM +0100, Al Viro wrote:
> On Fri, Jun 13, 2014 at 09:03:36PM +0900, Tetsuo Handa wrote:
> > >From 75b9f78ddc8ab30555a520f5a2477a9340341dd1 Mon Sep 17 00:00:00 2001
> > From: Tetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp>
> > Date: Fri, 13 Jun 2014 12:35:35 +0900
> > Subject: [PATCH pre 3.16-rc1] bio: Fix build failure.
> >
> > Commit 62a8067a7f "bio_vec-backed iov_iter" introduced an unnamed union
> > inside a struct which gcc-4.4.7 cannot handle. Name the unnamed union as
> > u in order to fix build failure.
>
> Sigh... Oh, well - it will be a while until we can use them (anon union
> and struct members are valid C11; it's not just gccism). Applied, will
> push to Linus today if he hasn't picked that one up himself.
Let's do this instead: there is only one place in the entire tree that
steps into this breakage. Anon structs and unions work in older gcc
versions; as the matter of fact, we have those in the tree - see e.g.
struct ieee80211_tx_info in include/net/mac80211.h
What doesn't work is handling their initializers:
struct {
int a;
union {
int b;
char c;
};
} x[2] = {{.a = 1, .c = 'a'}, {.a = 0, .b = 1}};
is the obvious syntax for initializer, perfectly fine for C11 and handled
correctly by gcc-4.7 or later. Earlier versions, though, break on it -
declaration is fine and so's access to fields (i.e. x[0].c = 'a'; would
produce the right code), but members of the anon structs and unions are
not inserted into the right namespace. Tellingly, those older versions
will not barf on struct {int a; struct {int a;};}; - looks like they
just have it hacked up somewhere around the handling of . and -> instead
of doing the right thing.
The easiest way to deal with that crap is to turn initialization of those
fields (in the only place where we have such initializer of iov_iter)
into plain assignment.
Spotted-by: Tetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp>
Spotted-by: Russell King <rmk+kernel@arm.linux.org.uk>
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
---
diff --git a/mm/page_io.c b/mm/page_io.c
index 33bb38c..fe24f78 100644
--- a/mm/page_io.c
+++ b/mm/page_io.c
@@ -269,8 +269,8 @@ int __swap_writepage(struct page *page, struct writeback_control *wbc,
.count = PAGE_SIZE,
.iov_offset = 0,
.nr_segs = 1,
- .bvec = &bv
};
+ from.bvec = &bv; /* older gcc versions are broken */
init_sync_kiocb(&kiocb, swap_file);
kiocb.ki_pos = page_file_offset(page);
next prev parent reply other threads:[~2014-06-14 6:12 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-06-13 12:03 [PATCH pre 3.16-rc1] bio: Fix build failure Tetsuo Handa
2014-06-13 14:34 ` Chris Mason
2014-06-13 14:48 ` Al Viro
2014-06-14 6:12 ` Al Viro [this message]
2014-06-15 1:33 ` [PATCH] fix __swap_writepage() compile failure on old gcc versions Tetsuo Handa
2014-06-16 17:55 ` Chris Mason
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=20140614061241.GJ18016@ZenIV.linux.org.uk \
--to=viro@zeniv.linux.org.uk \
--cc=linux-fsdevel@vger.kernel.org \
--cc=penguin-kernel@I-love.SAKURA.ne.jp \
--cc=torvalds@linux-foundation.org \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.