Re: [patch 12/16] fix race between writeback and unlink

Linus Torvalds
2002-06-04T20:22:43Z

On Tue, 4 Jun 2002, Andrew Morton wrote:
>
> 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 think you're right..

> 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.

Sure. However, I don't think it should come as any surprise to anybody
that trying to write to two different points in the same file is a bad
idea. _regardless_ of whether you do pre-allocation or not, and whether
the pre-allocation is on the inode or file level.

I'd still love to see a "fast and slightly stupid" allocator for both
blocks and inodes, and have some infrastructure to do run-time defragging
in the background.

Linus