[patch] ext2fs + preallocation

gnehzuil gnehzuil at gmail.com
Thu Aug 19 03:03:01 UTC 2010


Hi all,

There is a patch in attachment which implements a preallocation 
algorithm in ext2fs. I implement this algorithm during FreeBSD SoC 2010.

This patch implements the in-memory ext2/3 block preallocation algorithm 
from reservation window. It uses a RB-tree to index block allocation 
request and reserve a number of blocks for each file which has requested 
to allocate a block. When a file request to allocate a block, it will 
find a block to allocate to this file. When it find the block to 
allocate, it will try to allocate a block, which is in the same cylinder 
group with inode and is not in other reservation window in RB-tree. 
Meanwhile there are some contiguous free blocks after this block. It 
uses a data structure to store this block's position and the length of 
contiguous free blocks. Then it inserts this data structure into 
RB-tree. When this file request to allocate a block again, It will find 
corresponding data structure in RB-tree. If it can find, the next free 
block will be allocated to this file directly. Otherwise, it will search 
a new block again.

I have run some benchmarks to test this algorithm. Please review it in 
wiki page (' http://wiki.freebsd.org/SOC2010ZhengLiu'). The performance 
is better when the number of threads is smaller than 4. When the number 
of threads is greater than 4, the performance can be increased a little.

Please test it.


Thanks and best regards,

lz

-------------- next part --------------
A non-text attachment was scrubbed...
Name: ext2fs_prealloc.patch
Type: text/x-patch
Size: 28465 bytes
Desc: not available
Url : http://lists.freebsd.org/pipermail/freebsd-fs/attachments/20100819/ee79b50c/ext2fs_prealloc.bin


More information about the freebsd-fs mailing list