swap.c (9ff17e6bdaa50892dd9bdb1b116cb71b73dd711a) swap.c (0718afd47f70cf46877c39c25d06b786e1a3f36c)
1// SPDX-License-Identifier: GPL-2.0-only
2/*
3 * linux/kernel/power/swap.c
4 *
5 * This file provides functions for reading the suspend image from
6 * and writing it to a swap partition.
7 *
8 * Copyright (C) 1998,2001-2005 Pavel Machek <pavel@ucw.cz>

--- 343 unchanged lines hidden (view full) ---

352 res = swap_type_of(swsusp_resume_device, swsusp_resume_block);
353 else
354 res = find_first_swap(&swsusp_resume_device);
355 if (res < 0)
356 return res;
357 root_swap = res;
358
359 hib_resume_bdev = blkdev_get_by_dev(swsusp_resume_device, FMODE_WRITE,
1// SPDX-License-Identifier: GPL-2.0-only
2/*
3 * linux/kernel/power/swap.c
4 *
5 * This file provides functions for reading the suspend image from
6 * and writing it to a swap partition.
7 *
8 * Copyright (C) 1998,2001-2005 Pavel Machek <pavel@ucw.cz>

--- 343 unchanged lines hidden (view full) ---

352 res = swap_type_of(swsusp_resume_device, swsusp_resume_block);
353 else
354 res = find_first_swap(&swsusp_resume_device);
355 if (res < 0)
356 return res;
357 root_swap = res;
358
359 hib_resume_bdev = blkdev_get_by_dev(swsusp_resume_device, FMODE_WRITE,
360 NULL);
360 NULL, NULL);
361 if (IS_ERR(hib_resume_bdev))
362 return PTR_ERR(hib_resume_bdev);
363
364 res = set_blocksize(hib_resume_bdev, PAGE_SIZE);
365 if (res < 0)
366 blkdev_put(hib_resume_bdev, FMODE_WRITE);
367
368 return res;

--- 1150 unchanged lines hidden (view full) ---

1519 int error;
1520 void *holder;
1521 fmode_t mode = FMODE_READ;
1522
1523 if (snapshot_test)
1524 mode |= FMODE_EXCL;
1525
1526 hib_resume_bdev = blkdev_get_by_dev(swsusp_resume_device,
361 if (IS_ERR(hib_resume_bdev))
362 return PTR_ERR(hib_resume_bdev);
363
364 res = set_blocksize(hib_resume_bdev, PAGE_SIZE);
365 if (res < 0)
366 blkdev_put(hib_resume_bdev, FMODE_WRITE);
367
368 return res;

--- 1150 unchanged lines hidden (view full) ---

1519 int error;
1520 void *holder;
1521 fmode_t mode = FMODE_READ;
1522
1523 if (snapshot_test)
1524 mode |= FMODE_EXCL;
1525
1526 hib_resume_bdev = blkdev_get_by_dev(swsusp_resume_device,
1527 mode, &holder);
1527 mode, &holder, NULL);
1528 if (!IS_ERR(hib_resume_bdev)) {
1529 set_blocksize(hib_resume_bdev, PAGE_SIZE);
1530 clear_page(swsusp_header);
1531 error = hib_submit_io(REQ_OP_READ, swsusp_resume_block,
1532 swsusp_header, NULL);
1533 if (error)
1534 goto put;
1535

--- 84 unchanged lines hidden ---
1528 if (!IS_ERR(hib_resume_bdev)) {
1529 set_blocksize(hib_resume_bdev, PAGE_SIZE);
1530 clear_page(swsusp_header);
1531 error = hib_submit_io(REQ_OP_READ, swsusp_resume_block,
1532 swsusp_header, NULL);
1533 if (error)
1534 goto put;
1535

--- 84 unchanged lines hidden ---