From: Dmitry Monakhov <dmonakhov@openvz.org>
To: ext4 development <linux-ext4@vger.kernel.org>
Cc: Theodore Ts'o <tytso@mit.edu>, Lukas Czerner <lczerner@redhat.com>
Subject: fine grain block allocation API request
Date: Wed, 13 Aug 2014 17:45:21 +0400 [thread overview]
Message-ID: <87bnrosdu6.fsf@openvz.org> (raw)
Currently we have not public API for block allocation from some
specific region (group/flex_group/blk_range). The only existing
hack is available in migrate.c where we use goal_inode for
ext4_new_inode().
In fact this tend make some specific task very complicated.
For example my e4defrag2 utility try to compact small files from
one group together. In order to allocate blocks from given group
I have to perform number of crazy stuff, such as:
1) Prepare cache of directories according to it's group (where dir_inode
is placed)
2) Try to allocate local donor file with local blocks (from given group)
Pseudo code of donor creation procedure :
int find_donor(int grp, ...) {
for (i = 0; i = dir_cache[grp].num;i++) {
fd = openat(dir_cache[grp].fd[i], "donor", O_CREAT|flags,... )
fstat(fd, &stat);
if (inode_group(stat->st_ino) != grp)
goto next_candidate;
do_falloc(fd, size);
/* Check that blocks we allocated are belongs to group we want*/
if (!is_block_local(fd, group))
goto next_candidate;
goto found_donor;
.....
}
.....
}
All this machinery is very ugly, unstable and increase code-base about
500-700 lines of code. And I want to ask you why we do not have such
API? AFAIR this API was requested several times, but it was rejected.
I do understand that this is not good idea to allow unprivileged user to
manipulate block allocator, but IMHO we can hide it under CAP_RESOURCES
or CAP_ADMIN.
Please tell be your opinion. I'll happy to implement that ioctl.
next reply other threads:[~2014-08-13 13:45 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-08-13 13:45 Dmitry Monakhov [this message]
2014-08-13 20:38 ` fine grain block allocation API request Andreas Dilger
2014-08-14 6:48 ` Dmitry Monakhov
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=87bnrosdu6.fsf@openvz.org \
--to=dmonakhov@openvz.org \
--cc=lczerner@redhat.com \
--cc=linux-ext4@vger.kernel.org \
--cc=tytso@mit.edu \
/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).