diff options
author | Al Viro <viro@zeniv.linux.org.uk> | 2015-10-08 17:43:58 -0400 |
---|---|---|
committer | Mike Marshall <hubcap@omnibond.com> | 2015-11-13 10:25:01 -0500 |
commit | 5c278228bbfe3abb7d468ef39dffac23de15c078 (patch) | |
tree | 5bd9b8107ed919e9b4298f2d1632d4ef33e3481e /fs/orangefs/pvfs2-bufmap.c | |
parent | 548049495cb46348866aec1cb7721e9d00b4eb83 (diff) | |
download | lwn-5c278228bbfe3abb7d468ef39dffac23de15c078.tar.gz lwn-5c278228bbfe3abb7d468ef39dffac23de15c078.zip |
orangefs: explicitly pass the size to pvfs_bufmap_copy_to_iovec()
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Signed-off-by: Mike Marshall <hubcap@omnibond.com>
Diffstat (limited to 'fs/orangefs/pvfs2-bufmap.c')
-rw-r--r-- | fs/orangefs/pvfs2-bufmap.c | 29 |
1 files changed, 15 insertions, 14 deletions
diff --git a/fs/orangefs/pvfs2-bufmap.c b/fs/orangefs/pvfs2-bufmap.c index 9d0392a3e824..843883035214 100644 --- a/fs/orangefs/pvfs2-bufmap.c +++ b/fs/orangefs/pvfs2-bufmap.c @@ -542,25 +542,26 @@ int pvfs_bufmap_copy_from_iovec(struct pvfs2_bufmap *bufmap, */ int pvfs_bufmap_copy_to_iovec(struct pvfs2_bufmap *bufmap, struct iov_iter *iter, - int buffer_index) + int buffer_index, + size_t size) { - struct pvfs_bufmap_desc *from; - struct page *page; + struct pvfs_bufmap_desc *from = &bufmap->desc_array[buffer_index]; int i; - size_t written; gossip_debug(GOSSIP_BUFMAP_DEBUG, - "%s: buffer_index:%d: iov_iter_count(iter):%lu:\n", - __func__, buffer_index, iov_iter_count(iter)); + "%s: buffer_index:%d: size:%zu:\n", + __func__, buffer_index, size); - from = &bufmap->desc_array[buffer_index]; - for (i = 0; iov_iter_count(iter); i++) { - page = from->page_array[i]; - written = copy_page_to_iter(page, 0, PAGE_SIZE, iter); - if ((written == 0) && (iov_iter_count(iter))) - break; + for (i = 0; size; i++) { + struct page *page = from->page_array[i]; + size_t n = size; + if (n > PAGE_SIZE) + n = PAGE_SIZE; + n = copy_page_to_iter(page, 0, n, iter); + if (!n) + return -EFAULT; + size -= n; } - - return iov_iter_count(iter) ? -EFAULT : 0; + return 0; } |