Skip to content

Commit

Permalink
mm/page_io: use a folio in swap_writepage_bdev_async()
Browse files Browse the repository at this point in the history
Saves one implicit call to compound_head().

Link: https://lkml.kernel.org/r/20230721034451.16412-9-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>
  • Loading branch information
ZhangPeng authored and Andrew Morton committed Aug 18, 2023
1 parent f54fcaa commit 2675251
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions mm/page_io.c
Original file line number Diff line number Diff line change
Expand Up @@ -352,6 +352,7 @@ static void swap_writepage_bdev_async(struct page *page,
struct writeback_control *wbc, struct swap_info_struct *sis)
{
struct bio *bio;
struct folio *folio = page_folio(page);

bio = bio_alloc(sis->bdev, 1,
REQ_OP_WRITE | REQ_SWAP | wbc_to_write_flags(wbc),
Expand All @@ -362,8 +363,8 @@ static void swap_writepage_bdev_async(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(bio);
}

Expand Down

0 comments on commit 2675251

Please sign in to comment.