mm/page_io: use a folio in swap_writepage_bdev_sync()

JIRA: https://issues.redhat.com/browse/RHEL-27743

This patch is a backport of the following upstream commit:
commit f54fcaabd34b98921ec12501d0507e1fa1ae831b
Author: ZhangPeng <zhangpeng362@huawei.com>
Date:   Fri Jul 21 11:44:48 2023 +0800

    mm/page_io: use a folio in swap_writepage_bdev_sync()

    Saves one implicit call to compound_head().

    Link: https://lkml.kernel.org/r/20230721034451.16412-8-zhangpeng362@huawei.com
    Signed-off-by: ZhangPeng <zhangpeng362@huawei.com>
    Reviewed-by: Matthew Wilcox (Oracle) <willy@infradead.org>
    Cc: Christoph Hellwig <hch@infradead.org>
    Cc: Kefeng Wang <wangkefeng.wang@huawei.com>
    Cc: Nanyong Sun <sunnanyong@huawei.com>
    Cc: Sidhartha Kumar <sidhartha.kumar@oracle.com>
    Signed-off-by: Andrew Morton <akpm@linux-foundation.org>

Signed-off-by: Rafael Aquini <raquini@redhat.com>
This commit is contained in:
Rafael Aquini 2024-09-27 10:43:53 -04:00
parent 621c1bebb0
commit cb0d21dfcb
1 changed files with 3 additions and 2 deletions

View File

@ -331,6 +331,7 @@ static void swap_writepage_bdev_sync(struct page *page,
{
struct bio_vec bv;
struct bio bio;
struct folio *folio = page_folio(page);
bio_init(&bio, sis->bdev, &bv, 1,
REQ_OP_WRITE | REQ_SWAP | wbc_to_write_flags(wbc));
@ -340,8 +341,8 @@ static void swap_writepage_bdev_sync(struct page *page,
bio_associate_blkg_from_page(&bio, page);
count_swpout_vm_event(page);
set_page_writeback(page);
unlock_page(page);
folio_start_writeback(folio);
folio_unlock(folio);
submit_bio_wait(&bio);
__end_swap_bio_write(&bio);