On 22/09/06 05:29PM, Jan Kara wrote: > Curently we don't use any preallocation when a file is already closed > when allocating blocks (from writeback code when converting delayed > allocation). However for small files, using locality group preallocation I had always wondered about this case. But yes for small files it completely make sense to enable preallocations for smaller files even though they are closed. > is actually desirable as that is not specific to a particular file. > Rather it is a method to pack small files together to reduce > fragmentation and for that the fact the file is closed is actually even > stronger hint the file would benefit from packing. So change the logic > to allow locality group preallocation in this case. > One thing which comes to mind is that we never discard lg preallocations. With this change we will always enable lg preallocations for small files. These preallocations will then be only discarded when some allocation request fails which will be retried after doing discard preallocations. Though it is not a problem, since any small file allocation will benefit out of these lgs. But it shouldn't be too large that it starts causing performance hits for large files. Not for this patch but something to remember maybe ^^^^. (While we are internally looking at preallocation space for few optimizations, above is something to keep a note of.) > Signed-off-by: Jan Kara <jack@xxxxxxx> Looks good to me. Reviewed-by: Ritesh Harjani (IBM) <ritesh.list@xxxxxxxxx>