Skip to contentSkip to conversation

"bio_vec-backed iov_iter" breaks gcc 4.6.4

BUG Russell King - ARM Linux 1 participant 1 message Jun 13, 2014

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

Commit 62a8067a7f35dba2de501c9cb00e4cf36da90bc0 has broken the build with gcc 4.6.4:

include/linux/uio.h +0 -0

struct iov_iter {
...
+ union {
+ const struct iovec *iov;
+ const struct bio_vec *bvec;
+ };
...

mm/page_io.c +0 -0

...
+ 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(-)
mm/page_io.c +4 -2
index 243a9b76e5ce..e9a2a0aca8ea 100644
@@ -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);
Signature · 2 lines
FTTC broadband for 0.8mile line: now at 9.7Mbps down 460kbps up... slowly
improving, and getting towards what was expected from it.