From: Andrew Morton <akpm@zip.com.au>
To: Linus Torvalds <torvalds@transmeta.com>
Cc: Chris Mason <mason@suse.com>, lkml <linux-kernel@vger.kernel.org>
Subject: Re: [patch 12/16] fix race between writeback and unlink
Date: Tue, 04 Jun 2002 13:15:44 -0700 [thread overview]
Message-ID: <3CFD1FF0.4A02CE96@zip.com.au> (raw)
In-Reply-To: <3CFBEDEE.EE74C5B1@zip.com.au> <Pine.LNX.4.44.0206041142390.954-100000@home.transmeta.com>
Linus Torvalds wrote:
>
> On Mon, 3 Jun 2002, Andrew Morton wrote:
> >
> > But why does ext2_put_inode() even exist? We're already throwing
> > away the prealloc window in ext2_release_file? I guess for
> > shared mappings over spares files: if all file handles have
> > closed off, we still need to make allocations against that
> > inode, yes?
>
> Shared mappings still hold the "struct file" open (you have
> "vma->vm_file->f_dentry->d_inode"), so you still have the file handle
> while the mapping is open.
But after the vma has been destroyed (the application did exit()),
the dirty pagecache data against the sparse mapped file still
hasn't been written, and still doesn't have a disk mapping.
So in this case, we have an inode which still has pending block
allocations which has no struct file's pointing at it. Or
am I wrong?
> I assume that the reason is that _any_ block allocation will trigegr
> pre-alloc, which means that we have preallocation for things like
> directories etc too - which really do not have a "struct file" associated
> with them.
>
> Whether that is really worth it is unclear, but it also means that ext2
> doesn't have to pass down the "struct file" to the lower levels at all, as
> it keeps all pre-alloc stuff in the inode.
The current preallocation will screw up is when there's a
large-and-sparse file which has blocks being allocated against it
at two or more offsets. And those allocations are for a large number
of blocks, and they are proceeding slowly. Something like:
for (i = 0; i < 16; i++) {
pwrite(fd, buf, 4096, offset1 + i * 4096);
pwrite(fd, buf, 4096, offset2 + i * 4096);
}
this would cause preallocation thrashing, and those blocks
would be laid out as ABABABAB. The same would happen if
the prealloc information is per-file as well, of course.
The app would have to be using different file descriptors
to avoid it.
So from a file-layout point of view, I don't see a lot of
benefit in moving the preallocation info into struct file.
(Delayed allocation plus writeback-time sorting would fix it
all up. With delayed allocate, the prealloc code can visit
the bitbucket).
-
next prev parent reply other threads:[~2002-06-04 20:17 UTC|newest]
Thread overview: 27+ messages / expand[flat|nested] mbox.gz Atom feed top
2002-06-01 8:43 [patch 12/16] fix race between writeback and unlink Andrew Morton
2002-06-01 16:42 ` Linus Torvalds
2002-06-01 19:19 ` Andrew Morton
2002-06-01 20:04 ` William Lee Irwin III
2002-06-01 22:25 ` Andrew Morton
2002-06-03 4:27 ` [RFC] iput() cleanup (was Re: [patch 12/16] fix race between writeback and unlink) Linus Torvalds
2002-06-03 16:26 ` Andreas Dilger
2002-06-03 16:47 ` Linus Torvalds
2002-06-03 19:09 ` Chris Mason
2002-06-03 19:34 ` Linus Torvalds
2002-06-03 19:49 ` Chris Mason
2002-06-03 19:55 ` Linus Torvalds
2002-06-03 22:10 ` [patch 12/16] fix race between writeback and unlink Chris Mason
2002-06-03 22:19 ` Linus Torvalds
2002-06-03 22:30 ` Andrew Morton
2002-06-04 18:47 ` Linus Torvalds
2002-06-04 20:15 ` Andrew Morton [this message]
2002-06-04 20:23 ` Linus Torvalds
2002-06-04 20:40 ` Andrew Morton
2002-06-04 21:37 ` Linus Torvalds
2002-06-04 22:04 ` Benjamin LaHaise
2002-06-04 22:08 ` Andrew Morton
2002-07-07 20:38 ` Riley Williams
2002-06-04 22:05 ` Craig Milo Rogers
2002-06-04 22:08 ` Linus Torvalds
2002-06-03 22:36 ` Chris Mason
2002-06-03 22:47 ` Andrew Morton
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=3CFD1FF0.4A02CE96@zip.com.au \
--to=akpm@zip.com.au \
--cc=linux-kernel@vger.kernel.org \
--cc=mason@suse.com \
--cc=torvalds@transmeta.com \
/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