Re: [Fwd: [linux-audio-dev] info point on linux hdr]

New Message Reply About this list Date view Thread view Subject view Author view Other groups

Subject: Re: [Fwd: [linux-audio-dev] info point on linux hdr]
From: Theodore Y. Ts'o (tytso_AT_MIT.EDU)
Date: Sat Apr 15 2000 - 05:07:19 EEST


   Date: Sat, 15 Apr 2000 01:35:10 +0200
   From: Andi Kleen <ak_AT_muc.de>

   On Sat, Apr 15, 2000 at 12:24:16AM +0200, Andrew Clausen wrote:
> i mentioned in some remarks to benno how important i thought it was to
> preallocate the files used for hard disk recording under linux.

   [...]

   Unfortunately efficient preallocation is rather hard with the current
   ext2. To do it efficiently you just want to allocate the blocks in the
   bitmaps without writing into the actual allocated blocks (otherwise
   it would be as slow as the manual write-every-block-from-userspace trick)
   Now in these blocks there could be data from other files, the new owner
   of the block should not be allowed to see the old data for security
   reasons.

It depends on what you mean by preallocation. If you mean preallocation
for the purposes of making sure you don't run out of disk space, then
it's just a matter of keeping track of how many committed (but not yet
allocated) blocks, so you can return ENOSPACE at the right time.

If you mean preallocation to avoid fragmentation, ext2 does that
already. When you allocate a block for an inode, if the following
blocks are free, they will be grabed in the free block bitmap, although
they won't be assigned to the inode. The in-core inode structure stores
the first preallocated block address, and how many blocks were grabbed.
If the file is closed without using all of the preallocated blocks, they
are released back to the filesystem.

You can control the maximum number of blocks that are grabbed for
preallocation purposes changing a s_prealloc_blocks stored in the ext2
superblock.

                                                - Ted


New Message Reply About this list Date view Thread view Subject view Author view Other groups

This archive was generated by hypermail 2b28 : Sat Apr 15 2000 - 05:33:32 EEST