Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/netbsd-6]: src/sys/ufs/ffs Pull up the following revisions(s) (requested...



details:   https://anonhg.NetBSD.org/src/rev/a672f6f556e4
branches:  netbsd-6
changeset: 776487:a672f6f556e4
user:      sborrill <sborrill%NetBSD.org@localhost>
date:      Tue Oct 29 09:51:30 2013 +0000

description:
Pull up the following revisions(s) (requested by bad in ticket #978):
        sys/ufs/ffs/ffs_alloc.c:        revision 1.144

Pull in fix from FreeBSD ffs_alloc.c r121785:
Consider only cylinder groups with at least 75% of the average free space
per cylinder group and 75% of the average free inodes per cylinder group
as candidates for the creation of a new directory.  Avoids excessive I/O
scanning for a suitable cylinder group on relatively full file systems.

diffstat:

 sys/ufs/ffs/ffs_alloc.c |  21 ++++++++++++---------
 1 files changed, 12 insertions(+), 9 deletions(-)

diffs (51 lines):

diff -r 8b7468ace15b -r a672f6f556e4 sys/ufs/ffs/ffs_alloc.c
--- a/sys/ufs/ffs/ffs_alloc.c   Sun Oct 20 13:48:56 2013 +0000
+++ b/sys/ufs/ffs/ffs_alloc.c   Tue Oct 29 09:51:30 2013 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: ffs_alloc.c,v 1.130 2011/11/28 08:05:07 tls Exp $      */
+/*     $NetBSD: ffs_alloc.c,v 1.130.4.1 2013/10/29 09:51:30 sborrill Exp $     */
 
 /*-
  * Copyright (c) 2008, 2009 The NetBSD Foundation, Inc.
@@ -70,7 +70,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: ffs_alloc.c,v 1.130 2011/11/28 08:05:07 tls Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ffs_alloc.c,v 1.130.4.1 2013/10/29 09:51:30 sborrill Exp $");
 
 #if defined(_KERNEL_OPT)
 #include "opt_ffs.h"
@@ -721,14 +721,17 @@
        /*
         * Count various limits which used for
         * optimal allocation of a directory inode.
+        * Try cylinder groups with >75% avgifree and avgbfree.
+        * Avoid cylinder groups with no free blocks or inodes as that
+        * triggers an I/O-expensive cylinder group scan.
         */
        maxndir = min(avgndir + fs->fs_ipg / 16, fs->fs_ipg);
-       minifree = avgifree - fs->fs_ipg / 4;
-       if (minifree < 0)
-               minifree = 0;
-       minbfree = avgbfree - fragstoblks(fs, fs->fs_fpg) / 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 = (int64_t)fs->fs_fsize * fs->fs_fpg;
        dirsize = (int64_t)fs->fs_avgfilesize * fs->fs_avgfpdir;
        if (avgndir != 0) {
@@ -737,7 +740,7 @@
                        dirsize = curdsz;
        }
        if (cgsize < dirsize * 255)
-               maxcontigdirs = cgsize / dirsize;
+               maxcontigdirs = (avgbfree * fs->fs_bsize) / dirsize;
        else
                maxcontigdirs = 255;
        if (fs->fs_avgfpdir > 0)



Home | Main Index | Thread Index | Old Index