summaryrefslogtreecommitdiff
path: root/fs/ext4
diff options
context:
space:
mode:
authorJan Kara <jack@suse.cz>2023-03-29 17:49:35 +0200
committerTheodore Ts'o <tytso@mit.edu>2023-04-14 19:55:44 -0400
commit5e1bdea6391d09fde424a1406a04e01b208a04d2 (patch)
tree4b0f8a279c4564181402685b55395a160dd8db53 /fs/ext4
parent265e72efa99fcc0959f8d33d346a7e0f2e3fe201 (diff)
downloadlinux-5e1bdea6391d09fde424a1406a04e01b208a04d2.tar.gz
ext4: Clear dirty bit from pages without data to write
With journalled data it can happen that checkpointing code will write out page contents without clearing the page dirty bit. The logic in ext4_page_nomap_can_writeout() then results in us never calling mpage_submit_page() and thus clearing the dirty bit. Drop the optimization with ext4_page_nomap_can_writeout() and just always call to mpage_submit_page(). ext4_bio_write_page() knows when to redirty the page and the additional clearing & setting of page dirty bit for ordered mode writeout is not that expensive to jump through the hoops for it. Signed-off-by: Jan Kara <jack@suse.cz> Link: https://lore.kernel.org/r/20230329154950.19720-4-jack@suse.cz Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Diffstat (limited to 'fs/ext4')
-rw-r--r--fs/ext4/inode.c25
1 files changed, 5 insertions, 20 deletions
diff --git a/fs/ext4/inode.c b/fs/ext4/inode.c
index 473226783d00..bca86f8f1594 100644
--- a/fs/ext4/inode.c
+++ b/fs/ext4/inode.c
@@ -2348,19 +2348,6 @@ static int ext4_da_writepages_trans_blocks(struct inode *inode)
MAX_WRITEPAGES_EXTENT_LEN + bpp - 1, bpp);
}
-/* Return true if the folio needs to be written as part of transaction commit */
-static bool ext4_folio_nomap_can_writeout(struct folio *folio)
-{
- struct buffer_head *bh, *head;
-
- bh = head = folio_buffers(folio);
- do {
- if (buffer_dirty(bh) && buffer_mapped(bh) && !buffer_delay(bh))
- return true;
- } while ((bh = bh->b_this_page) != head);
- return false;
-}
-
static int ext4_journal_page_buffers(handle_t *handle, struct page *page,
int len)
{
@@ -2545,13 +2532,11 @@ static int mpage_prepare_extent_to_map(struct mpage_da_data *mpd)
* range operations before discarding the page cache.
*/
if (!mpd->can_map) {
- if (ext4_folio_nomap_can_writeout(folio)) {
- WARN_ON_ONCE(sb->s_writers.frozen ==
- SB_FREEZE_COMPLETE);
- err = mpage_submit_folio(mpd, folio);
- if (err < 0)
- goto out;
- }
+ WARN_ON_ONCE(sb->s_writers.frozen ==
+ SB_FREEZE_COMPLETE);
+ err = mpage_submit_folio(mpd, folio);
+ if (err < 0)
+ goto out;
/* Pending dirtying of journalled data? */
if (folio_test_checked(folio)) {
WARN_ON_ONCE(sb->s_writers.frozen >=