Source-Changes-HG archive

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

[src/trunk]: src/sys/ufs/ffs Preallocate all cylinder group blocks so we no l...



details:   https://anonhg.NetBSD.org/src/rev/370e24540692
branches:  trunk
changeset: 764381:370e24540692
user:      hannken <hannken%NetBSD.org@localhost>
date:      Mon Apr 18 07:36:13 2011 +0000

description:
Preallocate all cylinder group blocks so we no longer redo ~50% of
the cylinder groups while the file system is suspended.
This was removed in error with Rev 1.16.

>From Manuel Bouyer <bouyer%netbsd.org@localhost> via tech-kern.

diffstat:

 sys/ufs/ffs/ffs_snapshot.c |  28 +++++++++++++++++++++++++---
 1 files changed, 25 insertions(+), 3 deletions(-)

diffs (56 lines):

diff -r e4a78b9f6a8a -r 370e24540692 sys/ufs/ffs/ffs_snapshot.c
--- a/sys/ufs/ffs/ffs_snapshot.c        Mon Apr 18 03:48:23 2011 +0000
+++ b/sys/ufs/ffs/ffs_snapshot.c        Mon Apr 18 07:36:13 2011 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: ffs_snapshot.c,v 1.111 2011/03/06 17:08:38 bouyer Exp $        */
+/*     $NetBSD: ffs_snapshot.c,v 1.112 2011/04/18 07:36:13 hannken Exp $       */
 
 /*
  * Copyright 2000 Marshall Kirk McKusick. All Rights Reserved.
@@ -38,7 +38,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: ffs_snapshot.c,v 1.111 2011/03/06 17:08:38 bouyer Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ffs_snapshot.c,v 1.112 2011/04/18 07:36:13 hannken Exp $");
 
 #if defined(_KERNEL_OPT)
 #include "opt_ffs.h"
@@ -405,7 +405,7 @@
 static int
 snapshot_setup(struct mount *mp, struct vnode *vp)
 {
-       int error, n, len, loc;
+       int error, n, len, loc, cg;
        daddr_t blkno, numblks;
        struct buf *ibp, *nbp;
        struct fs *fs = VFSTOUFS(mp)->um_fs;
@@ -501,6 +501,28 @@
                if (error)
                        goto out;
                bawrite(nbp);
+               if (wbreak > 0 && (++n % wbreak) == 0) {
+                       UFS_WAPBL_END(mp);
+                       error = UFS_WAPBL_BEGIN(mp);
+                       if (error)
+                               return error;
+               }
+       }
+       /*
+        * Allocate all cylinder group blocks.
+        */
+       for (cg = 0; cg < fs->fs_ncg; cg++) {
+               error = ffs_balloc(vp, lfragtosize(fs, cgtod(fs, cg)),
+                   fs->fs_bsize, l->l_cred, 0, &nbp);
+               if (error)
+                       goto out;
+               bawrite(nbp);
+               if (wbreak > 0 && (++n % wbreak) == 0) {
+                       UFS_WAPBL_END(mp);
+                       error = UFS_WAPBL_BEGIN(mp);
+                       if (error)
+                               return error;
+               }
        }
 
 out:



Home | Main Index | Thread Index | Old Index