aboutsummaryrefslogtreecommitdiffstats
path: root/kernel/power
diff options
context:
space:
mode:
authorMike Christie <mchristi@redhat.com>2016-06-05 15:32:02 -0400
committerJens Axboe <axboe@fb.com>2016-06-07 15:41:38 -0400
commit162b99e3119767cb6478c55a5aed70469389df88 (patch)
tree20978ccda5196135b498dadcf4872cfd24becdac /kernel/power
parent0d16dcfed759ed36a6ed03ef82bc7f50e736f5e0 (diff)
pm: use bio op accessors
Separate the op from the rq_flag_bits and have the pm code set/get the bio using bio_set_op_attrs/bio_op. Signed-off-by: Mike Christie <mchristi@redhat.com> Reviewed-by: Christoph Hellwig <hch@lst.de> Reviewed-by: Hannes Reinecke <hare@suse.com> Signed-off-by: Jens Axboe <axboe@fb.com>
Diffstat (limited to 'kernel/power')
-rw-r--r--kernel/power/swap.c30
1 files changed, 18 insertions, 12 deletions
diff --git a/kernel/power/swap.c b/kernel/power/swap.c
index be227f5aa9dc..c1aaac431055 100644
--- a/kernel/power/swap.c
+++ b/kernel/power/swap.c
@@ -261,7 +261,7 @@ static void hib_end_io(struct bio *bio)
261 bio_put(bio); 261 bio_put(bio);
262} 262}
263 263
264static int hib_submit_io(int rw, pgoff_t page_off, void *addr, 264static int hib_submit_io(int op, int op_flags, pgoff_t page_off, void *addr,
265 struct hib_bio_batch *hb) 265 struct hib_bio_batch *hb)
266{ 266{
267 struct page *page = virt_to_page(addr); 267 struct page *page = virt_to_page(addr);
@@ -271,7 +271,7 @@ static int hib_submit_io(int rw, pgoff_t page_off, void *addr,
271 bio = bio_alloc(__GFP_RECLAIM | __GFP_HIGH, 1); 271 bio = bio_alloc(__GFP_RECLAIM | __GFP_HIGH, 1);
272 bio->bi_iter.bi_sector = page_off * (PAGE_SIZE >> 9); 272 bio->bi_iter.bi_sector = page_off * (PAGE_SIZE >> 9);
273 bio->bi_bdev = hib_resume_bdev; 273 bio->bi_bdev = hib_resume_bdev;
274 bio->bi_rw = rw; 274 bio_set_op_attrs(bio, op, op_flags);
275 275
276 if (bio_add_page(bio, page, PAGE_SIZE, 0) < PAGE_SIZE) { 276 if (bio_add_page(bio, page, PAGE_SIZE, 0) < PAGE_SIZE) {
277 printk(KERN_ERR "PM: Adding page to bio failed at %llu\n", 277 printk(KERN_ERR "PM: Adding page to bio failed at %llu\n",
@@ -307,7 +307,8 @@ static int mark_swapfiles(struct swap_map_handle *handle, unsigned int flags)
307{ 307{
308 int error; 308 int error;
309 309
310 hib_submit_io(READ_SYNC, swsusp_resume_block, swsusp_header, NULL); 310 hib_submit_io(REQ_OP_READ, READ_SYNC, swsusp_resume_block,
311 swsusp_header, NULL);
311 if (!memcmp("SWAP-SPACE",swsusp_header->sig, 10) || 312 if (!memcmp("SWAP-SPACE",swsusp_header->sig, 10) ||
312 !memcmp("SWAPSPACE2",swsusp_header->sig, 10)) { 313 !memcmp("SWAPSPACE2",swsusp_header->sig, 10)) {
313 memcpy(swsusp_header->orig_sig,swsusp_header->sig, 10); 314 memcpy(swsusp_header->orig_sig,swsusp_header->sig, 10);
@@ -316,8 +317,8 @@ static int mark_swapfiles(struct swap_map_handle *handle, unsigned int flags)
316 swsusp_header->flags = flags; 317 swsusp_header->flags = flags;
317 if (flags & SF_CRC32_MODE) 318 if (flags & SF_CRC32_MODE)
318 swsusp_header->crc32 = handle->crc32; 319 swsusp_header->crc32 = handle->crc32;
319 error = hib_submit_io(WRITE_SYNC, swsusp_resume_block, 320 error = hib_submit_io(REQ_OP_WRITE, WRITE_SYNC,
320 swsusp_header, NULL); 321 swsusp_resume_block, swsusp_header, NULL);
321 } else { 322 } else {
322 printk(KERN_ERR "PM: Swap header not found!\n"); 323 printk(KERN_ERR "PM: Swap header not found!\n");
323 error = -ENODEV; 324 error = -ENODEV;
@@ -390,7 +391,7 @@ static int write_page(void *buf, sector_t offset, struct hib_bio_batch *hb)
390 } else { 391 } else {
391 src = buf; 392 src = buf;
392 } 393 }
393 return hib_submit_io(WRITE_SYNC, offset, src, hb); 394 return hib_submit_io(REQ_OP_WRITE, WRITE_SYNC, offset, src, hb);
394} 395}
395 396
396static void release_swap_writer(struct swap_map_handle *handle) 397static void release_swap_writer(struct swap_map_handle *handle)
@@ -993,7 +994,8 @@ static int get_swap_reader(struct swap_map_handle *handle,
993 return -ENOMEM; 994 return -ENOMEM;
994 } 995 }
995 996
996 error = hib_submit_io(READ_SYNC, offset, tmp->map, NULL); 997 error = hib_submit_io(REQ_OP_READ, READ_SYNC, offset,
998 tmp->map, NULL);
997 if (error) { 999 if (error) {
998 release_swap_reader(handle); 1000 release_swap_reader(handle);
999 return error; 1001 return error;
@@ -1017,7 +1019,7 @@ static int swap_read_page(struct swap_map_handle *handle, void *buf,
1017 offset = handle->cur->entries[handle->k]; 1019 offset = handle->cur->entries[handle->k];
1018 if (!offset) 1020 if (!offset)
1019 return -EFAULT; 1021 return -EFAULT;
1020 error = hib_submit_io(READ_SYNC, offset, buf, hb); 1022 error = hib_submit_io(REQ_OP_READ, READ_SYNC, offset, buf, hb);
1021 if (error) 1023 if (error)
1022 return error; 1024 return error;
1023 if (++handle->k >= MAP_PAGE_ENTRIES) { 1025 if (++handle->k >= MAP_PAGE_ENTRIES) {
@@ -1526,7 +1528,8 @@ int swsusp_check(void)
1526 if (!IS_ERR(hib_resume_bdev)) { 1528 if (!IS_ERR(hib_resume_bdev)) {
1527 set_blocksize(hib_resume_bdev, PAGE_SIZE); 1529 set_blocksize(hib_resume_bdev, PAGE_SIZE);
1528 clear_page(swsusp_header); 1530 clear_page(swsusp_header);
1529 error = hib_submit_io(READ_SYNC, swsusp_resume_block, 1531 error = hib_submit_io(REQ_OP_READ, READ_SYNC,
1532 swsusp_resume_block,
1530 swsusp_header, NULL); 1533 swsusp_header, NULL);
1531 if (error) 1534 if (error)
1532 goto put; 1535 goto put;
@@ -1534,7 +1537,8 @@ int swsusp_check(void)
1534 if (!memcmp(HIBERNATE_SIG, swsusp_header->sig, 10)) { 1537 if (!memcmp(HIBERNATE_SIG, swsusp_header->sig, 10)) {
1535 memcpy(swsusp_header->sig, swsusp_header->orig_sig, 10); 1538 memcpy(swsusp_header->sig, swsusp_header->orig_sig, 10);
1536 /* Reset swap signature now */ 1539 /* Reset swap signature now */
1537 error = hib_submit_io(WRITE_SYNC, swsusp_resume_block, 1540 error = hib_submit_io(REQ_OP_WRITE, WRITE_SYNC,
1541 swsusp_resume_block,
1538 swsusp_header, NULL); 1542 swsusp_header, NULL);
1539 } else { 1543 } else {
1540 error = -EINVAL; 1544 error = -EINVAL;
@@ -1578,10 +1582,12 @@ int swsusp_unmark(void)
1578{ 1582{
1579 int error; 1583 int error;
1580 1584
1581 hib_submit_io(READ_SYNC, swsusp_resume_block, swsusp_header, NULL); 1585 hib_submit_io(REQ_OP_READ, READ_SYNC, swsusp_resume_block,
1586 swsusp_header, NULL);
1582 if (!memcmp(HIBERNATE_SIG,swsusp_header->sig, 10)) { 1587 if (!memcmp(HIBERNATE_SIG,swsusp_header->sig, 10)) {
1583 memcpy(swsusp_header->sig,swsusp_header->orig_sig, 10); 1588 memcpy(swsusp_header->sig,swsusp_header->orig_sig, 10);
1584 error = hib_submit_io(WRITE_SYNC, swsusp_resume_block, 1589 error = hib_submit_io(REQ_OP_WRITE, WRITE_SYNC,
1590 swsusp_resume_block,
1585 swsusp_header, NULL); 1591 swsusp_header, NULL);
1586 } else { 1592 } else {
1587 printk(KERN_ERR "PM: Cannot find swsusp signature!\n"); 1593 printk(KERN_ERR "PM: Cannot find swsusp signature!\n");