Source-Changes-HG archive

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

[src/trunk]: src/sys/ufs/ffs Try to keep snapshot indirect blocks contiguous.



details:   https://anonhg.NetBSD.org/src/rev/c38d551e7a34
branches:  trunk
changeset: 764442:c38d551e7a34
user:      hannken <hannken%NetBSD.org@localhost>
date:      Sat Apr 23 07:36:02 2011 +0000

description:
Try to keep snapshot indirect blocks contiguous.

This speeds up snapshot creation by a factor of ~3 and reduces
the file system suspension time by a factor of ~5.

diffstat:

 sys/ufs/ffs/ffs_balloc.c |  12 ++++++++++--
 1 files changed, 10 insertions(+), 2 deletions(-)

diffs (40 lines):

diff -r c015702e7e70 -r c38d551e7a34 sys/ufs/ffs/ffs_balloc.c
--- a/sys/ufs/ffs/ffs_balloc.c  Sat Apr 23 06:29:05 2011 +0000
+++ b/sys/ufs/ffs/ffs_balloc.c  Sat Apr 23 07:36:02 2011 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: ffs_balloc.c,v 1.53 2011/03/06 17:08:38 bouyer Exp $   */
+/*     $NetBSD: ffs_balloc.c,v 1.54 2011/04/23 07:36:02 hannken Exp $  */
 
 /*
  * Copyright (c) 2002 Networks Associates Technology, Inc.
@@ -41,7 +41,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: ffs_balloc.c,v 1.53 2011/03/06 17:08:38 bouyer Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ffs_balloc.c,v 1.54 2011/04/23 07:36:02 hannken Exp $");
 
 #if defined(_KERNEL_OPT)
 #include "opt_quota.h"
@@ -320,6 +320,10 @@
                        goto fail;
                }
                mutex_enter(&ump->um_lock);
+               /* Try to keep snapshot indirect blocks contiguous. */
+               if (i == num && (ip->i_flags & SF_SNAPSHOT) != 0)
+                       pref = ffs_blkpref_ufs1(ip, lbn, indirs[i-1].in_off,
+                           flags | B_METAONLY, &bap[0]);
                if (pref == 0)
                        pref = ffs_blkpref_ufs1(ip, lbn, 0, flags | B_METAONLY,
                            NULL);
@@ -846,6 +850,10 @@
                        goto fail;
                }
                mutex_enter(&ump->um_lock);
+               /* Try to keep snapshot indirect blocks contiguous. */
+               if (i == num && (ip->i_flags & SF_SNAPSHOT) != 0)
+                       pref = ffs_blkpref_ufs2(ip, lbn, indirs[i-1].in_off,
+                           flags | B_METAONLY, &bap[0]);
                if (pref == 0)
                        pref = ffs_blkpref_ufs2(ip, lbn, 0, flags | B_METAONLY,
                            NULL);



Home | Main Index | Thread Index | Old Index