]> git.baikalelectronics.ru Git - kernel.git/commit
ext4: Transfer initialized block to right neighbor if possible
authorLukas Czerner <lczerner@redhat.com>
Thu, 4 Apr 2013 03:33:27 +0000 (23:33 -0400)
committerTheodore Ts'o <tytso@mit.edu>
Thu, 4 Apr 2013 03:33:27 +0000 (23:33 -0400)
commit9bdb47ac143eddd87b04142b47d5e0a5e9454d1a
treeba5e07ee4abef21cc6b2618e01515c4350e4d854
parent6a17dc9f6327078f2e63a9acc4823c80e5f80120
ext4: Transfer initialized block to right neighbor if possible

Currently when converting extent to initialized we attempt to transfer
initialized block to the left neighbour if possible when certain
criteria are met. However we do not attempt to do the same for the
right neighbor.

This commit adds the possibility to transfer initialized block to the
right neighbour if:

1. We're not converting the whole extent
2. Both extents are stored in the same extent tree node
3. Right neighbor is initialized
4. Right neighbor is logically abutting the current one
5. Right neighbor is physically abutting the current one
6. Right neighbor would not overflow the length limit

This is basically the same logic as with transferring to the left. This
will gain us some performance benefits since it is faster than inserting
extent and then merging it.

It would also prevent some situation in delalloc patch when we might run
out of metadata reservation. This is due to the fact that we would
attempt to split the extent first (possibly allocating new metadata
block) even though we did not counted for that because it can (and will)
be merged again. This commit fix that scenario, because we no longer
need to split the extent in such case.

Signed-off-by: Lukas Czerner <lczerner@redhat.com>
fs/ext4/extents.c