Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

mm: remove folio_account_redirty

Fold folio_account_redirty into folio_redirty_for_writepage now
that all other users except for the also unused account_page_redirty
wrapper are gone.

Reviewed-by: Josef Bacik <josef@toxicpanda.com>
Reviewed-by: Matthew Wilcox (Oracle) <willy@infradead.org>
Signed-off-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: David Sterba <dsterba@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>

authored by

Christoph Hellwig and committed by
David Sterba
ed2da924 256b0cf9

+14 -40
-5
include/linux/writeback.h
··· 375 375 pgoff_t start, pgoff_t end); 376 376 377 377 bool filemap_dirty_folio(struct address_space *mapping, struct folio *folio); 378 - void folio_account_redirty(struct folio *folio); 379 - static inline void account_page_redirty(struct page *page) 380 - { 381 - folio_account_redirty(page_folio(page)); 382 - } 383 378 bool folio_redirty_for_writepage(struct writeback_control *, struct folio *); 384 379 bool redirty_page_for_writepage(struct writeback_control *, struct page *); 385 380
+14 -35
mm/page-writeback.c
··· 1193 1193 * write_bandwidth = --------------------------------------------------- 1194 1194 * period 1195 1195 * 1196 - * @written may have decreased due to folio_account_redirty(). 1196 + * @written may have decreased due to folio_redirty_for_writepage(). 1197 1197 * Avoid underflowing @bw calculation. 1198 1198 */ 1199 1199 bw = written - min(written, wb->written_stamp); ··· 2712 2712 EXPORT_SYMBOL(filemap_dirty_folio); 2713 2713 2714 2714 /** 2715 - * folio_account_redirty - Manually account for redirtying a page. 2716 - * @folio: The folio which is being redirtied. 2717 - * 2718 - * Most filesystems should call folio_redirty_for_writepage() instead 2719 - * of this fuction. If your filesystem is doing writeback outside the 2720 - * context of a writeback_control(), it can call this when redirtying 2721 - * a folio, to de-account the dirty counters (NR_DIRTIED, WB_DIRTIED, 2722 - * tsk->nr_dirtied), so that they match the written counters (NR_WRITTEN, 2723 - * WB_WRITTEN) in long term. The mismatches will lead to systematic errors 2724 - * in balanced_dirty_ratelimit and the dirty pages position control. 2725 - */ 2726 - void folio_account_redirty(struct folio *folio) 2727 - { 2728 - struct address_space *mapping = folio->mapping; 2729 - 2730 - if (mapping && mapping_can_writeback(mapping)) { 2731 - struct inode *inode = mapping->host; 2732 - struct bdi_writeback *wb; 2733 - struct wb_lock_cookie cookie = {}; 2734 - long nr = folio_nr_pages(folio); 2735 - 2736 - wb = unlocked_inode_to_wb_begin(inode, &cookie); 2737 - current->nr_dirtied -= nr; 2738 - node_stat_mod_folio(folio, NR_DIRTIED, -nr); 2739 - wb_stat_mod(wb, WB_DIRTIED, -nr); 2740 - unlocked_inode_to_wb_end(inode, &cookie); 2741 - } 2742 - } 2743 - EXPORT_SYMBOL(folio_account_redirty); 2744 - 2745 - /** 2746 2715 * folio_redirty_for_writepage - Decline to write a dirty folio. 2747 2716 * @wbc: The writeback control. 2748 2717 * @folio: The folio. ··· 2726 2757 bool folio_redirty_for_writepage(struct writeback_control *wbc, 2727 2758 struct folio *folio) 2728 2759 { 2729 - bool ret; 2760 + struct address_space *mapping = folio->mapping; 2730 2761 long nr = folio_nr_pages(folio); 2762 + bool ret; 2731 2763 2732 2764 wbc->pages_skipped += nr; 2733 - ret = filemap_dirty_folio(folio->mapping, folio); 2734 - folio_account_redirty(folio); 2765 + ret = filemap_dirty_folio(mapping, folio); 2766 + if (mapping && mapping_can_writeback(mapping)) { 2767 + struct inode *inode = mapping->host; 2768 + struct bdi_writeback *wb; 2769 + struct wb_lock_cookie cookie = {}; 2735 2770 2771 + wb = unlocked_inode_to_wb_begin(inode, &cookie); 2772 + current->nr_dirtied -= nr; 2773 + node_stat_mod_folio(folio, NR_DIRTIED, -nr); 2774 + wb_stat_mod(wb, WB_DIRTIED, -nr); 2775 + unlocked_inode_to_wb_end(inode, &cookie); 2776 + } 2736 2777 return ret; 2737 2778 } 2738 2779 EXPORT_SYMBOL(folio_redirty_for_writepage);