ext4: Mark page for delayed dirtying only if it is pinned
authorJan Kara <jack@suse.cz>
Tue, 28 Feb 2023 05:13:15 +0000 (00:13 -0500)
committerTheodore Ts'o <tytso@mit.edu>
Thu, 23 Mar 2023 14:06:07 +0000 (10:06 -0400)
commit3f5d30636d2a188ee3cd22c6fef1ace5304a07bf
treee89e6521b5431ffe7124b8d40943f0df599a93e9
parentc8e8e16dbbf0840e6f41575c3d6158bd331218bc
ext4: Mark page for delayed dirtying only if it is pinned

In data=journal mode, page should be dirtied only when it has buffers
for checkpoint or it is writeably mapped. In the first case, we don't
need to do anything special. In the second case, page was already added
to the journal by ext4_page_mkwrite() and since transaction commit
writeprotects mapped pages again, page should be writeable (and thus
dirtied) only while it is part of the running transaction. So nothing
needs to be done either. The only special case is when someone pins the
page and uses this pin for modifying page data. So recognize this
special case and only then mark the page as having data that needs
adding to the journal.

Signed-off-by: Jan Kara <jack@suse.cz>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Link: https://lore.kernel.org/r/20230228051319.4085470-4-tytso@mit.edu
fs/ext4/inode.c