summaryrefslogtreecommitdiff
path: root/sys/dev/dm/dm_target_linear.c
diff options
context:
space:
mode:
authorhaad <haad@NetBSD.org>2010-05-18 15:10:38 +0000
committerhaad <haad@NetBSD.org>2010-05-18 15:10:38 +0000
commitfb8751aba4474091bdc25a5cce462d526a403d72 (patch)
treeffedb891877783c792ef6cf3dfa4f8b7b2790683 /sys/dev/dm/dm_target_linear.c
parent923bf0dda043333f52a68e794027abbb3f111b5a (diff)
Add support for DIOCCACHESYNC ioctl for dm devices. Add new sync function
pointer to dm_target_t because that is the only part of dm which know real block device. disk_ioctl_switch parses whole device table and for every entry it calls particular sync routine which propagates DIOCCACHESYNC to real disk. While I was here implement some KNF fixes and remove unneeded symbols from dm.h. Problem reported on port-xen@ by Hugo Silva.
Diffstat (limited to 'sys/dev/dm/dm_target_linear.c')
-rw-r--r--sys/dev/dm/dm_target_linear.c18
1 files changed, 17 insertions, 1 deletions
diff --git a/sys/dev/dm/dm_target_linear.c b/sys/dev/dm/dm_target_linear.c
index a6a93611e2d..fc5fde8bdc5 100644
--- a/sys/dev/dm/dm_target_linear.c
+++ b/sys/dev/dm/dm_target_linear.c
@@ -1,4 +1,4 @@
-/* $NetBSD: dm_target_linear.c,v 1.9 2010/01/04 00:14:41 haad Exp $ */
+/* $NetBSD: dm_target_linear.c,v 1.10 2010/05/18 15:10:38 haad Exp $ */
/*
* Copyright (c) 2008 The NetBSD Foundation, Inc.
@@ -141,6 +141,22 @@ dm_target_linear_strategy(dm_table_entry_t * table_en, struct buf * bp)
}
/*
+ * Sync underlying disk caches.
+ */
+int
+dm_target_linear_sync(dm_table_entry_t * table_en)
+{
+ int cmd;
+ dm_target_linear_config_t *tlc;
+
+ tlc = table_en->target_config;
+
+ cmd = 1;
+
+ return VOP_IOCTL(tlc->pdev->pdev_vnode, DIOCCACHESYNC, &cmd,
+ FREAD|FWRITE, kauth_cred_get());
+}
+/*
* Destroy target specific data. Decrement table pdevs.
*/
int