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

Configure Feed

Select the types of activity you want to include in your feed.

nilfs2: add nilfs_end_folio_io()

Patch series "nilfs2: Folio conversions for file paths".

This series advances page->folio conversions for a wide range of nilfs2,
including its file operations, block routines, and the log writer's
writeback routines. It doesn't cover large folios support, but it saves a
lot of hidden compound_head() calls while preserving the existing support
range behavior.

The original series in post [1] also covered directory-related page->folio
conversions, but that was put on hold because a regression was found in
testing, so this is an excerpt from the first half of the original post.

[1] https://lkml.kernel.org/r/20231106173903.1734114-1-willy@infradead.org

I tested this series in both 32-bit and 64-bit environments, switching
between normal and small block sizes. I also reviewed all changes in all
patches to ensure they do not break existing behavior. There were no
problems.


This patch (of 20):

This is the folio counterpart of the existing nilfs_end_page_io() which is
retained as a wrapper of nilfs_end_folio_io(). Replaces nine hidden calls
to compound_head() with one.

Link: https://lkml.kernel.org/r/20231114084436.2755-1-konishi.ryusuke@gmail.com
Link: https://lkml.kernel.org/r/20231114084436.2755-2-konishi.ryusuke@gmail.com
Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org>
Signed-off-by: Ryusuke Konishi <konishi.ryusuke@gmail.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>

authored by

Matthew Wilcox (Oracle) and committed by
Andrew Morton
8f46eaf6 12427de9

+22 -14
+22 -14
fs/nilfs2/segment.c
··· 1739 1739 return ret; 1740 1740 } 1741 1741 1742 - static void nilfs_end_page_io(struct page *page, int err) 1742 + static void nilfs_end_folio_io(struct folio *folio, int err) 1743 1743 { 1744 - if (!page) 1744 + if (!folio) 1745 1745 return; 1746 1746 1747 - if (buffer_nilfs_node(page_buffers(page)) && !PageWriteback(page)) { 1747 + if (buffer_nilfs_node(folio_buffers(folio)) && 1748 + !folio_test_writeback(folio)) { 1748 1749 /* 1749 1750 * For b-tree node pages, this function may be called twice 1750 1751 * or more because they might be split in a segment. 1751 1752 */ 1752 - if (PageDirty(page)) { 1753 + if (folio_test_dirty(folio)) { 1753 1754 /* 1754 1755 * For pages holding split b-tree node buffers, dirty 1755 1756 * flag on the buffers may be cleared discretely. ··· 1758 1757 * remaining buffers, and it must be cancelled if 1759 1758 * all the buffers get cleaned later. 1760 1759 */ 1761 - lock_page(page); 1762 - if (nilfs_page_buffers_clean(page)) 1763 - __nilfs_clear_page_dirty(page); 1764 - unlock_page(page); 1760 + folio_lock(folio); 1761 + if (nilfs_page_buffers_clean(&folio->page)) 1762 + __nilfs_clear_page_dirty(&folio->page); 1763 + folio_unlock(folio); 1765 1764 } 1766 1765 return; 1767 1766 } 1768 1767 1769 1768 if (!err) { 1770 - if (!nilfs_page_buffers_clean(page)) 1771 - __set_page_dirty_nobuffers(page); 1772 - ClearPageError(page); 1769 + if (!nilfs_page_buffers_clean(&folio->page)) 1770 + filemap_dirty_folio(folio->mapping, folio); 1771 + folio_clear_error(folio); 1773 1772 } else { 1774 - __set_page_dirty_nobuffers(page); 1775 - SetPageError(page); 1773 + filemap_dirty_folio(folio->mapping, folio); 1774 + folio_set_error(folio); 1776 1775 } 1777 1776 1778 - end_page_writeback(page); 1777 + folio_end_writeback(folio); 1778 + } 1779 + 1780 + static void nilfs_end_page_io(struct page *page, int err) 1781 + { 1782 + if (!page) 1783 + return; 1784 + nilfs_end_folio_io(page_folio(page), err); 1779 1785 } 1780 1786 1781 1787 static void nilfs_abort_logs(struct list_head *logs, int err)