Lines Matching refs:hb

226 static void hib_init_batch(struct hib_bio_batch *hb)  in hib_init_batch()  argument
228 atomic_set(&hb->count, 0); in hib_init_batch()
229 init_waitqueue_head(&hb->wait); in hib_init_batch()
230 hb->error = BLK_STS_OK; in hib_init_batch()
231 blk_start_plug(&hb->plug); in hib_init_batch()
234 static void hib_finish_batch(struct hib_bio_batch *hb) in hib_finish_batch() argument
236 blk_finish_plug(&hb->plug); in hib_finish_batch()
241 struct hib_bio_batch *hb = bio->bi_private; in hib_end_io() local
256 if (bio->bi_status && !hb->error) in hib_end_io()
257 hb->error = bio->bi_status; in hib_end_io()
258 if (atomic_dec_and_test(&hb->count)) in hib_end_io()
259 wake_up(&hb->wait); in hib_end_io()
271 struct hib_bio_batch *hb) in hib_submit_io_async() argument
280 bio->bi_private = hb; in hib_submit_io_async()
281 atomic_inc(&hb->count); in hib_submit_io_async()
286 static int hib_wait_io(struct hib_bio_batch *hb) in hib_wait_io() argument
292 wait_event(hb->wait, atomic_read(&hb->count) == 0); in hib_wait_io()
293 return blk_status_to_errno(hb->error); in hib_wait_io()
357 static int write_page(void *buf, sector_t offset, struct hib_bio_batch *hb) in write_page() argument
366 if (!hb) in write_page()
371 ret = hib_wait_io(hb); /* Free pages */ in write_page()
380 return hib_submit_io_async(REQ_OP_WRITE | REQ_SYNC, offset, src, hb); in write_page()
424 struct hib_bio_batch *hb) in swap_write_page() argument
432 error = write_page(buf, offset, hb); in swap_write_page()
441 error = write_page(handle->cur, handle->cur_swap, hb); in swap_write_page()
448 if (hb && low_free_pages() <= handle->reqd_free_pages) { in swap_write_page()
449 error = hib_wait_io(hb); in swap_write_page()
523 struct hib_bio_batch hb; in save_image() local
527 hib_init_batch(&hb); in save_image()
540 ret = swap_write_page(handle, data_of(*snapshot), &hb); in save_image()
548 err2 = hib_wait_io(&hb); in save_image()
549 hib_finish_batch(&hb); in save_image()
697 struct hib_bio_batch hb; in save_compressed_image() local
706 hib_init_batch(&hb); in save_compressed_image()
874 ret = swap_write_page(handle, page, &hb); in save_compressed_image()
885 err2 = hib_wait_io(&hb); in save_compressed_image()
899 hib_finish_batch(&hb); in save_compressed_image()
1048 struct hib_bio_batch *hb) in swap_read_page() argument
1059 if (hb) in swap_read_page()
1060 error = hib_submit_io_async(REQ_OP_READ, offset, buf, hb); in swap_read_page()
1094 struct hib_bio_batch hb; in load_image() local
1098 hib_init_batch(&hb); in load_image()
1111 ret = swap_read_page(handle, data_of(*snapshot), &hb); in load_image()
1115 ret = hib_wait_io(&hb); in load_image()
1123 err2 = hib_wait_io(&hb); in load_image()
1124 hib_finish_batch(&hb); in load_image()
1197 struct hib_bio_batch hb; in load_compressed_image() local
1210 hib_init_batch(&hb); in load_compressed_image()
1340 ret = swap_read_page(handle, page[ring], &hb); in load_compressed_image()
1367 ret = hib_wait_io(&hb); in load_compressed_image()
1421 ret = hib_wait_io(&hb); in load_compressed_image()
1497 hib_finish_batch(&hb); in load_compressed_image()