Date: Thu, 24 Sep 2009 16:46:17 GMT From: Aditya Sarawgi <truncs@FreeBSD.org> To: Perforce Change Reviews <perforce@FreeBSD.org> Subject: PERFORCE change 168853 for review Message-ID: <200909241646.n8OGkHhR048144@repoman.freebsd.org>
next in thread | raw e-mail | index | archive | help
http://perforce.freebsd.org/chv.cgi?CH=168853 Change 168853 by truncs@aditya on 2009/09/24 16:45:21 Update the orlov block allocator variables when dealing with directory inodes. Affected files ... .. //depot/projects/soc2009/soc_ext2fs/src/sys/fs/ext2fs/ext2_alloc.c#9 edit Differences ... ==== //depot/projects/soc2009/soc_ext2fs/src/sys/fs/ext2fs/ext2_alloc.c#9 (text+ko) ==== @@ -343,10 +343,15 @@ * else obtain it using ino_to_cg. The preferred inode is always the next * inode. */ - if((mode & IFMT) == IFDIR) + if((mode & IFMT) == IFDIR) { cg = ext2_dirpref(pip); - else + if (fs->e2fs_contigdirs[cg] < 255) + fs->e2fs_contigdirs[cg]++; + } else { cg = ino_to_cg(fs, pip->i_number); + if (fs->e2fs_contigdirs[cg] > 0) + fs->e2fs_contigdirs[cg]--; + } ipref = cg * fs->e2fs->e2fs_ipg + 1; ino = (ino_t)ext2_hashalloc(pip, cg, (long)ipref, mode, ext2_nodealloccg); @@ -418,7 +423,7 @@ avgifree = fs->e2fs->e2fs_ficount / fs->e2fs_gcount; avgbfree = fs->e2fs->e2fs_fbcount / fs->e2fs_gcount; - avgndir = fs->e2fs_total_dir / e2fs->e2fs_gcount; + avgndir = fs->e2fs_total_dir / fs->e2fs_gcount; /* * Force allocation in another cg if creating a first level dir. @@ -466,7 +471,7 @@ maxcontigdirs = 0; /* dirsize overflowed */ else maxcontigdirs = min((avgbfree * fs->e2fs_bsize) / dirsize, 255); - maxcontigdirs = min(maxcontigdirs, fs->fs_ipg / AFPDIR); + maxcontigdirs = min(maxcontigdirs, fs->e2fs_ipg / AFPDIR); if (maxcontigdirs == 0) maxcontigdirs = 1; @@ -748,6 +753,7 @@ fs->e2fs_fmod = 1; if ((mode & IFMT) == IFDIR) { fs->e2fs_gd[cg].ext2bgd_ndirs++; + fs->e2fs_total_dir++; } bdwrite(bp); unlock_super(DEVVP(ip)); @@ -842,6 +848,7 @@ fs->e2fs_gd[cg].ext2bgd_nifree++; if ((mode & IFMT) == IFDIR) { fs->e2fs_gd[cg].ext2bgd_ndirs--; + fs->e2fs_total_dir--; } fs->e2fs_fmod = 1; bdwrite(bp);
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200909241646.n8OGkHhR048144>