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

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
...@@ -403,6 +403,7 @@ int swap_readpage(struct page *page, bool synchronous) ...@@ -403,6 +403,7 @@ int swap_readpage(struct page *page, bool synchronous)
goto out; goto out;
} }
if (sis->flags & SWP_SYNCHRONOUS_IO) {
ret = bdev_read_page(sis->bdev, swap_page_sector(page), page); ret = bdev_read_page(sis->bdev, swap_page_sector(page), page);
if (!ret) { if (!ret) {
if (trylock_page(page)) { if (trylock_page(page)) {
...@@ -413,6 +414,7 @@ int swap_readpage(struct page *page, bool synchronous) ...@@ -413,6 +414,7 @@ int swap_readpage(struct page *page, bool synchronous)
count_vm_event(PSWPIN); count_vm_event(PSWPIN);
goto out; goto out;
} }
}
ret = 0; ret = 0;
bio = get_swap_bio(GFP_KERNEL, page, end_swap_bio_read); bio = get_swap_bio(GFP_KERNEL, page, end_swap_bio_read);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment