Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/dev/dm dm: Make targets' ->secsize() optional
details: https://anonhg.NetBSD.org/src/rev/bdf885612bc1
branches: trunk
changeset: 967592:bdf885612bc1
user: tkusumi <tkusumi%NetBSD.org@localhost>
date: Sun Dec 15 09:42:29 2019 +0000
description:
dm: Make targets' ->secsize() optional
and make a caller assume secsize 0 if ->secsize not present.
This allows a dummy function to be removed which was added in
"dm: Add dummy target ->sync()/->secsize() to prevent panic on modload(8)".
diffstat:
sys/dev/dm/dm.h | 12 ++++--------
sys/dev/dm/dm_table.c | 9 ++++++---
sys/dev/dm/dm_target.c | 8 ++------
sys/dev/dm/dm_target_error.c | 5 ++---
sys/dev/dm/dm_target_mirror.c | 5 ++---
sys/dev/dm/dm_target_snapshot.c | 6 ++----
sys/dev/dm/dm_target_zero.c | 5 ++---
7 files changed, 20 insertions(+), 30 deletions(-)
diffs (204 lines):
diff -r 71024b1dd56c -r bdf885612bc1 sys/dev/dm/dm.h
--- a/sys/dev/dm/dm.h Sun Dec 15 09:38:40 2019 +0000
+++ b/sys/dev/dm/dm.h Sun Dec 15 09:42:29 2019 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: dm.h,v 1.43 2019/12/15 09:22:28 tkusumi Exp $ */
+/* $NetBSD: dm.h,v 1.44 2019/12/15 09:42:29 tkusumi Exp $ */
/*
* Copyright (c) 2008 The NetBSD Foundation, Inc.
@@ -193,6 +193,9 @@
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 (*secsize)(dm_table_entry_t *, unsigned int *);
uint32_t version[3];
@@ -298,13 +301,6 @@
int dm_pdev_init(void);
dm_pdev_t* dm_pdev_insert(const char *);
-/* XXX dummy */
-static __inline int
-dm_target_dummy_secsize(dm_table_entry_t *table_en, unsigned int *secsizep)
-{
- return 0;
-}
-
#endif /*_KERNEL*/
#endif /*_DM_DEV_H_*/
diff -r 71024b1dd56c -r bdf885612bc1 sys/dev/dm/dm_table.c
--- a/sys/dev/dm/dm_table.c Sun Dec 15 09:38:40 2019 +0000
+++ b/sys/dev/dm/dm_table.c Sun Dec 15 09:42:29 2019 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: dm_table.c,v 1.14 2019/12/15 09:22:28 tkusumi Exp $ */
+/* $NetBSD: dm_table.c,v 1.15 2019/12/15 09:42:29 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_table.c,v 1.14 2019/12/15 09:22:28 tkusumi Exp $");
+__KERNEL_RCSID(0, "$NetBSD: dm_table.c,v 1.15 2019/12/15 09:42:29 tkusumi Exp $");
#include <sys/types.h>
#include <sys/param.h>
@@ -248,7 +248,10 @@
secsize = 0;
SLIST_FOREACH(table_en, tbl, next) {
length += table_en->length;
- table_en->target->secsize(table_en, &tsecsize);
+ if (table_en->target->secsize)
+ table_en->target->secsize(table_en, &tsecsize);
+ else
+ tsecsize = 0;
if (secsize < tsecsize)
secsize = tsecsize;
}
diff -r 71024b1dd56c -r bdf885612bc1 sys/dev/dm/dm_target.c
--- a/sys/dev/dm/dm_target.c Sun Dec 15 09:38:40 2019 +0000
+++ b/sys/dev/dm/dm_target.c Sun Dec 15 09:42:29 2019 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: dm_target.c,v 1.29 2019/12/15 05:56:02 tkusumi Exp $ */
+/* $NetBSD: dm_target.c,v 1.30 2019/12/15 09:42:29 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.29 2019/12/15 05:56:02 tkusumi Exp $");
+__KERNEL_RCSID(0, "$NetBSD: dm_target.c,v 1.30 2019/12/15 09:42:29 tkusumi Exp $");
#include <sys/types.h>
#include <sys/param.h>
@@ -184,10 +184,6 @@
printf("%s missing sync\n", dm_target->name);
return EINVAL;
}
- if (dm_target->secsize == NULL) {
- printf("%s missing secsize\n", dm_target->name);
- return EINVAL;
- }
mutex_enter(&dm_target_mutex);
diff -r 71024b1dd56c -r bdf885612bc1 sys/dev/dm/dm_target_error.c
--- a/sys/dev/dm/dm_target_error.c Sun Dec 15 09:38:40 2019 +0000
+++ b/sys/dev/dm/dm_target_error.c Sun Dec 15 09:42:29 2019 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: dm_target_error.c,v 1.21 2019/12/15 05:56:02 tkusumi Exp $ */
+/* $NetBSD: dm_target_error.c,v 1.22 2019/12/15 09:42:29 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.21 2019/12/15 05:56:02 tkusumi Exp $");
+__KERNEL_RCSID(0, "$NetBSD: dm_target_error.c,v 1.22 2019/12/15 09:42:29 tkusumi Exp $");
/*
* This file implements initial version of device-mapper error target.
@@ -88,7 +88,6 @@
dmt->deps = &dm_target_error_deps;
dmt->destroy = &dm_target_error_destroy;
dmt->upcall = &dm_target_error_upcall;
- dmt->secsize = dm_target_dummy_secsize;
r = dm_target_insert(dmt);
diff -r 71024b1dd56c -r bdf885612bc1 sys/dev/dm/dm_target_mirror.c
--- a/sys/dev/dm/dm_target_mirror.c Sun Dec 15 09:38:40 2019 +0000
+++ b/sys/dev/dm/dm_target_mirror.c Sun Dec 15 09:42:29 2019 +0000
@@ -1,4 +1,4 @@
-/*$NetBSD: dm_target_mirror.c,v 1.20 2019/12/15 05:56:02 tkusumi Exp $*/
+/*$NetBSD: dm_target_mirror.c,v 1.21 2019/12/15 09:42:29 tkusumi Exp $*/
/*
* Copyright (c) 2009 The NetBSD Foundation, Inc.
@@ -29,7 +29,7 @@
* POSSIBILITY OF SUCH DAMAGE.
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: dm_target_mirror.c,v 1.20 2019/12/15 05:56:02 tkusumi Exp $");
+__KERNEL_RCSID(0, "$NetBSD: dm_target_mirror.c,v 1.21 2019/12/15 09:42:29 tkusumi Exp $");
/*
* This file implements initial version of device-mapper mirror target.
@@ -100,7 +100,6 @@
dmt->deps = &dm_target_mirror_deps;
dmt->destroy = &dm_target_mirror_destroy;
dmt->upcall = &dm_target_mirror_upcall;
- dmt->secsize = dm_target_dummy_secsize;
r = dm_target_insert(dmt);
diff -r 71024b1dd56c -r bdf885612bc1 sys/dev/dm/dm_target_snapshot.c
--- a/sys/dev/dm/dm_target_snapshot.c Sun Dec 15 09:38:40 2019 +0000
+++ b/sys/dev/dm/dm_target_snapshot.c Sun Dec 15 09:42:29 2019 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: dm_target_snapshot.c,v 1.32 2019/12/15 05:56:02 tkusumi Exp $ */
+/* $NetBSD: dm_target_snapshot.c,v 1.33 2019/12/15 09:42:29 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.32 2019/12/15 05:56:02 tkusumi Exp $");
+__KERNEL_RCSID(0, "$NetBSD: dm_target_snapshot.c,v 1.33 2019/12/15 09:42:29 tkusumi Exp $");
/*
* 1. Suspend my_data to temporarily stop any I/O while the snapshot is being
@@ -163,7 +163,6 @@
dmt->deps = &dm_target_snapshot_deps;
dmt->destroy = &dm_target_snapshot_destroy;
dmt->upcall = &dm_target_snapshot_upcall;
- dmt->secsize = dm_target_dummy_secsize;
r = dm_target_insert(dmt);
@@ -177,7 +176,6 @@
dmt1->deps = &dm_target_snapshot_orig_deps;
dmt1->destroy = &dm_target_snapshot_orig_destroy;
dmt1->upcall = &dm_target_snapshot_orig_upcall;
- dmt1->secsize = dm_target_dummy_secsize;
r = dm_target_insert(dmt1);
break;
diff -r 71024b1dd56c -r bdf885612bc1 sys/dev/dm/dm_target_zero.c
--- a/sys/dev/dm/dm_target_zero.c Sun Dec 15 09:38:40 2019 +0000
+++ b/sys/dev/dm/dm_target_zero.c Sun Dec 15 09:42:29 2019 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: dm_target_zero.c,v 1.23 2019/12/15 05:56:02 tkusumi Exp $ */
+/* $NetBSD: dm_target_zero.c,v 1.24 2019/12/15 09:42:29 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.23 2019/12/15 05:56:02 tkusumi Exp $");
+__KERNEL_RCSID(0, "$NetBSD: dm_target_zero.c,v 1.24 2019/12/15 09:42:29 tkusumi Exp $");
/*
* This file implements initial version of device-mapper zero target.
@@ -88,7 +88,6 @@
dmt->deps = &dm_target_zero_deps;
dmt->destroy = &dm_target_zero_destroy;
dmt->upcall = &dm_target_zero_upcall;
- dmt->secsize = dm_target_dummy_secsize;
r = dm_target_insert(dmt);
break;
Home |
Main Index |
Thread Index |
Old Index