Module Name:    src
Committed By:   hannken
Date:           Fri Jul  1 14:28:22 UTC 2011

Modified Files:
        src/sys/ufs/ffs: ffs_snapshot.c

Log Message:
ffs_copyonwrite(): If the write is to the in-file-system journal
    there is no need to lock and check the snapshots.


To generate a diff of this commit:
cvs rdiff -u -r1.116 -r1.117 src/sys/ufs/ffs/ffs_snapshot.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_snapshot.c
diff -u src/sys/ufs/ffs/ffs_snapshot.c:1.116 src/sys/ufs/ffs/ffs_snapshot.c:1.117
--- src/sys/ufs/ffs/ffs_snapshot.c:1.116	Sun Jun 12 03:36:00 2011
+++ src/sys/ufs/ffs/ffs_snapshot.c	Fri Jul  1 14:28:21 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: ffs_snapshot.c,v 1.116 2011/06/12 03:36:00 rmind Exp $	*/
+/*	$NetBSD: ffs_snapshot.c,v 1.117 2011/07/01 14:28:21 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.116 2011/06/12 03:36:00 rmind Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ffs_snapshot.c,v 1.117 2011/07/01 14:28:21 hannken Exp $");
 
 #if defined(_KERNEL_OPT)
 #include "opt_ffs.h"
@@ -1896,9 +1896,9 @@
 		return 0;
 	}
 	/*
-	 * First check to see if it is after the file system or
-	 * in the preallocated list.
-	 * By doing this check we avoid several potential deadlocks.
+	 * First check to see if it is after the file system,
+	 * in the journal or in the preallocated list.
+	 * By doing these checks we avoid several potential deadlocks.
 	 */
 	fs = ip->i_fs;
 	lbn = fragstoblks(fs, dbtofsb(fs, bp->b_blkno));
@@ -1906,6 +1906,20 @@
 		mutex_exit(&si->si_lock);
 		return 0;
 	}
+	if ((fs->fs_flags & FS_DOWAPBL) &&
+	    fs->fs_journal_location == UFS_WAPBL_JOURNALLOC_IN_FILESYSTEM) {
+		off_t blk_off, log_start, log_end;
+
+		log_start = (off_t)fs->fs_journallocs[UFS_WAPBL_INFS_ADDR] *
+		    fs->fs_journallocs[UFS_WAPBL_INFS_BLKSZ];
+		log_end = log_start + fs->fs_journallocs[UFS_WAPBL_INFS_COUNT] *
+		    fs->fs_journallocs[UFS_WAPBL_INFS_BLKSZ];
+		blk_off = dbtob(bp->b_blkno);
+		if (blk_off >= log_start && blk_off < log_end) {
+			mutex_exit(&si->si_lock);
+			return 0;
+		}
+	}
 	snapblklist = si->si_snapblklist;
 	upper = (snapblklist != NULL ? snapblklist[0] - 1 : 0);
 	lower = 1;

Reply via email to