ext4: reset retry counter when ext4_alloc_file_blocks() makes progress
authorEric Whitney <enwlinux@gmail.com>
Wed, 13 Jan 2021 22:14:03 +0000 (17:14 -0500)
committerTheodore Ts'o <tytso@mit.edu>
Mon, 8 Feb 2021 23:03:56 +0000 (18:03 -0500)
commit3258386aba670e3406a499d2d0b7395e14c8d097
tree5e87e98a11a72b4a7443a273bd4034a782793488
parentb5776e7524afbd4569978ff790864755c438bba7
ext4: reset retry counter when ext4_alloc_file_blocks() makes progress

Change the retry policy in ext4_alloc_file_blocks() to allow for a full
retry cycle whenever a portion of an allocation request has been
fulfilled.  A large allocation request often results in multiple calls
to ext4_map_blocks(), each of which is potentially subject to a
temporary ENOSPC condition and retry cycle.  The current code only
allows for a single retry cycle.

This patch does not address a known bug or reported complaint.
However, it should make block allocation for fallocate and zero range
more robust.

In addition, simplify the conditional controlling the allocation while
loop, where testing len alone is sufficient.  Remove the assignment to
ret2 in the error path after the call to ext4_map_blocks() since its
value isn't subsequently used.

Signed-off-by: Eric Whitney <enwlinux@gmail.com>
Link: https://lore.kernel.org/r/20210113221403.18258-1-enwlinux@gmail.com
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
fs/ext4/extents.c