Lines Matching refs:hb

234 static void hib_init_batch(struct hib_bio_batch *hb)  in hib_init_batch()  argument
236 atomic_set(&hb->count, 0); in hib_init_batch()
237 init_waitqueue_head(&hb->wait); in hib_init_batch()
238 hb->error = BLK_STS_OK; in hib_init_batch()
239 blk_start_plug(&hb->plug); in hib_init_batch()
242 static void hib_finish_batch(struct hib_bio_batch *hb) in hib_finish_batch() argument
244 blk_finish_plug(&hb->plug); in hib_finish_batch()
249 struct hib_bio_batch *hb = bio->bi_private; in hib_end_io() local
264 if (bio->bi_status && !hb->error) in hib_end_io()
265 hb->error = bio->bi_status; in hib_end_io()
266 if (atomic_dec_and_test(&hb->count)) in hib_end_io()
267 wake_up(&hb->wait); in hib_end_io()
273 struct hib_bio_batch *hb) in hib_submit_io() argument
289 if (hb) { in hib_submit_io()
291 bio->bi_private = hb; in hib_submit_io()
292 atomic_inc(&hb->count); in hib_submit_io()
302 static int hib_wait_io(struct hib_bio_batch *hb) in hib_wait_io() argument
308 wait_event(hb->wait, atomic_read(&hb->count) == 0); in hib_wait_io()
309 return blk_status_to_errno(hb->error); in hib_wait_io()
378 static int write_page(void *buf, sector_t offset, struct hib_bio_batch *hb) in write_page() argument
386 if (hb) { in write_page()
392 ret = hib_wait_io(hb); /* Free pages */ in write_page()
402 hb = NULL; /* Go synchronous */ in write_page()
409 return hib_submit_io(REQ_OP_WRITE | REQ_SYNC, offset, src, hb); in write_page()
451 struct hib_bio_batch *hb) in swap_write_page() argument
459 error = write_page(buf, offset, hb); in swap_write_page()
468 error = write_page(handle->cur, handle->cur_swap, hb); in swap_write_page()
475 if (hb && low_free_pages() <= handle->reqd_free_pages) { in swap_write_page()
476 error = hib_wait_io(hb); in swap_write_page()
548 struct hib_bio_batch hb; in save_image() local
552 hib_init_batch(&hb); in save_image()
565 ret = swap_write_page(handle, data_of(*snapshot), &hb); in save_image()
573 err2 = hib_wait_io(&hb); in save_image()
574 hib_finish_batch(&hb); in save_image()
685 struct hib_bio_batch hb; in save_image_lzo() local
694 hib_init_batch(&hb); in save_image_lzo()
846 ret = swap_write_page(handle, page, &hb); in save_image_lzo()
857 err2 = hib_wait_io(&hb); in save_image_lzo()
865 hib_finish_batch(&hb); in save_image_lzo()
1017 struct hib_bio_batch *hb) in swap_read_page() argument
1028 error = hib_submit_io(REQ_OP_READ, offset, buf, hb); in swap_read_page()
1066 struct hib_bio_batch hb; in load_image() local
1070 hib_init_batch(&hb); in load_image()
1083 ret = swap_read_page(handle, data_of(*snapshot), &hb); in load_image()
1087 ret = hib_wait_io(&hb); in load_image()
1095 err2 = hib_wait_io(&hb); in load_image()
1096 hib_finish_batch(&hb); in load_image()
1171 struct hib_bio_batch hb; in load_image_lzo() local
1184 hib_init_batch(&hb); in load_image_lzo()
1300 ret = swap_read_page(handle, page[ring], &hb); in load_image_lzo()
1327 ret = hib_wait_io(&hb); in load_image_lzo()
1381 ret = hib_wait_io(&hb); in load_image_lzo()
1457 hib_finish_batch(&hb); in load_image_lzo()