]> git.baikalelectronics.ru Git - kernel.git/commit
ext4: avoid unnecessary transaction starts during writeback
authorJan Kara <jack@suse.cz>
Mon, 25 May 2020 08:12:15 +0000 (10:12 +0200)
committerTheodore Ts'o <tytso@mit.edu>
Thu, 4 Jun 2020 03:16:56 +0000 (23:16 -0400)
commit5209f463975770b466ea1749fb9f3c23f906538a
treeb951c494c7e143086200904852bc48edae3c3140
parentccfd165059237cd9357eb9985b0d26bd5238b701
ext4: avoid unnecessary transaction starts during writeback

ext4_writepages() currently works in a loop like:
  start a transaction
  scan inode for pages to write
  map and submit these pages
  stop the transaction

This loop results in starting transaction once more than is needed
because in the last iteration we start a transaction only to scan the
inode and find there are no pages to write. This can be significant
increase in number of transaction starts for single-extent files or
files that have all blocks already mapped. Furthermore we already know
from previous iteration whether there are more pages to write or not. So
propagate the information from mpage_prepare_extent_to_map() and avoid
unnecessary looping in case there are no more pages to write.

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