diff options
author | Al Viro <viro@ZenIV.linux.org.uk> | 2014-06-14 07:12:41 +0100 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2014-06-14 19:30:48 -0500 |
commit | 05064084e82d057f8d74590c51581650e060fbb8 (patch) | |
tree | 66909b371686d3959fa14f34cc11c78aceb35029 | |
parent | 4a54e5e517cdc0044c9c9542e53736500a9391dc (diff) |
fix __swap_writepage() compile failure on old gcc versions
Tetsuo Handa wrote:
"Commit 62a8067a7f35 ("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"
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.
Reported-by: Tetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp>
Reported-by: Russell King <rmk+kernel@arm.linux.org.uk>
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
-rw-r--r-- | mm/page_io.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/mm/page_io.c b/mm/page_io.c index 243a9b76e5ce..955db8b0d497 100644 --- a/mm/page_io.c +++ b/mm/page_io.c @@ -274,8 +274,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); |