Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/ufs/ffs ffs_copyonwrite(): If the write is to the in-fil...
details: https://anonhg.NetBSD.org/src/rev/58b62bb4c650
branches: trunk
changeset: 766760:58b62bb4c650
user: hannken <hannken%NetBSD.org@localhost>
date: Fri Jul 01 14:28:21 2011 +0000
description:
ffs_copyonwrite(): If the write is to the in-file-system journal
there is no need to lock and check the snapshots.
diffstat:
sys/ufs/ffs/ffs_snapshot.c | 24 +++++++++++++++++++-----
1 files changed, 19 insertions(+), 5 deletions(-)
diffs (52 lines):
diff -r 1960c32cf6ed -r 58b62bb4c650 sys/ufs/ffs/ffs_snapshot.c
--- a/sys/ufs/ffs/ffs_snapshot.c Fri Jul 01 13:30:18 2011 +0000
+++ b/sys/ufs/ffs/ffs_snapshot.c Fri Jul 01 14:28:21 2011 +0000
@@ -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;
Home |
Main Index |
Thread Index |
Old Index