History

mm: Convert swap_set_page_dirty() to swap_dirty_folio()

Straightforward conversion.

Matthew Wilcox (Oracle) committed 4 years ago

Commit 7e63df01 parent 1f1d14d3 files · +12 −10Browse files

Unified · Split

3 files
  1. include/linux/swap.h +1 −1
  2. mm/page_io.c +10 −8
  3. mm/swap_state.c +1 −1
include/linux/swap.h+1−1
@@ -427,7 +427,7 @@ extern int swap_writepage(struct page *page, struct writeback_control *wbc); · 426 unmodified lines
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+10−8
@@ -438,19 +438,21 @@ out: · 437 unmodified lines
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+1−1
@@ -30,7 +30,7 @@ · 29 unmodified lines
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

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t