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 dm core set config to NULL after destroy



details:   https://anonhg.NetBSD.org/src/rev/84a6b318227f
branches:  trunk
changeset: 846963:84a6b318227f
user:      tkusumi <tkusumi%NetBSD.org@localhost>
date:      Thu Dec 05 16:59:43 2019 +0000

description:
dm: Make dm core set config to NULL after destroy

Just let dm core do this instead of having a comment expecting each
target to do the right thing.

taken-from: DragonFlyBSD

diffstat:

 sys/dev/dm/dm_table.c           |  11 ++++-------
 sys/dev/dm/dm_target_error.c    |   6 ++----
 sys/dev/dm/dm_target_linear.c   |   5 ++---
 sys/dev/dm/dm_target_mirror.c   |   6 ++----
 sys/dev/dm/dm_target_snapshot.c |   6 ++----
 sys/dev/dm/dm_target_stripe.c   |   5 ++---
 sys/dev/dm/dm_target_zero.c     |   6 ++----
 7 files changed, 16 insertions(+), 29 deletions(-)

diffs (199 lines):

diff -r 2cf1a25f78a9 -r 84a6b318227f sys/dev/dm/dm_table.c
--- a/sys/dev/dm/dm_table.c     Thu Dec 05 16:51:06 2019 +0000
+++ b/sys/dev/dm/dm_table.c     Thu Dec 05 16:59:43 2019 +0000
@@ -1,4 +1,4 @@
-/*        $NetBSD: dm_table.c,v 1.9 2019/12/04 15:31:12 tkusumi Exp $      */
+/*        $NetBSD: dm_table.c,v 1.10 2019/12/05 16:59:43 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.9 2019/12/04 15:31:12 tkusumi Exp $");
+__KERNEL_RCSID(0, "$NetBSD: dm_table.c,v 1.10 2019/12/05 16:59:43 tkusumi Exp $");
 
 #include <sys/types.h>
 #include <sys/param.h>
@@ -162,11 +162,8 @@
 
        while (!SLIST_EMPTY(tbl)) {     /* List Deletion. */
                table_en = SLIST_FIRST(tbl);
-               /*
-                * Remove target specific config data. After successfull
-                * call table_en->target_config must be set to NULL.
-                */
-               table_en->target->destroy(table_en);
+               if (table_en->target->destroy(table_en) == 0)
+                       table_en->target_config = NULL;
 
                SLIST_REMOVE_HEAD(tbl, next);
 
diff -r 2cf1a25f78a9 -r 84a6b318227f sys/dev/dm/dm_target_error.c
--- a/sys/dev/dm/dm_target_error.c      Thu Dec 05 16:51:06 2019 +0000
+++ b/sys/dev/dm/dm_target_error.c      Thu Dec 05 16:59:43 2019 +0000
@@ -1,4 +1,4 @@
-/*        $NetBSD: dm_target_error.c,v 1.13 2019/12/01 06:53:31 tkusumi Exp $      */
+/*        $NetBSD: dm_target_error.c,v 1.14 2019/12/05 16:59:43 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.13 2019/12/01 06:53:31 tkusumi Exp $");
+__KERNEL_RCSID(0, "$NetBSD: dm_target_error.c,v 1.14 2019/12/05 16:59:43 tkusumi Exp $");
 
 /*
  * This file implements initial version of device-mapper error target.
@@ -155,8 +155,6 @@
 int
 dm_target_error_destroy(dm_table_entry_t * table_en)
 {
-       table_en->target_config = NULL;
-
        /* Unbusy target so we can unload it */
        dm_target_unbusy(table_en->target);
 
diff -r 2cf1a25f78a9 -r 84a6b318227f sys/dev/dm/dm_target_linear.c
--- a/sys/dev/dm/dm_target_linear.c     Thu Dec 05 16:51:06 2019 +0000
+++ b/sys/dev/dm/dm_target_linear.c     Thu Dec 05 16:59:43 2019 +0000
@@ -1,4 +1,4 @@
-/*        $NetBSD: dm_target_linear.c,v 1.21 2019/12/03 15:47:38 tkusumi Exp $      */
+/*        $NetBSD: dm_target_linear.c,v 1.22 2019/12/05 16:59:43 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_linear.c,v 1.21 2019/12/03 15:47:38 tkusumi Exp $");
+__KERNEL_RCSID(0, "$NetBSD: dm_target_linear.c,v 1.22 2019/12/05 16:59:43 tkusumi Exp $");
 
 /*
  * This file implements initial version of device-mapper dklinear target.
@@ -166,7 +166,6 @@
                goto out;
 
        dm_target_linear_config_t *tlc = table_en->target_config;
-       table_en->target_config = NULL;
 
        /* Decrement pdev ref counter if 0 remove it */
        dm_pdev_decr(tlc->pdev);
diff -r 2cf1a25f78a9 -r 84a6b318227f sys/dev/dm/dm_target_mirror.c
--- a/sys/dev/dm/dm_target_mirror.c     Thu Dec 05 16:51:06 2019 +0000
+++ b/sys/dev/dm/dm_target_mirror.c     Thu Dec 05 16:59:43 2019 +0000
@@ -1,4 +1,4 @@
-/*$NetBSD: dm_target_mirror.c,v 1.11 2019/12/01 06:53:31 tkusumi Exp $*/
+/*$NetBSD: dm_target_mirror.c,v 1.12 2019/12/05 16:59:43 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.11 2019/12/01 06:53:31 tkusumi Exp $");
+__KERNEL_RCSID(0, "$NetBSD: dm_target_mirror.c,v 1.12 2019/12/05 16:59:43 tkusumi Exp $");
 
 /*
  * This file implements initial version of device-mapper mirror target.
@@ -159,8 +159,6 @@
 int
 dm_target_mirror_destroy(dm_table_entry_t * table_en)
 {
-       table_en->target_config = NULL;
-
        /* Unbusy target so we can unload it */
        dm_target_unbusy(table_en->target);
 
diff -r 2cf1a25f78a9 -r 84a6b318227f sys/dev/dm/dm_target_snapshot.c
--- a/sys/dev/dm/dm_target_snapshot.c   Thu Dec 05 16:51:06 2019 +0000
+++ b/sys/dev/dm/dm_target_snapshot.c   Thu Dec 05 16:59:43 2019 +0000
@@ -1,4 +1,4 @@
-/*        $NetBSD: dm_target_snapshot.c,v 1.22 2019/12/03 15:47:38 tkusumi Exp $      */
+/*        $NetBSD: dm_target_snapshot.c,v 1.23 2019/12/05 16:59:43 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.22 2019/12/03 15:47:38 tkusumi Exp $");
+__KERNEL_RCSID(0, "$NetBSD: dm_target_snapshot.c,v 1.23 2019/12/05 16:59:43 tkusumi Exp $");
 
 /*
  * 1. Suspend my_data to temporarily stop any I/O while the snapshot is being
@@ -325,7 +325,6 @@
        printf("Snapshot target destroy function called\n");
 
        dm_target_snapshot_config_t *tsc = table_en->target_config;
-       table_en->target_config = NULL;
 
        /* Decrement pdev ref counter if 0 remove it */
        dm_pdev_decr(tsc->tsc_snap_dev);
@@ -493,7 +492,6 @@
                goto out;
 
        dm_target_snapshot_origin_config_t *tsoc = table_en->target_config;
-       table_en->target_config = NULL;
 
        /* Decrement pdev ref counter if 0 remove it */
        dm_pdev_decr(tsoc->tsoc_real_dev);
diff -r 2cf1a25f78a9 -r 84a6b318227f sys/dev/dm/dm_target_stripe.c
--- a/sys/dev/dm/dm_target_stripe.c     Thu Dec 05 16:51:06 2019 +0000
+++ b/sys/dev/dm/dm_target_stripe.c     Thu Dec 05 16:59:43 2019 +0000
@@ -1,4 +1,4 @@
-/*$NetBSD: dm_target_stripe.c,v 1.26 2019/12/03 15:47:38 tkusumi Exp $*/
+/*$NetBSD: dm_target_stripe.c,v 1.27 2019/12/05 16:59:43 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_stripe.c,v 1.26 2019/12/03 15:47:38 tkusumi Exp $");
+__KERNEL_RCSID(0, "$NetBSD: dm_target_stripe.c,v 1.27 2019/12/05 16:59:43 tkusumi Exp $");
 
 /*
  * This file implements initial version of device-mapper stripe target.
@@ -310,7 +310,6 @@
 dm_target_stripe_destroy(dm_table_entry_t * table_en)
 {
        dm_target_stripe_fini(table_en->target_config);
-       table_en->target_config = NULL;
 
        /* Unbusy target so we can unload it */
        dm_target_unbusy(table_en->target);
diff -r 2cf1a25f78a9 -r 84a6b318227f sys/dev/dm/dm_target_zero.c
--- a/sys/dev/dm/dm_target_zero.c       Thu Dec 05 16:51:06 2019 +0000
+++ b/sys/dev/dm/dm_target_zero.c       Thu Dec 05 16:59:43 2019 +0000
@@ -1,4 +1,4 @@
-/*        $NetBSD: dm_target_zero.c,v 1.14 2019/12/01 06:53:31 tkusumi Exp $      */
+/*        $NetBSD: dm_target_zero.c,v 1.15 2019/12/05 16:59:43 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.14 2019/12/01 06:53:31 tkusumi Exp $");
+__KERNEL_RCSID(0, "$NetBSD: dm_target_zero.c,v 1.15 2019/12/05 16:59:43 tkusumi Exp $");
 
 /*
  * This file implements initial version of device-mapper zero target.
@@ -162,8 +162,6 @@
 int
 dm_target_zero_destroy(dm_table_entry_t * table_en)
 {
-       table_en->target_config = NULL;
-
        /* Unbusy target so we can unload it */
        dm_target_unbusy(table_en->target);
 



Home | Main Index | Thread Index | Old Index