aboutsummaryrefslogtreecommitdiffstats
path: root/mm
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2015-02-17 18:48:33 -0500
committerLinus Torvalds <torvalds@linux-foundation.org>2015-02-17 18:48:33 -0500
commit66dc830d14a222c9214a8557e9feb1e4a67a3857 (patch)
treed5bd699150fecfe5b2ebfddd9db651389480937d /mm
parent05016b0f0a9d900e976db7f50a7761c0aefe5a1c (diff)
parentdbe4e192a234cd6133d86fffb965d0f032c12ccc (diff)
Merge branch 'iov_iter' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs
Pull iov_iter updates from Al Viro: "More iov_iter work - missing counterpart of iov_iter_init() for bvec-backed ones and vfs_read_iter()/vfs_write_iter() - wrappers for sync calls of ->read_iter()/->write_iter()" * 'iov_iter' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs: fs: add vfs_iter_{read,write} helpers new helper: iov_iter_bvec()
Diffstat (limited to 'mm')
-rw-r--r--mm/iov_iter.c17
-rw-r--r--mm/page_io.c9
2 files changed, 17 insertions, 9 deletions
diff --git a/mm/iov_iter.c b/mm/iov_iter.c
index a1599ca4ab0e..827732047da1 100644
--- a/mm/iov_iter.c
+++ b/mm/iov_iter.c
@@ -501,18 +501,31 @@ size_t iov_iter_single_seg_count(const struct iov_iter *i)
501EXPORT_SYMBOL(iov_iter_single_seg_count); 501EXPORT_SYMBOL(iov_iter_single_seg_count);
502 502
503void iov_iter_kvec(struct iov_iter *i, int direction, 503void iov_iter_kvec(struct iov_iter *i, int direction,
504 const struct kvec *iov, unsigned long nr_segs, 504 const struct kvec *kvec, unsigned long nr_segs,
505 size_t count) 505 size_t count)
506{ 506{
507 BUG_ON(!(direction & ITER_KVEC)); 507 BUG_ON(!(direction & ITER_KVEC));
508 i->type = direction; 508 i->type = direction;
509 i->kvec = (struct kvec *)iov; 509 i->kvec = kvec;
510 i->nr_segs = nr_segs; 510 i->nr_segs = nr_segs;
511 i->iov_offset = 0; 511 i->iov_offset = 0;
512 i->count = count; 512 i->count = count;
513} 513}
514EXPORT_SYMBOL(iov_iter_kvec); 514EXPORT_SYMBOL(iov_iter_kvec);
515 515
516void iov_iter_bvec(struct iov_iter *i, int direction,
517 const struct bio_vec *bvec, unsigned long nr_segs,
518 size_t count)
519{
520 BUG_ON(!(direction & ITER_BVEC));
521 i->type = direction;
522 i->bvec = bvec;
523 i->nr_segs = nr_segs;
524 i->iov_offset = 0;
525 i->count = count;
526}
527EXPORT_SYMBOL(iov_iter_bvec);
528
516unsigned long iov_iter_alignment(const struct iov_iter *i) 529unsigned long iov_iter_alignment(const struct iov_iter *i)
517{ 530{
518 unsigned long res = 0; 531 unsigned long res = 0;
diff --git a/mm/page_io.c b/mm/page_io.c
index 955db8b0d497..e6045804c8d8 100644
--- a/mm/page_io.c
+++ b/mm/page_io.c
@@ -269,14 +269,9 @@ int __swap_writepage(struct page *page, struct writeback_control *wbc,
269 .bv_len = PAGE_SIZE, 269 .bv_len = PAGE_SIZE,
270 .bv_offset = 0 270 .bv_offset = 0
271 }; 271 };
272 struct iov_iter from = { 272 struct iov_iter from;
273 .type = ITER_BVEC | WRITE,
274 .count = PAGE_SIZE,
275 .iov_offset = 0,
276 .nr_segs = 1,
277 };
278 from.bvec = &bv; /* older gcc versions are broken */
279 273
274 iov_iter_bvec(&from, ITER_BVEC | WRITE, &bv, 1, PAGE_SIZE);
280 init_sync_kiocb(&kiocb, swap_file); 275 init_sync_kiocb(&kiocb, swap_file);
281 kiocb.ki_pos = page_file_offset(page); 276 kiocb.ki_pos = page_file_offset(page);
282 kiocb.ki_nbytes = PAGE_SIZE; 277 kiocb.ki_nbytes = PAGE_SIZE;