diff options
author | Jan Kara <jack@suse.cz> | 2022-12-07 12:27:05 +0100 |
---|---|---|
committer | Theodore Ts'o <tytso@mit.edu> | 2022-12-08 21:49:25 -0500 |
commit | dff4ac75eeeefc4397fe7cf8ce559425bf46b1f7 (patch) | |
tree | 89aa03b1966de1a8dcb907b1e76ebca61e897d50 /fs/ext4/inode.c | |
parent | 04e568a3b31cfbd545c04c8bfc35c20e5ccfce0f (diff) | |
download | linux-dff4ac75eeeefc4397fe7cf8ce559425bf46b1f7.tar.gz linux-dff4ac75eeeefc4397fe7cf8ce559425bf46b1f7.tar.bz2 linux-dff4ac75eeeefc4397fe7cf8ce559425bf46b1f7.zip |
ext4: move keep_towrite handling to ext4_bio_write_page()
When we are writing back page but we cannot for some reason write all
its buffers (e.g. because we cannot allocate blocks in current context) we
have to keep TOWRITE tag set in the mapping as otherwise racing
WB_SYNC_ALL writeback that could write these buffers can skip the page
and result in data loss. We will need this logic for writeback during
transaction commit so move the logic from ext4_writepage() to
ext4_bio_write_page().
Reviewed-by: Ritesh Harjani (IBM) <ritesh.list@gmail.com>
Signed-off-by: Jan Kara <jack@suse.cz>
Link: https://lore.kernel.org/r/20221207112722.22220-2-jack@suse.cz
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Diffstat (limited to 'fs/ext4/inode.c')
-rw-r--r-- | fs/ext4/inode.c | 6 |
1 files changed, 2 insertions, 4 deletions
diff --git a/fs/ext4/inode.c b/fs/ext4/inode.c index a0f4d4197a0b..4c70cc525f10 100644 --- a/fs/ext4/inode.c +++ b/fs/ext4/inode.c @@ -2016,7 +2016,6 @@ static int ext4_writepage(struct page *page, struct buffer_head *page_bufs = NULL; struct inode *inode = page->mapping->host; struct ext4_io_submit io_submit; - bool keep_towrite = false; if (unlikely(ext4_forced_shutdown(EXT4_SB(inode->i_sb)))) { folio_invalidate(folio, 0, folio_size(folio)); @@ -2074,7 +2073,6 @@ static int ext4_writepage(struct page *page, unlock_page(page); return 0; } - keep_towrite = true; } if (PageChecked(page) && ext4_should_journal_data(inode)) @@ -2091,7 +2089,7 @@ static int ext4_writepage(struct page *page, unlock_page(page); return -ENOMEM; } - ret = ext4_bio_write_page(&io_submit, page, len, keep_towrite); + ret = ext4_bio_write_page(&io_submit, page, len); ext4_io_submit(&io_submit); /* Drop io_end reference we got from init */ ext4_put_io_end_defer(io_submit.io_end); @@ -2125,7 +2123,7 @@ static int mpage_submit_page(struct mpage_da_data *mpd, struct page *page) len = size & ~PAGE_MASK; else len = PAGE_SIZE; - err = ext4_bio_write_page(&mpd->io_submit, page, len, false); + err = ext4_bio_write_page(&mpd->io_submit, page, len); if (!err) mpd->wbc->nr_to_write--; mpd->first_page++; |