From owner-svn-src-all@FreeBSD.ORG Sat Mar 22 11:26:39 2014 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id E3A03D01; Sat, 22 Mar 2014 11:26:39 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id B63BA22E; Sat, 22 Mar 2014 11:26:39 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.8/8.14.8) with ESMTP id s2MBQd1j072185; Sat, 22 Mar 2014 11:26:39 GMT (envelope-from mckusick@svn.freebsd.org) Received: (from mckusick@localhost) by svn.freebsd.org (8.14.8/8.14.8/Submit) id s2MBQdml072184; Sat, 22 Mar 2014 11:26:39 GMT (envelope-from mckusick@svn.freebsd.org) Message-Id: <201403221126.s2MBQdml072184@svn.freebsd.org> From: Kirk McKusick Date: Sat, 22 Mar 2014 11:26:39 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r263628 - head/sys/ufs/ffs X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.17 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 22 Mar 2014 11:26:40 -0000 Author: mckusick Date: Sat Mar 22 11:26:39 2014 New Revision: 263628 URL: http://svnweb.freebsd.org/changeset/base/263628 Log: Update comment to explain search order reverted to historical order in -r254996. Suggested by: Pedro Giffuni MFC: 3 days Modified: head/sys/ufs/ffs/ffs_alloc.c Modified: head/sys/ufs/ffs/ffs_alloc.c ============================================================================== --- head/sys/ufs/ffs/ffs_alloc.c Sat Mar 22 10:54:02 2014 (r263627) +++ head/sys/ufs/ffs/ffs_alloc.c Sat Mar 22 11:26:39 2014 (r263628) @@ -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++)