Module Name: src
Committed By: hannken
Date: Sat Apr 23 07:36:02 UTC 2011
Modified Files:
src/sys/ufs/ffs: ffs_balloc.c
Log Message:
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.
To generate a diff of this commit:
cvs rdiff -u -r1.53 -r1.54 src/sys/ufs/ffs/ffs_balloc.c
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: src/sys/ufs/ffs/ffs_balloc.c
diff -u src/sys/ufs/ffs/ffs_balloc.c:1.53 src/sys/ufs/ffs/ffs_balloc.c:1.54
--- src/sys/ufs/ffs/ffs_balloc.c:1.53 Sun Mar 6 17:08:38 2011
+++ src/sys/ufs/ffs/ffs_balloc.c Sat Apr 23 07:36:02 2011
@@ -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);