Fix size caclulation passed to the gfs2 allocator.
Simple fix to the allocator code, that was causing big problems in terms of performance and space used.
Signature · 40 lines
Russell Cattelan <[email protected]> -------------- next part -------------- [GFS2] Fix a size calculation error. The size was incorrectly being computed as a negative length and then passed to an unsigned parameter. This in turn would cause the allocator to setup enough indirect blocks to hold a gigabyte worth of file system blocks for each file created. Signed-off-by: Russell Cattelan <[email protected]> Index: linux-2.6.18.noarch/fs/gfs2/ops_address.c =================================================================== --- linux-2.6.18.noarch.orig/fs/gfs2/ops_address.c 2006-12-07 14:56:21.238160150 -0600 +++ linux-2.6.18.noarch/fs/gfs2/ops_address.c 2006-12-07 14:56:29.006254392 -0600 @@ -370,15 +370,17 @@ static int gfs2_prepare_write(struct fil loff_t pos = ((loff_t)page->index << PAGE_CACHE_SHIFT) + from; loff_t end = ((loff_t)page->index << PAGE_CACHE_SHIFT) + to; struct gfs2_alloc *al; + unsigned int write_len = to - from; + gfs2_holder_init(ip->i_gl, LM_ST_EXCLUSIVE, GL_ATIME|GL_AOP, &ip->i_gh); error = gfs2_glock_nq_m_atime(1, &ip->i_gh); if (error) goto out_uninit; - gfs2_write_calc_reserv(ip, to - from, &data_blocks, &ind_blocks); + gfs2_write_calc_reserv(ip, write_len, &data_blocks, &ind_blocks); - error = gfs2_write_alloc_required(ip, pos, from - to, &alloc_required); + error = gfs2_write_alloc_required(ip, pos, write_len, &alloc_required); if (error) goto out_unlock;
Quoted 9 lines · Russell Cattelan
Fix a size calculation error.
The size was incorrectly being computed as a negative length and then passed to an unsigned parameter.This in turn would cause the allocator to setup enough indirect blocks to hold a gigabyte worth of file system blocks for each file created.
GACK, ummm ACK
Signature · 3 lines
Politics is the struggle between those who want to make their country the best in the world, and those who believe it already is. Each group calls the other unpatriotic.
Quoted 2 lines · Russell Cattelan
Simple fix to the allocator code, that was causing big problems in terms of performance and space used.
ACK.
You sure that wasn't "speculative preallocation?" :)
-Eric