diff mbox series

[2/6] mm/writeback: Use __set_page_dirty in __set_page_dirty_nobuffers

Message ID 20210615162342.1669332-3-willy@infradead.org (mailing list archive)
State New, archived
Headers show
Series Further set_page_dirty cleanups | expand

Commit Message

Matthew Wilcox June 15, 2021, 4:23 p.m. UTC
This is fundamentally the same code, so just call it instead of
duplicating it.

Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org>
---
 mm/page-writeback.c | 10 +---------
 1 file changed, 1 insertion(+), 9 deletions(-)

Comments

Christoph Hellwig June 15, 2021, 4:35 p.m. UTC | #1
On Tue, Jun 15, 2021 at 05:23:38PM +0100, Matthew Wilcox (Oracle) wrote:
> This is fundamentally the same code, so just call it instead of
> duplicating it.
> 
> Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org>

Looks good,

Reviewed-by: Christoph Hellwig <hch@lst.de>
Greg Kroah-Hartman June 15, 2021, 5:18 p.m. UTC | #2
On Tue, Jun 15, 2021 at 05:23:38PM +0100, Matthew Wilcox (Oracle) wrote:
> This is fundamentally the same code, so just call it instead of
> duplicating it.
> 
> Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org>
> ---
>  mm/page-writeback.c | 10 +---------

Reviewed-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
diff mbox series

Patch

diff --git a/mm/page-writeback.c b/mm/page-writeback.c
index 0c2c8355f97f..980a6cb9cbd9 100644
--- a/mm/page-writeback.c
+++ b/mm/page-writeback.c
@@ -2503,20 +2503,12 @@  int __set_page_dirty_nobuffers(struct page *page)
 	lock_page_memcg(page);
 	if (!TestSetPageDirty(page)) {
 		struct address_space *mapping = page_mapping(page);
-		unsigned long flags;
 
 		if (!mapping) {
 			unlock_page_memcg(page);
 			return 1;
 		}
-
-		xa_lock_irqsave(&mapping->i_pages, flags);
-		BUG_ON(page_mapping(page) != mapping);
-		WARN_ON_ONCE(!PagePrivate(page) && !PageUptodate(page));
-		account_page_dirtied(page, mapping);
-		__xa_set_mark(&mapping->i_pages, page_index(page),
-				   PAGECACHE_TAG_DIRTY);
-		xa_unlock_irqrestore(&mapping->i_pages, flags);
+		__set_page_dirty(page, mapping, !PagePrivate(page));
 		unlock_page_memcg(page);
 
 		if (mapping->host) {