diff options
author | 2021-03-08 16:43:04 -0500 | |
---|---|---|
committer | 2021-10-18 07:49:40 -0400 | |
commit | fdaf532a23795e320c47e1caab50a53c202135c5 (patch) | |
tree | 8c3d7d01b53dc1d7eb7a9c44b6fdc3d1e6733f12 /include | |
parent | mm/writeback: Add folio_account_cleaned() (diff) | |
download | linux-fdaf532a23795e320c47e1caab50a53c202135c5.tar.gz linux-fdaf532a23795e320c47e1caab50a53c202135c5.tar.bz2 linux-fdaf532a23795e320c47e1caab50a53c202135c5.zip |
mm/writeback: Add folio_cancel_dirty()
Turn __cancel_dirty_page() into __folio_cancel_dirty() and add wrappers.
Move the prototypes into pagemap.h since this is page cache functionality.
Saves 44 bytes of kernel text in total; 33 bytes from __folio_cancel_dirty
and 11 from two callers of cancel_dirty_page().
Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: David Howells <dhowells@redhat.com>
Acked-by: Vlastimil Babka <vbabka@suse.cz>
Diffstat (limited to 'include')
-rw-r--r-- | include/linux/mm.h | 7 | ||||
-rw-r--r-- | include/linux/pagemap.h | 11 |
2 files changed, 11 insertions, 7 deletions
diff --git a/include/linux/mm.h b/include/linux/mm.h index f47af4ca4873..3bc394aafbc0 100644 --- a/include/linux/mm.h +++ b/include/linux/mm.h @@ -2008,13 +2008,6 @@ int redirty_page_for_writepage(struct writeback_control *wbc, bool folio_mark_dirty(struct folio *folio); bool set_page_dirty(struct page *page); int set_page_dirty_lock(struct page *page); -void __cancel_dirty_page(struct page *page); -static inline void cancel_dirty_page(struct page *page) -{ - /* Avoid atomic ops, locking, etc. when not actually needed. */ - if (PageDirty(page)) - __cancel_dirty_page(page); -} int clear_page_dirty_for_io(struct page *page); int get_cmdline(struct task_struct *task, char *buffer, int buflen); diff --git a/include/linux/pagemap.h b/include/linux/pagemap.h index 8ba7da513ac4..8f4a9ba0bfb0 100644 --- a/include/linux/pagemap.h +++ b/include/linux/pagemap.h @@ -785,6 +785,17 @@ static inline void account_page_cleaned(struct page *page, { return folio_account_cleaned(page_folio(page), mapping, wb); } +void __folio_cancel_dirty(struct folio *folio); +static inline void folio_cancel_dirty(struct folio *folio) +{ + /* Avoid atomic ops, locking, etc. when not actually needed. */ + if (folio_test_dirty(folio)) + __folio_cancel_dirty(folio); +} +static inline void cancel_dirty_page(struct page *page) +{ + folio_cancel_dirty(page_folio(page)); +} int __set_page_dirty_nobuffers(struct page *page); int __set_page_dirty_no_writeback(struct page *page); |