Skip to content

Commit 7e63df0

Browse files
author
Matthew Wilcox (Oracle)
committed
mm: Convert swap_set_page_dirty() to swap_dirty_folio()
Straightforward conversion. Signed-off-by: Matthew Wilcox (Oracle) <[email protected]> Tested-by: Damien Le Moal <[email protected]> Acked-by: Damien Le Moal <[email protected]> Tested-by: Mike Marshall <[email protected]> # orangefs Tested-by: David Howells <[email protected]> # afs
1 parent 1f1d14d commit 7e63df0

File tree

3 files changed

+12
-10
lines changed

3 files changed

+12
-10
lines changed

include/linux/swap.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -427,7 +427,7 @@ extern int swap_writepage(struct page *page, struct writeback_control *wbc);
427427
extern void end_swap_bio_write(struct bio *bio);
428428
extern int __swap_writepage(struct page *page, struct writeback_control *wbc,
429429
bio_end_io_t end_write_func);
430-
extern int swap_set_page_dirty(struct page *page);
430+
bool swap_dirty_folio(struct address_space *mapping, struct folio *folio);
431431

432432
int add_swap_extent(struct swap_info_struct *sis, unsigned long start_page,
433433
unsigned long nr_pages, sector_t start_block);

mm/page_io.c

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -438,19 +438,21 @@ int swap_readpage(struct page *page, bool synchronous)
438438
return ret;
439439
}
440440

441-
int swap_set_page_dirty(struct page *page)
441+
bool swap_dirty_folio(struct address_space *mapping, struct folio *folio)
442442
{
443-
struct swap_info_struct *sis = page_swap_info(page);
443+
struct swap_info_struct *sis = swp_swap_info(folio_swap_entry(folio));
444444

445445
if (data_race(sis->flags & SWP_FS_OPS)) {
446-
struct address_space *mapping = sis->swap_file->f_mapping;
447-
const struct address_space_operations *aops = mapping->a_ops;
446+
const struct address_space_operations *aops;
447+
448+
mapping = sis->swap_file->f_mapping;
449+
aops = mapping->a_ops;
448450

449-
VM_BUG_ON_PAGE(!PageSwapCache(page), page);
451+
VM_BUG_ON_FOLIO(!folio_test_swapcache(folio), folio);
450452
if (aops->dirty_folio)
451-
return aops->dirty_folio(mapping, page_folio(page));
452-
return aops->set_page_dirty(page);
453+
return aops->dirty_folio(mapping, folio);
454+
return aops->set_page_dirty(&folio->page);
453455
} else {
454-
return __set_page_dirty_no_writeback(page);
456+
return __set_page_dirty_no_writeback(&folio->page);
455457
}
456458
}

mm/swap_state.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@
3030
*/
3131
static const struct address_space_operations swap_aops = {
3232
.writepage = swap_writepage,
33-
.set_page_dirty = swap_set_page_dirty,
33+
.dirty_folio = swap_dirty_folio,
3434
#ifdef CONFIG_MIGRATION
3535
.migratepage = migrate_page,
3636
#endif

0 commit comments

Comments
 (0)