From: Eric Sandeen <sandeen@redhat.com>
To: Theodore Tso <tytso@mit.edu>
Cc: Andreas Dilger <adilger@sun.com>, linux-ext4@vger.kernel.org
Subject: Re: How to fix up mballoc
Date: Thu, 23 Jul 2009 21:18:27 -0500 [thread overview]
Message-ID: <4A6919F3.90103@redhat.com> (raw)
In-Reply-To: <20090724002317.GA14052@mit.edu>
Theodore Tso wrote:
> On Thu, Jul 23, 2009 at 12:43:47PM -0500, Eric Sandeen wrote:
>>> 1) In ext4_mb_normalize_request(), if the inode that we are allocating
>>> does not have any open file descriptors for write (i.e., it's already
>>> closed and we're allocating via delalloc) _and_ the inode was
>>> previously opened with O_CREAT and without O_APPEND (checked via a
>>> flag in EXT4_I(inode)), then do not normalize the size to a power of
>>> two, but rather to the filesystem blocksize.
>> I'm sort of woefully ignorant of a lot of the mballoc stuff.
>>
>> When you say once a file is written that's probably the final size... do
>> you mean when writes are done and it's closed, or when the first write
>> to the file is complete?
>>
>> I think an awful lot of normal cases write to a file in sub-file-sized
>> chunks (think mp3 or flac encoding, file downloading, etc).
>
> I meant when the writes are done and the files are closed; hence my
> proposal that we do this do #1 above only if there are no open file
> descriptors for write. That is, if the file can be written and closed
> by the userspace process before any delayed allocation blocks are
> attempted to be written by the filesystem, we can probably safely
> assume that the file won't grown in size later on.
Ah, ok. Sorry, I misunderstood. Yep, that seems reasonable.
It should probably get tested with workloads like video transcoding,
where there will be incremental writes that span many minutes or hours.
>> Also, I get the !O_APPEND test, but is O_CREAT necessary? I wonder how
>> much of a hint that really gives us.
>
> Well, it probably should be O_CREAT || O_TRUNC. The basic idea here is
> to distinguish between a file which gets appended to via syslog, or
> via a mail delivery program that writes 4k of data to the end of a
> mail spool file. In some cases, such as the mail delivery program, it
> might not use O_APPEND, but instead it might lock the file, seek to
> end of the file, and then right the 4k worth of e-mail. So if the
> file wasn't freshly created (or truncated) at the last open, maybe we
> should use a more aggressive preallocation --- and in the case of
> /var/mail spool delivery, perhaps the preallocation should persist
> beyond the file getting closed. (In the future we might want to have
> some hueristics where if we notice that the pattern of file writes is
> a repeated open, write-causing-block-allocation, close, maybe we
> should do some kind of block reservation style scheme while the
> filesystem is mounted and the inode stays in the inode cache.)
sounds fancy ;)
-Eric
> - Ted
next prev parent reply other threads:[~2009-07-24 2:18 UTC|newest]
Thread overview: 24+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-07-21 0:17 [PATCH] e2freefrag utility Andreas Dilger
2009-07-22 7:43 ` Theodore Tso
2009-07-23 4:59 ` Eric Sandeen
2009-07-23 13:45 ` How to fix up mballoc Theodore Tso
2009-07-23 17:43 ` Eric Sandeen
2009-07-24 0:23 ` Theodore Tso
2009-07-24 2:18 ` Eric Sandeen [this message]
2009-07-24 2:25 ` Eric Sandeen
2009-07-24 2:30 ` Andreas Dilger
2009-07-23 17:51 ` Mingming Cao
2009-07-24 0:43 ` Theodore Tso
2009-07-23 17:07 ` [PATCH] e2freefrag utility Andreas Dilger
2009-07-23 17:18 ` Eric Sandeen
2009-07-24 22:32 ` Theodore Tso
2009-07-24 23:14 ` Andreas Dilger
2009-07-25 0:18 ` Theodore Tso
2009-07-27 18:36 ` Andreas Dilger
2009-08-10 3:31 ` [PATCH 0/6] Patches to improve/fix e2freefrag Theodore Ts'o
2009-08-10 3:31 ` [PATCH 1/6] e2freefrag: Clarify e2freefrag's messages Theodore Ts'o
2009-08-10 3:31 ` [PATCH 2/6] e2freefrag: Do not print chunk-related information by default Theodore Ts'o
2009-08-10 3:31 ` [PATCH 3/6] e2freefrag: Fix to work correctly for file systems with 1kb block sizes Theodore Ts'o
2009-08-10 3:31 ` [PATCH 4/6] e2freefrag: Take into account the last free extent in the file system Theodore Ts'o
2009-08-10 3:31 ` [PATCH 5/6] Add V=1 support when linking e2freefrag in misc/Makefile.in Theodore Ts'o
2009-08-10 3:31 ` [PATCH 6/6] libext2fs: Treat uninitialized parts of bitmaps as unallocated Theodore Ts'o
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=4A6919F3.90103@redhat.com \
--to=sandeen@redhat.com \
--cc=adilger@sun.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).