Author: kib
Date: Mon Sep  7 12:39:54 2009
New Revision: 196922
URL: http://svn.freebsd.org/changeset/base/196922

Log:
  MFC r196206.
  
  Take the number of allocated freeblks into consideration for
  softdep_slowdown().

Modified:
  stable/7/sys/   (props changed)
  stable/7/sys/contrib/pf/   (props changed)
  stable/7/sys/net/   (props changed)
  stable/7/sys/ufs/ffs/ffs_softdep.c

Modified: stable/7/sys/ufs/ffs/ffs_softdep.c
==============================================================================
--- stable/7/sys/ufs/ffs/ffs_softdep.c  Mon Sep  7 12:10:41 2009        
(r196921)
+++ stable/7/sys/ufs/ffs/ffs_softdep.c  Mon Sep  7 12:39:54 2009        
(r196922)
@@ -671,6 +671,8 @@ static int req_clear_inodedeps;     /* synce
 static int req_clear_remove;   /* syncer process flush some freeblks */
 #define FLUSH_REMOVE           2
 #define FLUSH_REMOVE_WAIT      3
+static long num_freeblkdep;    /* number of freeblks workitems allocated */
+
 /*
  * runtime statistics
  */
@@ -2230,6 +2232,9 @@ softdep_setup_freeblocks(ip, length, fla
        freeblks->fb_uid = ip->i_uid;
        freeblks->fb_previousinum = ip->i_number;
        freeblks->fb_devvp = ip->i_devvp;
+       ACQUIRE_LOCK(&lk);
+       num_freeblkdep++;
+       FREE_LOCK(&lk);
        extblocks = 0;
        if (fs->fs_magic == FS_UFS2_MAGIC)
                extblocks = btodb(fragroundup(fs, ip->i_din2->di_extsize));
@@ -2821,6 +2826,7 @@ handle_workitem_freeblocks(freeblks, fla
 
        ACQUIRE_LOCK(&lk);
        WORKITEM_FREE(freeblks, D_FREEBLKS);
+       num_freeblkdep--;
        FREE_LOCK(&lk);
 }
 
@@ -5748,7 +5754,8 @@ softdep_slowdown(vp)
        max_softdeps_hard = max_softdeps * 11 / 10;
        if (num_dirrem < max_softdeps_hard / 2 &&
            num_inodedep < max_softdeps_hard &&
-           VFSTOUFS(vp->v_mount)->um_numindirdeps < maxindirdeps) {
+           VFSTOUFS(vp->v_mount)->um_numindirdeps < maxindirdeps &&
+           num_freeblkdep < max_softdeps_hard) {
                FREE_LOCK(&lk);
                return (0);
        }
_______________________________________________
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"

Reply via email to