Lines Matching refs:sio
262 struct swap_iocb *sio = container_of(iocb, struct swap_iocb, iocb); in sio_write_complete() local
263 struct page *page = sio->bvec[0].bv_page; in sio_write_complete()
266 if (ret != sio->len) { in sio_write_complete()
279 for (p = 0; p < sio->pages; p++) { in sio_write_complete()
280 page = sio->bvec[p].bv_page; in sio_write_complete()
285 for (p = 0; p < sio->pages; p++) in sio_write_complete()
286 count_swpout_vm_event(sio->bvec[p].bv_page); in sio_write_complete()
289 for (p = 0; p < sio->pages; p++) in sio_write_complete()
290 end_page_writeback(sio->bvec[p].bv_page); in sio_write_complete()
292 mempool_free(sio, sio_pool); in sio_write_complete()
297 struct swap_iocb *sio = NULL; in swap_writepage_fs() local
305 sio = *wbc->swap_plug; in swap_writepage_fs()
306 if (sio) { in swap_writepage_fs()
307 if (sio->iocb.ki_filp != swap_file || in swap_writepage_fs()
308 sio->iocb.ki_pos + sio->len != pos) { in swap_writepage_fs()
309 swap_write_unplug(sio); in swap_writepage_fs()
310 sio = NULL; in swap_writepage_fs()
313 if (!sio) { in swap_writepage_fs()
314 sio = mempool_alloc(sio_pool, GFP_NOIO); in swap_writepage_fs()
315 init_sync_kiocb(&sio->iocb, swap_file); in swap_writepage_fs()
316 sio->iocb.ki_complete = sio_write_complete; in swap_writepage_fs()
317 sio->iocb.ki_pos = pos; in swap_writepage_fs()
318 sio->pages = 0; in swap_writepage_fs()
319 sio->len = 0; in swap_writepage_fs()
321 bvec_set_page(&sio->bvec[sio->pages], page, thp_size(page), 0); in swap_writepage_fs()
322 sio->len += thp_size(page); in swap_writepage_fs()
323 sio->pages += 1; in swap_writepage_fs()
324 if (sio->pages == ARRAY_SIZE(sio->bvec) || !wbc->swap_plug) { in swap_writepage_fs()
325 swap_write_unplug(sio); in swap_writepage_fs()
326 sio = NULL; in swap_writepage_fs()
329 *wbc->swap_plug = sio; in swap_writepage_fs()
390 void swap_write_unplug(struct swap_iocb *sio) in swap_write_unplug() argument
393 struct address_space *mapping = sio->iocb.ki_filp->f_mapping; in swap_write_unplug()
396 iov_iter_bvec(&from, ITER_SOURCE, sio->bvec, sio->pages, sio->len); in swap_write_unplug()
397 ret = mapping->a_ops->swap_rw(&sio->iocb, &from); in swap_write_unplug()
399 sio_write_complete(&sio->iocb, ret); in swap_write_unplug()
404 struct swap_iocb *sio = container_of(iocb, struct swap_iocb, iocb); in sio_read_complete() local
407 if (ret == sio->len) { in sio_read_complete()
408 for (p = 0; p < sio->pages; p++) { in sio_read_complete()
409 struct page *page = sio->bvec[p].bv_page; in sio_read_complete()
414 count_vm_events(PSWPIN, sio->pages); in sio_read_complete()
416 for (p = 0; p < sio->pages; p++) { in sio_read_complete()
417 struct page *page = sio->bvec[p].bv_page; in sio_read_complete()
425 mempool_free(sio, sio_pool); in sio_read_complete()
432 struct swap_iocb *sio = NULL; in swap_readpage_fs() local
436 sio = *plug; in swap_readpage_fs()
437 if (sio) { in swap_readpage_fs()
438 if (sio->iocb.ki_filp != sis->swap_file || in swap_readpage_fs()
439 sio->iocb.ki_pos + sio->len != pos) { in swap_readpage_fs()
440 swap_read_unplug(sio); in swap_readpage_fs()
441 sio = NULL; in swap_readpage_fs()
444 if (!sio) { in swap_readpage_fs()
445 sio = mempool_alloc(sio_pool, GFP_KERNEL); in swap_readpage_fs()
446 init_sync_kiocb(&sio->iocb, sis->swap_file); in swap_readpage_fs()
447 sio->iocb.ki_pos = pos; in swap_readpage_fs()
448 sio->iocb.ki_complete = sio_read_complete; in swap_readpage_fs()
449 sio->pages = 0; in swap_readpage_fs()
450 sio->len = 0; in swap_readpage_fs()
452 bvec_set_page(&sio->bvec[sio->pages], page, thp_size(page), 0); in swap_readpage_fs()
453 sio->len += thp_size(page); in swap_readpage_fs()
454 sio->pages += 1; in swap_readpage_fs()
455 if (sio->pages == ARRAY_SIZE(sio->bvec) || !plug) { in swap_readpage_fs()
456 swap_read_unplug(sio); in swap_readpage_fs()
457 sio = NULL; in swap_readpage_fs()
460 *plug = sio; in swap_readpage_fs()
536 void __swap_read_unplug(struct swap_iocb *sio) in __swap_read_unplug() argument
539 struct address_space *mapping = sio->iocb.ki_filp->f_mapping; in __swap_read_unplug()
542 iov_iter_bvec(&from, ITER_DEST, sio->bvec, sio->pages, sio->len); in __swap_read_unplug()
543 ret = mapping->a_ops->swap_rw(&sio->iocb, &from); in __swap_read_unplug()
545 sio_read_complete(&sio->iocb, ret); in __swap_read_unplug()