]> git.ipfire.org Git - people/ms/linux.git/commit - fs/ext4/extents_status.c
ext4: reduce reserved cluster count by number of allocated clusters
authorEric Whitney <enwlinux@gmail.com>
Mon, 1 Oct 2018 18:24:08 +0000 (14:24 -0400)
committerTheodore Ts'o <tytso@mit.edu>
Mon, 1 Oct 2018 18:24:08 +0000 (14:24 -0400)
commitb6bf9171ef5c37b66d446378ba63af5339a56a97
tree7e82ed99dbf97e0516ef5aaf4064f76e7cb0d04f
parent0b02f4c0d6d9e2c611dfbdd4317193e9dca740e6
ext4: reduce reserved cluster count by number of allocated clusters

Ext4 does not always reduce the reserved cluster count by the number
of clusters allocated when mapping a delayed extent.  It sometimes
adds back one or more clusters after allocation if delalloc blocks
adjacent to the range allocated by ext4_ext_map_blocks() share the
clusters newly allocated for that range.  However, this overcounts
the number of clusters needed to satisfy future mapping requests
(holding one or more reservations for clusters that have already been
allocated) and premature ENOSPC and quota failures, etc., result.

Ext4 also does not reduce the reserved cluster count when allocating
clusters for non-delayed allocated writes that have previously been
reserved for delayed writes.  This also results in overcounts.

To make it possible to handle reserved cluster accounting for
fallocated regions in the same manner as used for other non-delayed
writes, do the reserved cluster accounting for them at the time of
allocation.  In the current code, this is only done later when a
delayed extent sharing the fallocated region is finally mapped.

Address comment correcting handling of unsigned long long constant
from Jan Kara's review of RFC version of this patch.

Signed-off-by: Eric Whitney <enwlinux@gmail.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
fs/ext4/extents.c
fs/ext4/extents_status.c
fs/ext4/extents_status.h