Browse Source

ceph: pass proper page offset to copy_page_to_iter()

Signed-off-by: Yan, Zheng <zheng.z.yan@intel.com>
Yan, Zheng 11 years ago
parent
commit
5aaa432ad9
1 changed files with 5 additions and 2 deletions
  1. 5 2
      fs/ceph/file.c

+ 5 - 2
fs/ceph/file.c

@@ -470,8 +470,11 @@ static ssize_t ceph_sync_read(struct kiocb *iocb, struct iov_iter *i,
 			size_t left = ret;
 			size_t left = ret;
 
 
 			while (left) {
 			while (left) {
-				int copy = min_t(size_t, PAGE_SIZE, left);
-				l = copy_page_to_iter(pages[k++], 0, copy, i);
+				size_t page_off = off & ~PAGE_MASK;
+				size_t copy = min_t(size_t,
+						    PAGE_SIZE - page_off, left);
+				l = copy_page_to_iter(pages[k++], page_off,
+						      copy, i);
 				off += l;
 				off += l;
 				left -= l;
 				left -= l;
 				if (l < copy)
 				if (l < copy)