|
@@ -261,7 +261,7 @@ static void hib_end_io(struct bio *bio)
|
|
|
bio_put(bio);
|
|
bio_put(bio);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
-static int hib_submit_io(int rw, pgoff_t page_off, void *addr,
|
|
|
|
|
|
|
+static int hib_submit_io(int op, int op_flags, pgoff_t page_off, void *addr,
|
|
|
struct hib_bio_batch *hb)
|
|
struct hib_bio_batch *hb)
|
|
|
{
|
|
{
|
|
|
struct page *page = virt_to_page(addr);
|
|
struct page *page = virt_to_page(addr);
|
|
@@ -271,7 +271,7 @@ static int hib_submit_io(int rw, pgoff_t page_off, void *addr,
|
|
|
bio = bio_alloc(__GFP_RECLAIM | __GFP_HIGH, 1);
|
|
bio = bio_alloc(__GFP_RECLAIM | __GFP_HIGH, 1);
|
|
|
bio->bi_iter.bi_sector = page_off * (PAGE_SIZE >> 9);
|
|
bio->bi_iter.bi_sector = page_off * (PAGE_SIZE >> 9);
|
|
|
bio->bi_bdev = hib_resume_bdev;
|
|
bio->bi_bdev = hib_resume_bdev;
|
|
|
- bio->bi_rw = rw;
|
|
|
|
|
|
|
+ bio_set_op_attrs(bio, op, op_flags);
|
|
|
|
|
|
|
|
if (bio_add_page(bio, page, PAGE_SIZE, 0) < PAGE_SIZE) {
|
|
if (bio_add_page(bio, page, PAGE_SIZE, 0) < PAGE_SIZE) {
|
|
|
printk(KERN_ERR "PM: Adding page to bio failed at %llu\n",
|
|
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)
|
|
|
{
|
|
{
|
|
|
int error;
|
|
int error;
|
|
|
|
|
|
|
|
- hib_submit_io(READ_SYNC, swsusp_resume_block, swsusp_header, NULL);
|
|
|
|
|
|
|
+ hib_submit_io(REQ_OP_READ, READ_SYNC, swsusp_resume_block,
|
|
|
|
|
+ swsusp_header, NULL);
|
|
|
if (!memcmp("SWAP-SPACE",swsusp_header->sig, 10) ||
|
|
if (!memcmp("SWAP-SPACE",swsusp_header->sig, 10) ||
|
|
|
!memcmp("SWAPSPACE2",swsusp_header->sig, 10)) {
|
|
!memcmp("SWAPSPACE2",swsusp_header->sig, 10)) {
|
|
|
memcpy(swsusp_header->orig_sig,swsusp_header->sig, 10);
|
|
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)
|
|
|
swsusp_header->flags = flags;
|
|
swsusp_header->flags = flags;
|
|
|
if (flags & SF_CRC32_MODE)
|
|
if (flags & SF_CRC32_MODE)
|
|
|
swsusp_header->crc32 = handle->crc32;
|
|
swsusp_header->crc32 = handle->crc32;
|
|
|
- error = hib_submit_io(WRITE_SYNC, swsusp_resume_block,
|
|
|
|
|
- swsusp_header, NULL);
|
|
|
|
|
|
|
+ error = hib_submit_io(REQ_OP_WRITE, WRITE_SYNC,
|
|
|
|
|
+ swsusp_resume_block, swsusp_header, NULL);
|
|
|
} else {
|
|
} else {
|
|
|
printk(KERN_ERR "PM: Swap header not found!\n");
|
|
printk(KERN_ERR "PM: Swap header not found!\n");
|
|
|
error = -ENODEV;
|
|
error = -ENODEV;
|
|
@@ -390,7 +391,7 @@ static int write_page(void *buf, sector_t offset, struct hib_bio_batch *hb)
|
|
|
} else {
|
|
} else {
|
|
|
src = buf;
|
|
src = buf;
|
|
|
}
|
|
}
|
|
|
- return hib_submit_io(WRITE_SYNC, offset, src, hb);
|
|
|
|
|
|
|
+ return hib_submit_io(REQ_OP_WRITE, WRITE_SYNC, offset, src, hb);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
static void release_swap_writer(struct swap_map_handle *handle)
|
|
static void release_swap_writer(struct swap_map_handle *handle)
|
|
@@ -993,7 +994,8 @@ static int get_swap_reader(struct swap_map_handle *handle,
|
|
|
return -ENOMEM;
|
|
return -ENOMEM;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- error = hib_submit_io(READ_SYNC, offset, tmp->map, NULL);
|
|
|
|
|
|
|
+ error = hib_submit_io(REQ_OP_READ, READ_SYNC, offset,
|
|
|
|
|
+ tmp->map, NULL);
|
|
|
if (error) {
|
|
if (error) {
|
|
|
release_swap_reader(handle);
|
|
release_swap_reader(handle);
|
|
|
return error;
|
|
return error;
|
|
@@ -1017,7 +1019,7 @@ static int swap_read_page(struct swap_map_handle *handle, void *buf,
|
|
|
offset = handle->cur->entries[handle->k];
|
|
offset = handle->cur->entries[handle->k];
|
|
|
if (!offset)
|
|
if (!offset)
|
|
|
return -EFAULT;
|
|
return -EFAULT;
|
|
|
- error = hib_submit_io(READ_SYNC, offset, buf, hb);
|
|
|
|
|
|
|
+ error = hib_submit_io(REQ_OP_READ, READ_SYNC, offset, buf, hb);
|
|
|
if (error)
|
|
if (error)
|
|
|
return error;
|
|
return error;
|
|
|
if (++handle->k >= MAP_PAGE_ENTRIES) {
|
|
if (++handle->k >= MAP_PAGE_ENTRIES) {
|
|
@@ -1526,7 +1528,8 @@ int swsusp_check(void)
|
|
|
if (!IS_ERR(hib_resume_bdev)) {
|
|
if (!IS_ERR(hib_resume_bdev)) {
|
|
|
set_blocksize(hib_resume_bdev, PAGE_SIZE);
|
|
set_blocksize(hib_resume_bdev, PAGE_SIZE);
|
|
|
clear_page(swsusp_header);
|
|
clear_page(swsusp_header);
|
|
|
- error = hib_submit_io(READ_SYNC, swsusp_resume_block,
|
|
|
|
|
|
|
+ error = hib_submit_io(REQ_OP_READ, READ_SYNC,
|
|
|
|
|
+ swsusp_resume_block,
|
|
|
swsusp_header, NULL);
|
|
swsusp_header, NULL);
|
|
|
if (error)
|
|
if (error)
|
|
|
goto put;
|
|
goto put;
|
|
@@ -1534,7 +1537,8 @@ int swsusp_check(void)
|
|
|
if (!memcmp(HIBERNATE_SIG, swsusp_header->sig, 10)) {
|
|
if (!memcmp(HIBERNATE_SIG, swsusp_header->sig, 10)) {
|
|
|
memcpy(swsusp_header->sig, swsusp_header->orig_sig, 10);
|
|
memcpy(swsusp_header->sig, swsusp_header->orig_sig, 10);
|
|
|
/* Reset swap signature now */
|
|
/* Reset swap signature now */
|
|
|
- error = hib_submit_io(WRITE_SYNC, swsusp_resume_block,
|
|
|
|
|
|
|
+ error = hib_submit_io(REQ_OP_WRITE, WRITE_SYNC,
|
|
|
|
|
+ swsusp_resume_block,
|
|
|
swsusp_header, NULL);
|
|
swsusp_header, NULL);
|
|
|
} else {
|
|
} else {
|
|
|
error = -EINVAL;
|
|
error = -EINVAL;
|
|
@@ -1578,10 +1582,12 @@ int swsusp_unmark(void)
|
|
|
{
|
|
{
|
|
|
int error;
|
|
int error;
|
|
|
|
|
|
|
|
- hib_submit_io(READ_SYNC, swsusp_resume_block, swsusp_header, NULL);
|
|
|
|
|
|
|
+ hib_submit_io(REQ_OP_READ, READ_SYNC, swsusp_resume_block,
|
|
|
|
|
+ swsusp_header, NULL);
|
|
|
if (!memcmp(HIBERNATE_SIG,swsusp_header->sig, 10)) {
|
|
if (!memcmp(HIBERNATE_SIG,swsusp_header->sig, 10)) {
|
|
|
memcpy(swsusp_header->sig,swsusp_header->orig_sig, 10);
|
|
memcpy(swsusp_header->sig,swsusp_header->orig_sig, 10);
|
|
|
- error = hib_submit_io(WRITE_SYNC, swsusp_resume_block,
|
|
|
|
|
|
|
+ error = hib_submit_io(REQ_OP_WRITE, WRITE_SYNC,
|
|
|
|
|
+ swsusp_resume_block,
|
|
|
swsusp_header, NULL);
|
|
swsusp_header, NULL);
|
|
|
} else {
|
|
} else {
|
|
|
printk(KERN_ERR "PM: Cannot find swsusp signature!\n");
|
|
printk(KERN_ERR "PM: Cannot find swsusp signature!\n");
|