ext4: move keep_towrite handling to ext4_bio_write_page()
authorJan Kara <jack@suse.cz>
Wed, 7 Dec 2022 11:27:05 +0000 (12:27 +0100)
committerTheodore Ts'o <tytso@mit.edu>
Fri, 9 Dec 2022 02:49:25 +0000 (21:49 -0500)
commitdff4ac75eeeefc4397fe7cf8ce559425bf46b1f7
tree89aa03b1966de1a8dcb907b1e76ebca61e897d50
parent04e568a3b31cfbd545c04c8bfc35c20e5ccfce0f
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>
fs/ext4/ext4.h
fs/ext4/inode.c
fs/ext4/page-io.c