PERFORCE change 178881 for review

Zheng Liu lz at FreeBSD.org
Thu May 27 13:32:40 UTC 2010


http://p4web.freebsd.org/@@178881?ac=10

Change 178881 by lz at gnehzuil-freebsd on 2010/05/27 13:32:05

	       Adjust the reservation window size dynamically.

Affected files ...

.. //depot/projects/soc2010/extfs/src/sys/fs/ext2fs/ext2_alloc.c#19 edit
.. //depot/projects/soc2010/extfs/src/sys/fs/ext2fs/ext2_rsv_win.h#9 edit

Differences ...

==== //depot/projects/soc2010/extfs/src/sys/fs/ext2fs/ext2_alloc.c#19 (text+ko) ====

@@ -128,6 +128,7 @@
         EXT2_TREE_LOCK(ip->i_e2fs);
         ext2_remove_rsv_win(ip->i_e2fs, rp);
         EXT2_TREE_UNLOCK(ip->i_e2fs);
+        rp->rsv_goal_size = EXT2_RSV_DEFAULT_RESERVE_BLKS;
 }
 
 /*
@@ -189,7 +190,7 @@
 {
         struct ext2_rsv_win *rsv, *prev, *next;
         int32_t cur;
-        int size = EXT2_RSV_DEFAULT_RESERVE_BLKS;
+        int size = rp->rsv_goal_size;
 
         if (search == NULL)
                 search = RB_ROOT(&fs->e2fs_rsv_tree);
@@ -340,6 +341,7 @@
         EXT2_TREE_LOCK(fs);
         ext2_add_rsv_win(fs, rp);
         EXT2_TREE_UNLOCK(fs);
+        rp->rsv_alloc_hit++;
 
 allocated:
         setbit(bbp, (daddr_t)bpref);
@@ -363,10 +365,20 @@
         u_long start;
         char *bbp;
         daddr_t bno = -1;
+        int size = EXT2_RSV_DEFAULT_RESERVE_BLKS;
 
         ump = ip->i_ump;
         bbp = (char *)bp->b_data;
 
+        if (rp->rsv_end != EXT2_RSV_NOT_ALLOCATED &&
+            rp->rsv_alloc_hit >
+            (rp->rsv_goal_size / 2)) {
+                size = rp->rsv_goal_size * 2;
+                if (size > EXT2_RSV_MAX_RESERVE_BLKS)
+                        size = EXT2_RSV_MAX_RESERVE_BLKS;
+                rp->rsv_goal_size = size;
+        }
+
         if (dtog(fs, bpref) != cg)
                 goto find;
 

==== //depot/projects/soc2010/extfs/src/sys/fs/ext2fs/ext2_rsv_win.h#9 (text+ko) ====

@@ -31,6 +31,7 @@
 #include <sys/tree.h>
 
 #define EXT2_RSV_DEFAULT_RESERVE_BLKS 8
+#define EXT2_RSV_MAX_RESERVE_BLKS 1027
 #define EXT2_RSV_NOT_ALLOCATED 0
 
 #define EXT2_RSV_LOCK(ip)   mtx_lock(&ip->i_rsv_lock)


More information about the p4-projects mailing list