Tue Dec 31 10:30:30 2019 UTC ()
dm: Remove unnecessary inlining

These two don't really need to be inlined.


(tkusumi)
diff -r1.16 -r1.17 src/sys/dev/dm/dm_dev.c
diff -r1.18 -r1.19 src/sys/dev/dm/dm_table.c

cvs diff -r1.16 -r1.17 src/sys/dev/dm/dm_dev.c (expand / switch to unified diff)

--- src/sys/dev/dm/dm_dev.c 2019/12/15 14:39:42 1.16
+++ src/sys/dev/dm/dm_dev.c 2019/12/31 10:30:30 1.17
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: dm_dev.c,v 1.16 2019/12/15 14:39:42 tkusumi Exp $ */ 1/* $NetBSD: dm_dev.c,v 1.17 2019/12/31 10:30:30 tkusumi Exp $ */
2 2
3/* 3/*
4 * Copyright (c) 2008 The NetBSD Foundation, Inc. 4 * Copyright (c) 2008 The NetBSD Foundation, Inc.
5 * All rights reserved. 5 * All rights reserved.
6 * 6 *
7 * This code is derived from software contributed to The NetBSD Foundation 7 * This code is derived from software contributed to The NetBSD Foundation
8 * by Adam Hamsik. 8 * by Adam Hamsik.
9 * 9 *
10 * Redistribution and use in source and binary forms, with or without 10 * Redistribution and use in source and binary forms, with or without
11 * modification, are permitted provided that the following conditions 11 * modification, are permitted provided that the following conditions
12 * are met: 12 * are met:
13 * 1. Redistributions of source code must retain the above copyright 13 * 1. Redistributions of source code must retain the above copyright
14 * notice, this list of conditions and the following disclaimer. 14 * notice, this list of conditions and the following disclaimer.
@@ -19,49 +19,49 @@ @@ -19,49 +19,49 @@
19 * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS 19 * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
20 * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED 20 * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
21 * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 21 * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
22 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS 22 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
23 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 23 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
24 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 24 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
25 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 25 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
26 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 26 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
27 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 27 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
28 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 28 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
29 * POSSIBILITY OF SUCH DAMAGE. 29 * POSSIBILITY OF SUCH DAMAGE.
30 */ 30 */
31#include <sys/cdefs.h> 31#include <sys/cdefs.h>
32__KERNEL_RCSID(0, "$NetBSD: dm_dev.c,v 1.16 2019/12/15 14:39:42 tkusumi Exp $"); 32__KERNEL_RCSID(0, "$NetBSD: dm_dev.c,v 1.17 2019/12/31 10:30:30 tkusumi Exp $");
33 33
34#include <sys/types.h> 34#include <sys/types.h>
35#include <sys/param.h> 35#include <sys/param.h>
36#include <sys/disk.h> 36#include <sys/disk.h>
37#include <sys/disklabel.h> 37#include <sys/disklabel.h>
38#include <sys/ioctl.h> 38#include <sys/ioctl.h>
39#include <sys/ioccom.h> 39#include <sys/ioccom.h>
40#include <sys/kmem.h> 40#include <sys/kmem.h>
41 41
42#include "netbsd-dm.h" 42#include "netbsd-dm.h"
43#include "dm.h" 43#include "dm.h"
44 44
45static dm_dev_t *dm_dev_lookup_name(const char *); 45static dm_dev_t *dm_dev_lookup_name(const char *);
46static dm_dev_t *dm_dev_lookup_uuid(const char *); 46static dm_dev_t *dm_dev_lookup_uuid(const char *);
47static dm_dev_t *dm_dev_lookup_minor(int); 47static dm_dev_t *dm_dev_lookup_minor(int);
48 48
49static struct dm_dev_head dm_dev_list = TAILQ_HEAD_INITIALIZER(dm_dev_list); 49static struct dm_dev_head dm_dev_list = TAILQ_HEAD_INITIALIZER(dm_dev_list);
50 50
51static kmutex_t dm_dev_mutex; 51static kmutex_t dm_dev_mutex;
52 52
53/* dm_dev_mutex must be holdby caller before using disable_dev. */ 53/* dm_dev_mutex must be holdby caller before using disable_dev. */
54__inline static void 54static void
55disable_dev(dm_dev_t *dmv) 55disable_dev(dm_dev_t *dmv)
56{ 56{
57 57
58 TAILQ_REMOVE(&dm_dev_list, dmv, next_devlist); 58 TAILQ_REMOVE(&dm_dev_list, dmv, next_devlist);
59 mutex_enter(&dmv->dev_mtx); 59 mutex_enter(&dmv->dev_mtx);
60 mutex_exit(&dm_dev_mutex); 60 mutex_exit(&dm_dev_mutex);
61 while (dmv->ref_cnt != 0) 61 while (dmv->ref_cnt != 0)
62 cv_wait(&dmv->dev_cv, &dmv->dev_mtx); 62 cv_wait(&dmv->dev_cv, &dmv->dev_mtx);
63 mutex_exit(&dmv->dev_mtx); 63 mutex_exit(&dmv->dev_mtx);
64} 64}
65 65
66/* 66/*
67 * Generic function used to lookup dm_dev_t. Calling with dm_dev_name 67 * Generic function used to lookup dm_dev_t. Calling with dm_dev_name

cvs diff -r1.18 -r1.19 src/sys/dev/dm/dm_table.c (expand / switch to unified diff)

--- src/sys/dev/dm/dm_table.c 2019/12/22 13:16:09 1.18
+++ src/sys/dev/dm/dm_table.c 2019/12/31 10:30:30 1.19
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: dm_table.c,v 1.18 2019/12/22 13:16:09 tkusumi Exp $ */ 1/* $NetBSD: dm_table.c,v 1.19 2019/12/31 10:30:30 tkusumi Exp $ */
2 2
3/* 3/*
4 * Copyright (c) 2008 The NetBSD Foundation, Inc. 4 * Copyright (c) 2008 The NetBSD Foundation, Inc.
5 * All rights reserved. 5 * All rights reserved.
6 * 6 *
7 * This code is derived from software contributed to The NetBSD Foundation 7 * This code is derived from software contributed to The NetBSD Foundation
8 * by Adam Hamsik. 8 * by Adam Hamsik.
9 * 9 *
10 * Redistribution and use in source and binary forms, with or without 10 * Redistribution and use in source and binary forms, with or without
11 * modification, are permitted provided that the following conditions 11 * modification, are permitted provided that the following conditions
12 * are met: 12 * are met:
13 * 1. Redistributions of source code must retain the above copyright 13 * 1. Redistributions of source code must retain the above copyright
14 * notice, this list of conditions and the following disclaimer. 14 * notice, this list of conditions and the following disclaimer.
@@ -19,27 +19,27 @@ @@ -19,27 +19,27 @@
19 * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS 19 * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
20 * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED 20 * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
21 * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 21 * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
22 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS 22 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
23 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 23 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
24 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 24 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
25 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 25 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
26 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 26 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
27 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 27 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
28 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 28 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
29 * POSSIBILITY OF SUCH DAMAGE. 29 * POSSIBILITY OF SUCH DAMAGE.
30 */ 30 */
31#include <sys/cdefs.h> 31#include <sys/cdefs.h>
32__KERNEL_RCSID(0, "$NetBSD: dm_table.c,v 1.18 2019/12/22 13:16:09 tkusumi Exp $"); 32__KERNEL_RCSID(0, "$NetBSD: dm_table.c,v 1.19 2019/12/31 10:30:30 tkusumi Exp $");
33 33
34#include <sys/types.h> 34#include <sys/types.h>
35#include <sys/param.h> 35#include <sys/param.h>
36#include <sys/kmem.h> 36#include <sys/kmem.h>
37 37
38#include "dm.h" 38#include "dm.h"
39 39
40/* 40/*
41 * There are two types of users of this interface: 41 * There are two types of users of this interface:
42 * 42 *
43 * a) Readers such as 43 * a) Readers such as
44 * dmstrategy, dmgetdisklabel, dmsize, dm_dev_status_ioctl, 44 * dmstrategy, dmgetdisklabel, dmsize, dm_dev_status_ioctl,
45 * dm_table_deps_ioctl, dm_table_status_ioctl, dm_table_reload_ioctl 45 * dm_table_deps_ioctl, dm_table_status_ioctl, dm_table_reload_ioctl
@@ -171,27 +171,27 @@ dm_table_destroy(dm_table_head_t *head,  @@ -171,27 +171,27 @@ dm_table_destroy(dm_table_head_t *head,
171 dm_table_free_deps(table_en); 171 dm_table_free_deps(table_en);
172 kmem_free(table_en, sizeof(*table_en)); 172 kmem_free(table_en, sizeof(*table_en));
173 } 173 }
174 KASSERT(SLIST_EMPTY(tbl)); 174 KASSERT(SLIST_EMPTY(tbl));
175 175
176 mutex_exit(&head->table_mtx); 176 mutex_exit(&head->table_mtx);
177 177
178 return 0; 178 return 0;
179} 179}
180 180
181/* 181/*
182 * Return length of active table in device. 182 * Return length of active table in device.
183 */ 183 */
184static inline uint64_t 184static uint64_t
185dm_table_size_impl(dm_table_head_t *head, int table) 185dm_table_size_impl(dm_table_head_t *head, int table)
186{ 186{
187 dm_table_t *tbl; 187 dm_table_t *tbl;
188 dm_table_entry_t *table_en; 188 dm_table_entry_t *table_en;
189 uint64_t length; 189 uint64_t length;
190 uint8_t id; 190 uint8_t id;
191 191
192 length = 0; 192 length = 0;
193 193
194 id = dm_table_busy(head, table); 194 id = dm_table_busy(head, table);
195 195
196 /* Select active table */ 196 /* Select active table */
197 tbl = &head->tables[id]; 197 tbl = &head->tables[id];