1
0
mirror of https://git.FreeBSD.org/src.git synced 2024-12-20 11:11:24 +00:00

Revert r263449;

ext2fs: minor update to the dirpref policy.

The change in UFS r254996, reverted the change as the
older code seems to work better. This was not visible
in local testing but we can trust UFS is vastly more
exercised in diferent environments.
This commit is contained in:
Pedro F. Giffuni 2014-03-21 04:33:38 +00:00
parent 4c73e705a5
commit ca73017a2d
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=263463

View File

@ -510,22 +510,6 @@ ext2_dirpref(struct inode *pip)
* Limit number of dirs in one cg and reserve space for * Limit number of dirs in one cg and reserve space for
* regular files, but only if we have no deficit in * regular files, but only if we have no deficit in
* inodes or space. * inodes or space.
*
* We are trying to find a suitable cylinder group nearby
* our preferred cylinder group to place a new directory.
* We scan from our preferred cylinder group forward looking
* for a cylinder group that meets our criterion. If we get
* to the final cylinder group and do not find anything,
* we start scanning backwards from our preferred cylinder
* group. The ideal would be to alternate looking forward
* and backward, but that is just too complex to code for
* the gain it would get. The most likely place where the
* backward scan would take effect is when we start near
* the end of the filesystem and do not find anything from
* where we are to the end. In that case, scanning backward
* will likely find us a suitable cylinder group much closer
* to our desired location than if we were to start scanning
* forward from the beginning of the filesystem.
*/ */
prefcg = ino_to_cg(fs, pip->i_number); prefcg = ino_to_cg(fs, pip->i_number);
for (cg = prefcg; cg < fs->e2fs_gcount; cg++) for (cg = prefcg; cg < fs->e2fs_gcount; cg++)
@ -535,7 +519,7 @@ ext2_dirpref(struct inode *pip)
if (fs->e2fs_contigdirs[cg] < maxcontigdirs) if (fs->e2fs_contigdirs[cg] < maxcontigdirs)
return (cg); return (cg);
} }
for (cg = prefcg - 1; cg >= 0; cg--) for (cg = 0; cg < prefcg; cg++)
if (fs->e2fs_gd[cg].ext2bgd_ndirs < maxndir && if (fs->e2fs_gd[cg].ext2bgd_ndirs < maxndir &&
fs->e2fs_gd[cg].ext2bgd_nifree >= minifree && fs->e2fs_gd[cg].ext2bgd_nifree >= minifree &&
fs->e2fs_gd[cg].ext2bgd_nbfree >= minbfree) { fs->e2fs_gd[cg].ext2bgd_nbfree >= minbfree) {
@ -548,7 +532,7 @@ ext2_dirpref(struct inode *pip)
for (cg = prefcg; cg < fs->e2fs_gcount; cg++) for (cg = prefcg; cg < fs->e2fs_gcount; cg++)
if (fs->e2fs_gd[cg].ext2bgd_nifree >= avgifree) if (fs->e2fs_gd[cg].ext2bgd_nifree >= avgifree)
return (cg); return (cg);
for (cg = prefcg - 1; cg >= 0; cg--) for (cg = 0; cg < prefcg; cg++)
if (fs->e2fs_gd[cg].ext2bgd_nifree >= avgifree) if (fs->e2fs_gd[cg].ext2bgd_nifree >= avgifree)
break; break;
return (cg); return (cg);