Tweak the calculation of minbfree in ffs_dirpref() so that only
those cylinder groups that have at least 75% of the average free space per cylinder group for that file system are considered as candidates for the creation of a new directory. The previous formula for minbfree would set it to zero if the file system was more than 75% full, which allowed cylinder groups with no free space at all to be chosen as candidates for directory creation, which resulted in an expensive search for free blocks for each file that was subsequently created in that directory. Modify the calculation of minifree in the same way. Decrease maxcontigdirs as the file system fills to decrease the likelyhood that a cluster of directories will overflow the available space in a cylinder group. Reviewed by: mckusick Tested by: kmarx@vicor.com MFC after: 2 weeks
This commit is contained in:
parent
8491f23424
commit
9f206707a5
@ -954,18 +954,18 @@ ffs_dirpref(pip)
|
||||
* optimal allocation of a directory inode.
|
||||
*/
|
||||
maxndir = min(avgndir + fs->fs_ipg / 16, fs->fs_ipg);
|
||||
minifree = avgifree - fs->fs_ipg / 4;
|
||||
if (minifree < 0)
|
||||
minifree = 0;
|
||||
minbfree = avgbfree - fs->fs_fpg / fs->fs_frag / 4;
|
||||
if (minbfree < 0)
|
||||
minbfree = 0;
|
||||
minifree = avgifree - avgifree / 4;
|
||||
if (minifree < 1)
|
||||
minifree = 1;
|
||||
minbfree = avgbfree - avgbfree / 4;
|
||||
if (minbfree < 1)
|
||||
minbfree = 1;
|
||||
cgsize = fs->fs_fsize * fs->fs_fpg;
|
||||
dirsize = fs->fs_avgfilesize * fs->fs_avgfpdir;
|
||||
curdirsize = avgndir ? (cgsize - avgbfree * fs->fs_bsize) / avgndir : 0;
|
||||
if (dirsize < curdirsize)
|
||||
dirsize = curdirsize;
|
||||
maxcontigdirs = min(cgsize / dirsize, 255);
|
||||
maxcontigdirs = min((avgbfree * fs->fs_bsize) / dirsize, 255);
|
||||
if (fs->fs_avgfpdir > 0)
|
||||
maxcontigdirs = min(maxcontigdirs,
|
||||
fs->fs_ipg / fs->fs_avgfpdir);
|
||||
|
Loading…
Reference in New Issue
Block a user