Lines Matching refs:hb
232 static void hib_init_batch(struct hib_bio_batch *hb) in hib_init_batch() argument
234 atomic_set(&hb->count, 0); in hib_init_batch()
235 init_waitqueue_head(&hb->wait); in hib_init_batch()
236 hb->error = BLK_STS_OK; in hib_init_batch()
237 blk_start_plug(&hb->plug); in hib_init_batch()
240 static void hib_finish_batch(struct hib_bio_batch *hb) in hib_finish_batch() argument
242 blk_finish_plug(&hb->plug); in hib_finish_batch()
247 struct hib_bio_batch *hb = bio->bi_private; in hib_end_io() local
262 if (bio->bi_status && !hb->error) in hib_end_io()
263 hb->error = bio->bi_status; in hib_end_io()
264 if (atomic_dec_and_test(&hb->count)) in hib_end_io()
265 wake_up(&hb->wait); in hib_end_io()
271 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()
376 static int write_page(void *buf, sector_t offset, struct hib_bio_batch *hb) in write_page() argument
384 if (hb) { in write_page()
390 ret = hib_wait_io(hb); /* Free pages */ in write_page()
400 hb = NULL; /* Go synchronous */ in write_page()
407 return hib_submit_io(REQ_OP_WRITE, REQ_SYNC, offset, src, hb); in write_page()
449 struct hib_bio_batch *hb) in swap_write_page() argument
457 error = write_page(buf, offset, hb); in swap_write_page()
466 error = write_page(handle->cur, handle->cur_swap, hb); in swap_write_page()
473 if (hb && low_free_pages() <= handle->reqd_free_pages) { in swap_write_page()
474 error = hib_wait_io(hb); in swap_write_page()
546 struct hib_bio_batch hb; in save_image() local
550 hib_init_batch(&hb); in save_image()
563 ret = swap_write_page(handle, data_of(*snapshot), &hb); in save_image()
571 err2 = hib_wait_io(&hb); in save_image()
572 hib_finish_batch(&hb); in save_image()
683 struct hib_bio_batch hb; in save_image_lzo() local
692 hib_init_batch(&hb); in save_image_lzo()
847 ret = swap_write_page(handle, page, &hb); in save_image_lzo()
858 err2 = hib_wait_io(&hb); in save_image_lzo()
866 hib_finish_batch(&hb); in save_image_lzo()
1018 struct hib_bio_batch *hb) in swap_read_page() argument
1029 error = hib_submit_io(REQ_OP_READ, 0, offset, buf, hb); in swap_read_page()
1067 struct hib_bio_batch hb; in load_image() local
1071 hib_init_batch(&hb); in load_image()
1084 ret = swap_read_page(handle, data_of(*snapshot), &hb); in load_image()
1088 ret = hib_wait_io(&hb); in load_image()
1096 err2 = hib_wait_io(&hb); in load_image()
1097 hib_finish_batch(&hb); in load_image()
1172 struct hib_bio_batch hb; in load_image_lzo() local
1185 hib_init_batch(&hb); in load_image_lzo()
1304 ret = swap_read_page(handle, page[ring], &hb); in load_image_lzo()
1331 ret = hib_wait_io(&hb); in load_image_lzo()
1385 ret = hib_wait_io(&hb); in load_image_lzo()
1461 hib_finish_batch(&hb); in load_image_lzo()