All of lore.kernel.org
 help / color / mirror / Atom feed
* [BUG] "bio_vec-backed iov_iter" breaks gcc 4.6.4
@ 2014-06-13 17:19 Russell King - ARM Linux
  0 siblings, 0 replies; only message in thread
From: Russell King - ARM Linux @ 2014-06-13 17:19 UTC (permalink / raw)
  To: Al Viro; +Cc: linux-kernel

Commit 62a8067a7f35dba2de501c9cb00e4cf36da90bc0 has broken the build
with gcc 4.6.4:

diff --git a/include/linux/uio.h b/include/linux/uio.h
 struct iov_iter {
...
+       union {
+               const struct iovec *iov;
+               const struct bio_vec *bvec;
+       };
...
diff --git a/mm/page_io.c b/mm/page_io.c
...
+               struct iov_iter from = {
...
+                       .bvec = &bv

mm/page_io.c: In function '__swap_writepage':
mm/page_io.c:277:4: error: unknown field 'bvec' specified in initializer
mm/page_io.c:278:3: warning: excess elements in struct initializer
mm/page_io.c:278:3: warning: (near initialization for 'from')
make[2]: *** [mm/page_io.o] Error 1

The problem here is that only relatively recent gcc's are able to deal
with anonymous union/struct initialisers.

Documentation wise, we're telling people that the minimum version of GCC
required to build the kernel is:

o  Gnu C                  3.2                     # gcc --version

The patch below fixes it for me - but it's not ideal because the only
reason it works is that we have the initialisers in the same order as
the structure.

Any suggestions?

 mm/page_io.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/mm/page_io.c b/mm/page_io.c
index 243a9b76e5ce..e9a2a0aca8ea 100644
--- a/mm/page_io.c
+++ b/mm/page_io.c
@@ -271,10 +271,12 @@ int __swap_writepage(struct page *page, struct writeback_control *wbc,
 		};
 		struct iov_iter from = {
 			.type = ITER_BVEC | WRITE,
-			.count = PAGE_SIZE,
 			.iov_offset = 0,
+			.count = PAGE_SIZE,
+			{
+				.bvec = &bv
+			},
 			.nr_segs = 1,
-			.bvec = &bv
 		};
 
 		init_sync_kiocb(&kiocb, swap_file);


-- 
FTTC broadband for 0.8mile line: now at 9.7Mbps down 460kbps up... slowly
improving, and getting towards what was expected from it.

^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2014-06-13 17:19 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-06-13 17:19 [BUG] "bio_vec-backed iov_iter" breaks gcc 4.6.4 Russell King - ARM Linux

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.