Commit 5115db10 authored by Christoph Hellwig's avatar Christoph Hellwig Committed by Jens Axboe
Browse files

mm: use SWP_SYNCHRONOUS_IO more intelligently



There is no point in trying to call bdev_read_page if SWP_SYNCHRONOUS_IO
is not set, as the device won't support it.

Signed-off-by: default avatarChristoph Hellwig <hch@lst.de>
Reviewed-by: default avatarJan Kara <jack@suse.cz>
Reviewed-by: default avatarJohannes Thumshirn <johannes.thumshirn@wdc.com>
Signed-off-by: default avatarJens Axboe <axboe@kernel.dk>
parent a8b456d0
Loading
Loading
Loading
Loading
+10 −8
Original line number Diff line number Diff line
@@ -403,6 +403,7 @@ int swap_readpage(struct page *page, bool synchronous)
		goto out;
	}

	if (sis->flags & SWP_SYNCHRONOUS_IO) {
		ret = bdev_read_page(sis->bdev, swap_page_sector(page), page);
		if (!ret) {
			if (trylock_page(page)) {
@@ -413,6 +414,7 @@ int swap_readpage(struct page *page, bool synchronous)
			count_vm_event(PSWPIN);
			goto out;
		}
	}

	ret = 0;
	bio = get_swap_bio(GFP_KERNEL, page, end_swap_bio_read);