dm: Make targets' ->sync() optional
Apparently some targets have nothing to sync, so make it optional.
This commit is contained in:
parent
37b6bcc115
commit
b83e697e45
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: device-mapper.c,v 1.52 2019/12/15 09:22:28 tkusumi Exp $ */
|
||||
/* $NetBSD: device-mapper.c,v 1.53 2019/12/15 10:12:45 tkusumi Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 2010 The NetBSD Foundation, Inc.
|
||||
@ -504,7 +504,8 @@ disk_ioctl_switch(dev_t dev, u_long cmd, void *data)
|
||||
* routine basically call DIOCCACHESYNC on underlying devices.
|
||||
*/
|
||||
SLIST_FOREACH(table_en, tbl, next)
|
||||
table_en->target->sync(table_en);
|
||||
if (table_en->target->sync)
|
||||
table_en->target->sync(table_en);
|
||||
dm_table_release(&dmv->table_head, DM_TABLE_ACTIVE);
|
||||
dm_dev_unbusy(dmv);
|
||||
break;
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: dm.h,v 1.44 2019/12/15 09:42:29 tkusumi Exp $ */
|
||||
/* $NetBSD: dm.h,v 1.45 2019/12/15 10:12:45 tkusumi Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 2008 The NetBSD Foundation, Inc.
|
||||
@ -191,11 +191,11 @@ typedef struct dm_target {
|
||||
char *(*info)(void *);
|
||||
char *(*table)(void *);
|
||||
int (*strategy)(dm_table_entry_t *, struct buf *);
|
||||
int (*sync)(dm_table_entry_t *);
|
||||
int (*upcall)(dm_table_entry_t *, struct buf *);
|
||||
/*
|
||||
* Optional routines.
|
||||
*/
|
||||
int (*sync)(dm_table_entry_t *);
|
||||
int (*secsize)(dm_table_entry_t *, unsigned int *);
|
||||
|
||||
uint32_t version[3];
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: dm_target.c,v 1.30 2019/12/15 09:42:29 tkusumi Exp $ */
|
||||
/* $NetBSD: dm_target.c,v 1.31 2019/12/15 10:12:45 tkusumi Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 2008 The NetBSD Foundation, Inc.
|
||||
@ -29,7 +29,7 @@
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: dm_target.c,v 1.30 2019/12/15 09:42:29 tkusumi Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: dm_target.c,v 1.31 2019/12/15 10:12:45 tkusumi Exp $");
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <sys/param.h>
|
||||
@ -180,10 +180,6 @@ dm_target_insert(dm_target_t *dm_target)
|
||||
printf("%s missing upcall\n", dm_target->name);
|
||||
return EINVAL;
|
||||
}
|
||||
if (dm_target->sync == NULL) {
|
||||
printf("%s missing sync\n", dm_target->name);
|
||||
return EINVAL;
|
||||
}
|
||||
|
||||
mutex_enter(&dm_target_mutex);
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: dm_target_error.c,v 1.22 2019/12/15 09:42:29 tkusumi Exp $ */
|
||||
/* $NetBSD: dm_target_error.c,v 1.23 2019/12/15 10:12:45 tkusumi Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 2008 The NetBSD Foundation, Inc.
|
||||
@ -29,7 +29,7 @@
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: dm_target_error.c,v 1.22 2019/12/15 09:42:29 tkusumi Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: dm_target_error.c,v 1.23 2019/12/15 10:12:45 tkusumi Exp $");
|
||||
|
||||
/*
|
||||
* This file implements initial version of device-mapper error target.
|
||||
@ -45,7 +45,6 @@ __KERNEL_RCSID(0, "$NetBSD: dm_target_error.c,v 1.22 2019/12/15 09:42:29 tkusumi
|
||||
int dm_target_error_init(dm_table_entry_t*, int, char **);
|
||||
char *dm_target_error_table(void *);
|
||||
int dm_target_error_strategy(dm_table_entry_t *, struct buf *);
|
||||
int dm_target_error_sync(dm_table_entry_t *);
|
||||
int dm_target_error_deps(dm_table_entry_t *, prop_array_t);
|
||||
int dm_target_error_destroy(dm_table_entry_t *);
|
||||
int dm_target_error_upcall(dm_table_entry_t *, struct buf *);
|
||||
@ -84,7 +83,6 @@ dm_target_error_modcmd(modcmd_t cmd, void *arg)
|
||||
dmt->init = &dm_target_error_init;
|
||||
dmt->table = &dm_target_error_table;
|
||||
dmt->strategy = &dm_target_error_strategy;
|
||||
dmt->sync = &dm_target_error_sync;
|
||||
dmt->deps = &dm_target_error_deps;
|
||||
dmt->destroy = &dm_target_error_destroy;
|
||||
dmt->upcall = &dm_target_error_upcall;
|
||||
@ -140,14 +138,6 @@ dm_target_error_strategy(dm_table_entry_t *table_en, struct buf *bp)
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* Sync underlying disk caches. */
|
||||
int
|
||||
dm_target_error_sync(dm_table_entry_t *table_en)
|
||||
{
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* Doesn't do anything here. */
|
||||
int
|
||||
dm_target_error_destroy(dm_table_entry_t *table_en)
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: dm_target_snapshot.c,v 1.33 2019/12/15 09:42:29 tkusumi Exp $ */
|
||||
/* $NetBSD: dm_target_snapshot.c,v 1.34 2019/12/15 10:12:45 tkusumi Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 2008 The NetBSD Foundation, Inc.
|
||||
@ -29,7 +29,7 @@
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: dm_target_snapshot.c,v 1.33 2019/12/15 09:42:29 tkusumi Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: dm_target_snapshot.c,v 1.34 2019/12/15 10:12:45 tkusumi Exp $");
|
||||
|
||||
/*
|
||||
* 1. Suspend my_data to temporarily stop any I/O while the snapshot is being
|
||||
@ -306,7 +306,6 @@ dm_target_snapshot_strategy(dm_table_entry_t *table_en, struct buf *bp)
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* XXX dummy */
|
||||
int
|
||||
dm_target_snapshot_sync(dm_table_entry_t *table_en)
|
||||
{
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: dm_target_zero.c,v 1.24 2019/12/15 09:42:29 tkusumi Exp $ */
|
||||
/* $NetBSD: dm_target_zero.c,v 1.25 2019/12/15 10:12:45 tkusumi Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 2008 The NetBSD Foundation, Inc.
|
||||
@ -29,7 +29,7 @@
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: dm_target_zero.c,v 1.24 2019/12/15 09:42:29 tkusumi Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: dm_target_zero.c,v 1.25 2019/12/15 10:12:45 tkusumi Exp $");
|
||||
|
||||
/*
|
||||
* This file implements initial version of device-mapper zero target.
|
||||
@ -45,7 +45,6 @@ __KERNEL_RCSID(0, "$NetBSD: dm_target_zero.c,v 1.24 2019/12/15 09:42:29 tkusumi
|
||||
int dm_target_zero_init(dm_table_entry_t *, int, char **);
|
||||
char *dm_target_zero_table(void *);
|
||||
int dm_target_zero_strategy(dm_table_entry_t *, struct buf *);
|
||||
int dm_target_zero_sync(dm_table_entry_t *);
|
||||
int dm_target_zero_destroy(dm_table_entry_t *);
|
||||
int dm_target_zero_deps(dm_table_entry_t *, prop_array_t);
|
||||
int dm_target_zero_upcall(dm_table_entry_t *, struct buf *);
|
||||
@ -84,7 +83,6 @@ dm_target_zero_modcmd(modcmd_t cmd, void *arg)
|
||||
dmt->init = &dm_target_zero_init;
|
||||
dmt->table = &dm_target_zero_table;
|
||||
dmt->strategy = &dm_target_zero_strategy;
|
||||
dmt->sync = &dm_target_zero_sync;
|
||||
dmt->deps = &dm_target_zero_deps;
|
||||
dmt->destroy = &dm_target_zero_destroy;
|
||||
dmt->upcall = &dm_target_zero_upcall;
|
||||
@ -147,14 +145,6 @@ dm_target_zero_strategy(dm_table_entry_t *table_en, struct buf *bp)
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* Sync underlying disk caches. */
|
||||
int
|
||||
dm_target_zero_sync(dm_table_entry_t *table_en)
|
||||
{
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* Does not need to do anything here. */
|
||||
int
|
||||
dm_target_zero_destroy(dm_table_entry_t *table_en)
|
||||
|
Loading…
Reference in New Issue
Block a user