From: Lukas Czerner <lczerner@redhat.com>
To: linux-ext4@vger.kernel.org
Subject: [RFC][PATCH 0/1] ext4: Fix ext4_mb_normalize_request
Date: Fri, 13 Jun 2014 15:55:35 +0200 [thread overview]
Message-ID: <1402667736-7843-1-git-send-email-lczerner@redhat.com> (raw)
This is my first attempt to fix the ext4_mb_normalize_request() function in
in ext4 which deals with file preallocations.
This is not yet a final version as it needs more testing, however I'd like
to see some suggestions.
Currently there are couple of problems with ext4_mb_normalize_request().
- We're trying to normalize unwritten extents allocation which is
entirely unnecessary, because user exactly knows what how much space
he is going to need - no need for file system to do preallocations.
- ext4_mb_normalize_request() unnecessarily divides bigger allocation
requests to small ones (8MB). I believe that this is a bug rather than
design.
- For smaller allocations (or smaller files) we do not even respect the
fe_logical. Although we do respect it for bigger files.
- Overall the logic within ext4_mb_normalize_request() is weird and
no-one really understand why it is the way it is.
Fix all of this by:
- Disabling preallocation for unwritten extent allocation. However
because the maximum size of the unwritten extent is one block smaller
than written, in order to avoid unnecessary fragmentation we limit the
request to EXT_INIT_MAX_LEN / 2
- Get rid of the "if table" in ext4_mb_normalize_request() and replace
it with simply aligning the assumed end of the file up to power of
two. But we still limit the allocation size to EXT4_BLOCKS_PER_GROUP.
Also do this on file system block units to take into account different
block sized file systems.
It passes xfstests cleanly in default configuration, I've not tried any
non-default options yet.
I've tried to test how much it changes allocation. The test and some results
can be found at
http://people.redhat.com/lczerner/mballoc/
normalize.sh is the simple script I run and output.normalize_orig[34]
contains result from the vanila 3.15.0 while output.normalize_patch[56]
contains results with this patch.
>From the performance stand point I do not see any major differences except
that untar seems to always generate better results (which might be because
of bigger continuous extents).
Free space fragmentation seems to be about the same, however with the patch
there seems to be less smaller free space extents and more bigger ones which
is expected due to bigger preallocations (and I think it's a good thing).
The biggest difference which is obvious from the results is that extent tree
is much smaller (sometimes five times smaller) with the patch. Except of the
fallocate case because we now limit the requests to (EXT_INIT_MAX_LEN / 2)
so we can not merge them - it might be worth experimenting with something
smaller which is a factor of unwritten extent size.
But as I said the extent tree is much smaller which means that the extents
overall are bigger which again is a good thing. This becomes very obvious
when we look at the extent tree of the image file (the last steps in the
test).
What do you think ?
Thanks!
-Lukas
next reply other threads:[~2014-06-13 13:55 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-06-13 13:55 Lukas Czerner [this message]
2014-06-13 13:55 ` [PATCH 1/1] ext4: Fix ext4_mb_normalize_request Lukas Czerner
2014-06-24 12:36 ` [RFC][PATCH 0/1] " Lukáš Czerner
2014-06-24 16:25 ` Andreas Dilger
2014-06-25 13:43 ` Lukáš Czerner
2014-06-25 14:20 ` Lukáš Czerner
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1402667736-7843-1-git-send-email-lczerner@redhat.com \
--to=lczerner@redhat.com \
--cc=linux-ext4@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).