From fb8751aba4474091bdc25a5cce462d526a403d72 Mon Sep 17 00:00:00 2001 From: haad Date: Tue, 18 May 2010 15:10:38 +0000 Subject: 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. --- sys/dev/dm/dm_target_linear.c | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) (limited to 'sys/dev/dm/dm_target_linear.c') 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. @@ -140,6 +140,22 @@ dm_target_linear_strategy(dm_table_entry_t * table_en, struct buf * bp) return 0; } +/* + * 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. */ -- cgit