diff options
author | mckusick <mckusick@FreeBSD.org> | 2014-03-22 11:26:39 +0000 |
---|---|---|
committer | mckusick <mckusick@FreeBSD.org> | 2014-03-22 11:26:39 +0000 |
commit | de9a58cc91e99b4be038d6eb2da9a8f634274d6e (patch) | |
tree | 3a0aaba76916677723949f1942d3dace3cce1779 | |
parent | 6fcf6199a4a9aefe9f2e59d947f0e0df171367b5 (diff) | |
download | FreeBSD-src-de9a58cc91e99b4be038d6eb2da9a8f634274d6e.zip FreeBSD-src-de9a58cc91e99b4be038d6eb2da9a8f634274d6e.tar.gz |
Update comment to explain search order reverted to historical order
in -r254996.
Suggested by: Pedro Giffuni <pfg@FreeBSD.org>
MFC: 3 days
-rw-r--r-- | sys/ufs/ffs/ffs_alloc.c | 21 |
1 files changed, 11 insertions, 10 deletions
diff --git a/sys/ufs/ffs/ffs_alloc.c b/sys/ufs/ffs/ffs_alloc.c index 69f3e99..36db48f 100644 --- a/sys/ufs/ffs/ffs_alloc.c +++ b/sys/ufs/ffs/ffs_alloc.c @@ -1167,16 +1167,17 @@ ffs_dirpref(pip) * 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. + * we start scanning forwards from the beginning of the + * filesystem. While it might seem sensible to start scanning + * backwards or even to alternate looking forward and backward, + * this approach fails badly when the filesystem is nearly full. + * Specifically, we first search all the areas that have no space + * and finally try the one preceeding that. We repeat this on + * every request and in the case of the final block end up + * searching the entire filesystem. By jumping to the front + * of the filesystem, our future forward searches always look + * in new cylinder groups so finds every possible block after + * one pass over the filesystem. */ prefcg = ino_to_cg(fs, pip->i_number); for (cg = prefcg; cg < fs->fs_ncg; cg++) |