2023-07-20 13:28:18

by zhangpeng (AS)

[permalink] [raw]
Subject: [PATCH v3 08/10] mm/page_io: use a folio in swap_writepage_bdev_async()

From: ZhangPeng <[email protected]>

Saves one implicit call to compound_head().

Signed-off-by: ZhangPeng <[email protected]>
Reviewed-by: Matthew Wilcox (Oracle) <[email protected]>
---
mm/page_io.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/mm/page_io.c b/mm/page_io.c
index 9df2a85e31b1..07bad3a4b701 100644
--- a/mm/page_io.c
+++ b/mm/page_io.c
@@ -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),
@@ -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);
}

--
2.25.1