Skip to content

Commit 187c82c

Browse files
author
Matthew Wilcox (Oracle)
committed
fs: Convert trivial uses of __set_page_dirty_nobuffers to filemap_dirty_folio
These filesystems use __set_page_dirty_nobuffers() either directly or with a very thin wrapper; convert them en masse. Signed-off-by: Matthew Wilcox (Oracle) <[email protected]> Tested-by: Damien Le Moal <[email protected]> Acked-by: Damien Le Moal <[email protected]> Tested-by: Mike Marshall <[email protected]> # orangefs Tested-by: David Howells <[email protected]> # afs
1 parent 0079c3b commit 187c82c

File tree

12 files changed

+23
-28
lines changed

12 files changed

+23
-28
lines changed

fs/btrfs/inode.c

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10077,11 +10077,6 @@ int btrfs_prealloc_file_range_trans(struct inode *inode,
1007710077
min_size, actual_len, alloc_hint, trans);
1007810078
}
1007910079

10080-
static int btrfs_set_page_dirty(struct page *page)
10081-
{
10082-
return __set_page_dirty_nobuffers(page);
10083-
}
10084-
1008510080
static int btrfs_permission(struct user_namespace *mnt_userns,
1008610081
struct inode *inode, int mask)
1008710082
{
@@ -10644,7 +10639,7 @@ static const struct address_space_operations btrfs_aops = {
1064410639
#ifdef CONFIG_MIGRATION
1064510640
.migratepage = btrfs_migratepage,
1064610641
#endif
10647-
.set_page_dirty = btrfs_set_page_dirty,
10642+
.dirty_folio = filemap_dirty_folio,
1064810643
.error_remove_page = generic_error_remove_page,
1064910644
.swap_activate = btrfs_swap_activate,
1065010645
.swap_deactivate = btrfs_swap_deactivate,

fs/ext4/inode.c

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -3541,22 +3541,23 @@ const struct iomap_ops ext4_iomap_report_ops = {
35413541
};
35423542

35433543
/*
3544-
* Pages can be marked dirty completely asynchronously from ext4's journalling
3545-
* activity. By filemap_sync_pte(), try_to_unmap_one(), etc. We cannot do
3546-
* much here because ->set_page_dirty is called under VFS locks. The page is
3547-
* not necessarily locked.
3544+
* Folios can be marked dirty completely asynchronously from ext4's
3545+
* journalling activity. By filemap_sync_pte(), try_to_unmap_one(), etc.
3546+
* We cannot do much here because ->dirty_folio may be called with the
3547+
* page table lock held. The folio is not necessarily locked.
35483548
*
3549-
* We cannot just dirty the page and leave attached buffers clean, because the
3549+
* We cannot just dirty the folio and leave attached buffers clean, because the
35503550
* buffers' dirty state is "definitive". We cannot just set the buffers dirty
35513551
* or jbddirty because all the journalling code will explode.
35523552
*
3553-
* So what we do is to mark the page "pending dirty" and next time writepage
3553+
* So what we do is to mark the folio "pending dirty" and next time writepage
35543554
* is called, propagate that into the buffers appropriately.
35553555
*/
3556-
static int ext4_journalled_set_page_dirty(struct page *page)
3556+
static bool ext4_journalled_dirty_folio(struct address_space *mapping,
3557+
struct folio *folio)
35573558
{
3558-
SetPageChecked(page);
3559-
return __set_page_dirty_nobuffers(page);
3559+
folio_set_checked(folio);
3560+
return filemap_dirty_folio(mapping, folio);
35603561
}
35613562

35623563
static int ext4_set_page_dirty(struct page *page)
@@ -3598,7 +3599,7 @@ static const struct address_space_operations ext4_journalled_aops = {
35983599
.writepages = ext4_writepages,
35993600
.write_begin = ext4_write_begin,
36003601
.write_end = ext4_journalled_write_end,
3601-
.set_page_dirty = ext4_journalled_set_page_dirty,
3602+
.dirty_folio = ext4_journalled_dirty_folio,
36023603
.bmap = ext4_bmap,
36033604
.invalidate_folio = ext4_journalled_invalidate_folio,
36043605
.releasepage = ext4_releasepage,

fs/fuse/file.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3162,7 +3162,7 @@ static const struct address_space_operations fuse_file_aops = {
31623162
.writepage = fuse_writepage,
31633163
.writepages = fuse_writepages,
31643164
.launder_folio = fuse_launder_folio,
3165-
.set_page_dirty = __set_page_dirty_nobuffers,
3165+
.dirty_folio = filemap_dirty_folio,
31663166
.bmap = fuse_bmap,
31673167
.direct_IO = fuse_direct_IO,
31683168
.write_begin = fuse_write_begin,

fs/gfs2/aops.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -780,7 +780,7 @@ static const struct address_space_operations gfs2_aops = {
780780
.writepages = gfs2_writepages,
781781
.readpage = gfs2_readpage,
782782
.readahead = gfs2_readahead,
783-
.set_page_dirty = __set_page_dirty_nobuffers,
783+
.dirty_folio = filemap_dirty_folio,
784784
.releasepage = iomap_releasepage,
785785
.invalidate_folio = iomap_invalidate_folio,
786786
.bmap = gfs2_bmap,

fs/hostfs/hostfs_kern.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
#include <linux/statfs.h>
1515
#include <linux/slab.h>
1616
#include <linux/seq_file.h>
17+
#include <linux/writeback.h>
1718
#include <linux/mount.h>
1819
#include <linux/namei.h>
1920
#include "hostfs.h"
@@ -504,7 +505,7 @@ static int hostfs_write_end(struct file *file, struct address_space *mapping,
504505
static const struct address_space_operations hostfs_aops = {
505506
.writepage = hostfs_writepage,
506507
.readpage = hostfs_readpage,
507-
.set_page_dirty = __set_page_dirty_nobuffers,
508+
.dirty_folio = filemap_dirty_folio,
508509
.write_begin = hostfs_write_begin,
509510
.write_end = hostfs_write_end,
510511
};

fs/jfs/jfs_metapage.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -570,7 +570,7 @@ const struct address_space_operations jfs_metapage_aops = {
570570
.writepage = metapage_writepage,
571571
.releasepage = metapage_releasepage,
572572
.invalidate_folio = metapage_invalidate_folio,
573-
.set_page_dirty = __set_page_dirty_nobuffers,
573+
.dirty_folio = filemap_dirty_folio,
574574
};
575575

576576
struct metapage *__get_metapage(struct inode *inode, unsigned long lblock,

fs/nfs/file.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -515,7 +515,7 @@ static void nfs_swap_deactivate(struct file *file)
515515
const struct address_space_operations nfs_file_aops = {
516516
.readpage = nfs_readpage,
517517
.readpages = nfs_readpages,
518-
.set_page_dirty = __set_page_dirty_nobuffers,
518+
.dirty_folio = filemap_dirty_folio,
519519
.writepage = nfs_writepage,
520520
.writepages = nfs_writepages,
521521
.write_begin = nfs_write_begin,

fs/ntfs/aops.c

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1684,9 +1684,7 @@ const struct address_space_operations ntfs_mst_aops = {
16841684
.readpage = ntfs_readpage, /* Fill page with data. */
16851685
#ifdef NTFS_RW
16861686
.writepage = ntfs_writepage, /* Write dirty page to disk. */
1687-
.set_page_dirty = __set_page_dirty_nobuffers, /* Set the page dirty
1688-
without touching the buffers
1689-
belonging to the page. */
1687+
.dirty_folio = filemap_dirty_folio,
16901688
#endif /* NTFS_RW */
16911689
.migratepage = buffer_migrate_page,
16921690
.is_partially_uptodate = block_is_partially_uptodate,

fs/orangefs/inode.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -634,7 +634,7 @@ static const struct address_space_operations orangefs_address_operations = {
634634
.readahead = orangefs_readahead,
635635
.readpage = orangefs_readpage,
636636
.writepages = orangefs_writepages,
637-
.set_page_dirty = __set_page_dirty_nobuffers,
637+
.dirty_folio = filemap_dirty_folio,
638638
.write_begin = orangefs_write_begin,
639639
.write_end = orangefs_write_end,
640640
.invalidate_folio = orangefs_invalidate_folio,

fs/vboxsf/file.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -354,7 +354,7 @@ static int vboxsf_write_end(struct file *file, struct address_space *mapping,
354354
const struct address_space_operations vboxsf_reg_aops = {
355355
.readpage = vboxsf_readpage,
356356
.writepage = vboxsf_writepage,
357-
.set_page_dirty = __set_page_dirty_nobuffers,
357+
.dirty_folio = filemap_dirty_folio,
358358
.write_begin = simple_write_begin,
359359
.write_end = vboxsf_write_end,
360360
};

0 commit comments

Comments
 (0)