]> git.baikalelectronics.ru Git - kernel.git/commit
ext4: grab page before starting transaction handle in write_begin()
authorTheodore Ts'o <tytso@mit.edu>
Sat, 9 Feb 2013 14:24:14 +0000 (09:24 -0500)
committerTheodore Ts'o <tytso@mit.edu>
Sat, 9 Feb 2013 14:24:14 +0000 (09:24 -0500)
commitbfd588293f3cb6479464916b4fc31a58d76ffa3d
tree5e2bdd86884e37afbb397ff509d2755cea451372
parentf056b932a07389ad6c57a19fc9c73cadda568404
ext4: grab page before starting transaction handle in write_begin()

The grab_cache_page_write_begin() function can potentially sleep for a
long time, since it may need to do memory allocation which can block
if the system is under significant memory pressure, and because it may
be blocked on page writeback.  If it does take a long time to grab the
page, it's better that we not hold an active jbd2 handle.

So grab a handle on the page first, and _then_ start the transaction
handle.

This commit fixes the following long transaction handle hold time:

postmark-2917  [000] ....   196.435786: jbd2_handle_stats: dev 254,32
   tid 570 type 2 line_no 2541 interval 311 sync 0 requested_blocks 1
   dirtied_blocks 0

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
Reviewed-by: Jan Kara <jack@suse.cz>
fs/ext4/inode.c