summaryrefslogtreecommitdiffstats
path: root/module/zfs/zio.c
diff options
context:
space:
mode:
authorMatthew Ahrens <[email protected]>2013-05-16 14:18:06 -0700
committerBrian Behlendorf <[email protected]>2013-11-05 12:14:48 -0800
commit498877baf5038b32c1531e5ec96b435023200f4d (patch)
tree741845c71f02bf2dca826e3a988c7125c8958117 /module/zfs/zio.c
parent03c6040bee6c87a9413b7da41d9f580f79a8ab62 (diff)
Illumos #3112, #3113, #3114
3112 ztest does not honor ZFS_DEBUG 3113 ztest should use watchpoints to protect frozen arc bufs 3114 some leaked nvlists in zfsdev_ioctl Reviewed by: Adam Leventhal <[email protected]> Reviewed by: Matt Amdur <[email protected]> Reviewed by: George Wilson <[email protected]> Reviewed by: Christopher Siden <[email protected]> Approved by: Eric Schrock <[email protected]> References: https://www.illumos.org/issues/3112 https://www.illumos.org/issues/3113 https://www.illumos.org/issues/3114 illumos/illumos-gate@cd1c8b85eb30b568e9816221430c479ace7a559d The /proc/self/cmd watchpoint interface is specific to Solaris. Therefore, the #3113 implementation was reworked to use the more portable mprotect(2) system call. When the pages are watched they are marked read-only for protection. Any write to the protected address range immediately trigger a SIGSEGV. The pages are marked writable again when they are unwatched. Ported-by: Brian Behlendorf <[email protected]> Issue #1489
Diffstat (limited to 'module/zfs/zio.c')
-rw-r--r--module/zfs/zio.c14
1 files changed, 12 insertions, 2 deletions
diff --git a/module/zfs/zio.c b/module/zfs/zio.c
index 1f803a44b..f0c9c0f08 100644
--- a/module/zfs/zio.c
+++ b/module/zfs/zio.c
@@ -169,11 +169,21 @@ zio_init(void)
while (p2 & (p2 - 1))
p2 &= p2 - 1;
+#ifndef _KERNEL
+ /*
+ * If we are using watchpoints, put each buffer on its own page,
+ * to eliminate the performance overhead of trapping to the
+ * kernel when modifying a non-watched buffer that shares the
+ * page with a watched buffer.
+ */
+ if (arc_watch && !IS_P2ALIGNED(size, PAGESIZE))
+ continue;
+#endif
if (size <= 4 * SPA_MINBLOCKSIZE) {
align = SPA_MINBLOCKSIZE;
- } else if (P2PHASE(size, PAGESIZE) == 0) {
+ } else if (IS_P2ALIGNED(size, PAGESIZE)) {
align = PAGESIZE;
- } else if (P2PHASE(size, p2 >> 2) == 0) {
+ } else if (IS_P2ALIGNED(size, p2 >> 2)) {
align = p2 >> 2;
}