aboutsummaryrefslogtreecommitdiffstats
path: root/mm
diff options
context:
space:
mode:
authorAl Viro <viro@zeniv.linux.org.uk>2015-01-23 01:08:07 -0500
committerAl Viro <viro@zeniv.linux.org.uk>2015-01-29 00:13:11 -0500
commit05afcb77eb4713f46e7ebaa3cb54bc465c5d516e (patch)
treefeeafbb29a9a41fb7d85ff55fdb624eaa918907f /mm
parent26bc420b59a38e4e6685a73345a0def461136dce (diff)
new helper: iov_iter_bvec()
similar to iov_iter_kvec(), for ITER_BVEC ones Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
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;