Subject: Build failure after merge of ceph tree

From: Mark Brown <[email-masked]>
Date: Thu, 3 Oct 2013 13:09:57 +0100

After merging the ceph tree into -next an x86 allmodconfig build fails
with:

fs/ceph/file.c: In function ‘ceph_sync_read’:
fs/ceph/file.c:437:25: error: ‘struct iov_iter’ has no member named ‘iov’
    void __user *data = i->iov[0].iov_base + i->iov_offset;
                         ^
fs/ceph/file.c:438:18: error: ‘struct iov_iter’ has no member named ‘iov’
    size_t len = i->iov[0].iov_len - i->iov_offset;
                  ^
fs/ceph/file.c:470:26: error: ‘struct iov_iter’ has no member named ‘iov’
     void __user *data = i->iov[0].iov_base
                          ^
In file included from include/linux/cache.h:4:0,
                 from include/linux/time.h:4,
                 from include/linux/stat.h:18,
                 from include/linux/module.h:10,
                 from fs/ceph/file.c:3:
fs/ceph/file.c:472:14: error: ‘struct iov_iter’ has no member named ‘iov’
     l = min(i->iov[0].iov_len - i->iov_offset,
              ^
include/linux/kernel.h:670:9: note: in definition of macro ‘min’
  typeof(x) _min1 = (x);   \
         ^
fs/ceph/file.c:472:14: error: ‘struct iov_iter’ has no member named ‘iov’
     l = min(i->iov[0].iov_len - i->iov_offset,
              ^
include/linux/kernel.h:670:21: note: in definition of macro ‘min’
  typeof(x) _min1 = (x);   \
                     ^
include/linux/kernel.h:672:17: warning: comparison of distinct pointer types lacks a cast [enabled by default]
  (void) (&_min1 == &_min2);  \
                 ^
fs/ceph/file.c:472:9: note: in expansion of macro ‘min’
     l = min(i->iov[0].iov_len - i->iov_offset,
         ^
fs/ceph/file.c: In function ‘ceph_sync_direct_write’:
fs/ceph/file.c:586:24: error: ‘struct iov_iter’ has no member named ‘iov’
   void __user *data = i.iov->iov_base + i.iov_offset;
                        ^
fs/ceph/file.c:587:14: error: ‘struct iov_iter’ has no member named ‘iov’
   u64 len = i.iov->iov_len - i.iov_offset;
              ^
make[2]: *** [fs/ceph/file.o] Error 1
make[2]: *** Waiting for unfinished jobs....
make[1]: *** [fs/ceph] Error 2

caused by commits 53d028160 (ceph: implement readv/preadv for sync
operation) and 2f0a7a180 (ceph: Implement writev/pwritev for sync
operation) interacting with commit f6794d33a5ec ("iov_iter: hide iovec
details behind ops function pointers") from the aio-direct tree.

I extended Stephen's previous fix to this:

From 577435f0a97e67b735f355aef0ef55732814818c Mon Sep 17 00:00:00 2001
From: Mark Brown <[email-masked]>
Date: Thu, 3 Oct 2013 13:05:20 +0100
Subject: [PATCH] ceph: Fix up for iov_iter changes

Extend an earlier fixup by Stephen Rothwell.

Signed-off-by: Mark Brown <[email-masked]>
---
 fs/ceph/file.c | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/fs/ceph/file.c b/fs/ceph/file.c
index c4419e8..37b5b5c 100644
--- a/fs/ceph/file.c
+++ b/fs/ceph/file.c
@@ -434,8 +434,8 @@ static ssize_t ceph_sync_read(struct kiocb *iocb, struct iov_iter *i,
 
 	if (file->f_flags & O_DIRECT) {
 		while (iov_iter_count(i)) {
-			void __user *data = i->iov[0].iov_base + i->iov_offset;
-			size_t len = i->iov[0].iov_len - i->iov_offset;
+			void __user *data = iov_iter_iovec(i)->iov_base + i->iov_offset;
+			size_t len = iov_iter_iovec(i)->iov_len - i->iov_offset;
 
 			num_pages = calc_pages_for((unsigned long)data, len);
 			pages = ceph_get_direct_page_vector(data,
@@ -467,9 +467,9 @@ static ssize_t ceph_sync_read(struct kiocb *iocb, struct iov_iter *i,
 			size_t left = len = ret;
 
 			while (left) {
-				void __user *data = i->iov[0].iov_base
+				void __user *data = iov_iter_iovec(i)->iov_base
 							+ i->iov_offset;
-				l = min(i->iov[0].iov_len - i->iov_offset,
+				l = min(iov_iter_iovec(i)->iov_len - i->iov_offset,
 					left);
 
 				ret = ceph_copy_page_vector_to_user(&pages[k],
@@ -583,8 +583,8 @@ ceph_sync_direct_write(struct kiocb *iocb, const struct iovec *iov,
 	iov_iter_init(&i, iov, nr_segs, count, 0);
 
 	while (iov_iter_count(&i) > 0) {
-		void __user *data = i.iov->iov_base + i.iov_offset;
-		u64 len = i.iov->iov_len - i.iov_offset;
+		void __user *data = iov_iter_iovec(&i)->iov_base + i.iov_offset;
+		u64 len = iov_iter_iovec(&i)->iov_len - i.iov_offset;
 
 		page_align = (unsigned long)data & ~PAGE_MASK;
 
-- 
1.8.4.rc3