]> rtime.felk.cvut.cz Git - linux-imx.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)
commitbc2d9db48c95ec6c9c5ecc97ddc61343d751f219
treeba5e07ee4abef21cc6b2618e01515c4350e4d854
parentbd86298e60b84b5e6d2da3e75c4ce2f6b70bdeed
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