summaryrefslogtreecommitdiff
path: root/fs/ext4
diff options
context:
space:
mode:
authorJan Kara <jack@suse.cz>2023-03-29 17:49:34 +0200
committerTheodore Ts'o <tytso@mit.edu>2023-04-14 19:44:00 -0400
commit265e72efa99fcc0959f8d33d346a7e0f2e3fe201 (patch)
treeab248afbffd0fd0287710360fc49afe173405d40 /fs/ext4
parentd84c9ebdac1e39bc7b036c0c829ee8c1956edabc (diff)
ext4: Keep pages with journalled data dirty
Currently we clear page dirty bit when we checkpoint some buffers from a page with journalled data or when we perform delayed dirtying of a page in ext4_writepages(). In a quest to simplify handling of journalled data we want to keep page dirty as long as it has either buffers to checkpoint or journalled dirty data. So make sure to keep page dirty in ext4_writepages() if it still has journalled data attached to it. Signed-off-by: Jan Kara <jack@suse.cz> Link: https://lore.kernel.org/r/20230329154950.19720-3-jack@suse.cz Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Diffstat (limited to 'fs/ext4')
-rw-r--r--fs/ext4/inode.c1
-rw-r--r--fs/ext4/page-io.c6
2 files changed, 4 insertions, 3 deletions
diff --git a/fs/ext4/inode.c b/fs/ext4/inode.c
index c5de0c04204c..473226783d00 100644
--- a/fs/ext4/inode.c
+++ b/fs/ext4/inode.c
@@ -2393,7 +2393,6 @@ static int mpage_journal_page_buffers(handle_t *handle,
int len;
ClearPageChecked(page);
- clear_page_dirty_for_io(page);
mpd->wbc->nr_to_write--;
if (page->index == size >> PAGE_SHIFT &&
diff --git a/fs/ext4/page-io.c b/fs/ext4/page-io.c
index 8fe1875b0a42..2e5e94219693 100644
--- a/fs/ext4/page-io.c
+++ b/fs/ext4/page-io.c
@@ -479,9 +479,11 @@ int ext4_bio_write_folio(struct ext4_io_submit *io, struct folio *folio,
* to redirty the folio and keep TOWRITE tag so that
* racing WB_SYNC_ALL writeback does not skip the folio.
* This happens e.g. when doing writeout for
- * transaction commit.
+ * transaction commit or when journalled data is not
+ * yet committed.
*/
- if (buffer_dirty(bh)) {
+ if (buffer_dirty(bh) ||
+ (buffer_jbd(bh) && buffer_jbddirty(bh))) {
if (!folio_test_dirty(folio))
folio_redirty_for_writepage(wbc, folio);
keep_towrite = true;