staging: lustre: libcfs: use dynamic minors for /dev/{lnet, obd}
PATCH 1/1 staging: lustre: libcfs: use dynamic minors for /dev/{lnet, obd}
From: "John L. Hammond" <[email protected]>
Request dynamic minor allocation when registering /dev/lnet and /dev/obd.
Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-100086
Reviewed-on: https://review.whamcloud.com/29741
--- drivers/staging/lustre/include/linux/libcfs/linux/libcfs.h | 1 - drivers/staging/lustre/include/uapi/linux/lnet/lnetctl.h | 11 ----------- .../staging/lustre/include/uapi/linux/lustre/lustre_ioctl.h | 2 -- drivers/staging/lustre/lnet/libcfs/linux/linux-debug.c | 1 - drivers/staging/lustre/lnet/libcfs/linux/linux-module.c | 5 ++--- drivers/staging/lustre/lnet/libcfs/module.c | 1 + drivers/staging/lustre/lustre/obdclass/class_obd.c | 6 ++++-- drivers/staging/lustre/lustre/obdclass/linux/linux-module.c | 3 +-- 8 files changed, 8 insertions(+), 22 deletions(-)
drivers/staging/lustre/include/linux/libcfs/linux/libcfs.h +0 -1
@@ -50,7 +50,6 @@#include <linux/kernel.h> #include <linux/kmod.h> #include <linux/kthread.h> -#include <linux/miscdevice.h> #include <linux/mm.h> #include <linux/mm_inline.h> #include <linux/module.h>
drivers/staging/lustre/include/uapi/linux/lnet/lnetctl.h +0 -11
@@ -119,16 +119,5 @@ struct lnet_fault_stat {#define LNET_DEV_ID 0#define LNET_DEV_PATH "/dev/lnet" -#define LNET_DEV_MAJOR 10 -#define LNET_DEV_MINOR 240 -#define OBD_DEV_ID 1 -#define OBD_DEV_NAME "obd" -#define OBD_DEV_PATH "/dev/" OBD_DEV_NAME -#define OBD_DEV_MAJOR 10 -#define OBD_DEV_MINOR 241 -#define SMFS_DEV_ID 2 -#define SMFS_DEV_PATH "/dev/snapdev" -#define SMFS_DEV_MAJOR 10 -#define SMFS_DEV_MINOR 242#endif
drivers/staging/lustre/include/uapi/linux/lustre/lustre_ioctl.h +0 -2
@@ -51,8 +51,6 @@ enum md_echo_cmd {#define OBD_DEV_ID 1#define OBD_DEV_NAME "obd"#define OBD_DEV_PATH "/dev/" OBD_DEV_NAME -#define OBD_DEV_MAJOR 10 -#define OBD_DEV_MINOR 241#define OBD_IOCTL_VERSION 0x00010004#define OBD_DEV_BY_DEVNAME 0xffffd0de
drivers/staging/lustre/lnet/libcfs/linux/linux-debug.c +0 -1
@@ -48,7 +48,6 @@#include <linux/completion.h> #include <linux/fs.h> #include <linux/uaccess.h> -#include <linux/miscdevice.h> # define DEBUG_SUBSYSTEM S_LNET
drivers/staging/lustre/lnet/libcfs/linux/linux-module.c +2 -3
@@ -33,10 +33,9 @@#define DEBUG_SUBSYSTEM S_LNET +#include <linux/miscdevice.h> #include <linux/libcfs/libcfs.h> -#define LNET_MINOR 240 -static inline size_t libcfs_ioctl_packlen (struct libcfs_ioctl_data *data) {size_t len =sizeof (*data);
@@ -191,7 +190,7 @@ int libcfs_ioctl_getdata(struct libcfs_ioctl_hdr **hdr_pp, };struct miscdevice libcfs_dev = { - .minor =LNET_MINOR , + .minor =MISC_DYNAMIC_MINOR , .name ="lnet" , .fops = &libcfs_fops, };
drivers/staging/lustre/lnet/libcfs/module.c +1 -0
@@ -30,6 +30,7 @@* This file is part of Lustre, http://www.lustre.org/ * Lustre is a trademark of Sun Microsystems, Inc. */ +#include <linux/miscdevice.h> #include <linux/module.h> #include <linux/kernel.h> #include <linux/mm.h>
drivers/staging/lustre/lustre/obdclass/class_obd.c +4 -2
@@ -32,7 +32,9 @@*/ #define DEBUG_SUBSYSTEM S_CLASS -# include <linux/atomic.h> + +#include <linux/atomic.h> +#include <linux/miscdevice.h> #include <obd_support.h> #include <obd_class.h>
@@ -462,7 +464,7 @@ static int __init obdclass_init(void) err =misc_register (&obd_psdev);if (err) { -CERROR ("cannot register %d err %d\n" ,OBD_DEV_MINOR , err); +CERROR ("cannot register OBD miscdevices: err %d\n" , err);return err; }
drivers/staging/lustre/lustre/obdclass/linux/linux-module.c +1 -2
@@ -42,7 +42,6 @@#include <linux/module.h> #include <linux/errno.h> #include <linux/kernel.h> -#include <linux/major.h> #include <linux/sched.h> #include <linux/lp.h> #include <linux/slab.h>
@@ -271,7 +270,7 @@ static long obd_class_ioctl(struct file *filp, unsigned int cmd,/* modules setup */ struct miscdevice obd_psdev = { - .minor =OBD_DEV_MINOR , + .minor =MISC_DYNAMIC_MINOR , .name =OBD_DEV_NAME , .fops = &obd_psdev_fops, };
Signature · 6 lines
1.8.3.1 _______________________________________________ devel mailing list [email protected] http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
Quoted 5 lines · James Simmons
From: "John L. Hammond" <[email protected]>
Request dynamic minor allocation when registering
/dev/lnetand/dev/obd.
Quoted 7 lines
Signed-off-by John L. Hammond <[email protected]>Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-100086
Reviewed-on: https://review.whamcloud.com/29741Reviewed-by Andreas Dilger <[email protected]>Reviewed-by Jian Yu <[email protected]>Reviewed-by Oleg Drokin <[email protected]>Signed-off-by James Simmons <[email protected]>
Yes, this is a much better fix than my kconfig change.
and thanks for your quick review on my last series! Thanks,
NeilBrown
Quoted 153 lines
--- drivers/staging/lustre/include/linux/libcfs/linux/libcfs.h | 1 - drivers/staging/lustre/include/uapi/linux/lnet/lnetctl.h | 11 ----------- .../staging/lustre/include/uapi/linux/lustre/lustre_ioctl.h | 2 -- drivers/staging/lustre/lnet/libcfs/linux/linux-debug.c | 1 - drivers/staging/lustre/lnet/libcfs/linux/linux-module.c | 5 ++--- drivers/staging/lustre/lnet/libcfs/module.c | 1 + drivers/staging/lustre/lustre/obdclass/class_obd.c | 6 ++++-- drivers/staging/lustre/lustre/obdclass/linux/linux-module.c | 3 +-- 8 files changed, 8 insertions(+), 22 deletions(-)drivers/staging/lustre/include/linux/libcfs/linux/libcfs.h +0
-1@@ -50,7 +50,6 @@#include <linux/kernel.h> #include <linux/kmod.h> #include <linux/kthread.h> -#include <linux/miscdevice.h> #include <linux/mm.h> #include <linux/mm_inline.h> #include <linux/module.h> drivers/staging/lustre/include/uapi/linux/lnet/lnetctl.h +0
-11@@ -119,16 +119,5 @@ struct lnet_fault_stat {#define LNET_DEV_ID 0#define LNET_DEV_PATH "/dev/lnet" -#define LNET_DEV_MAJOR 10 -#define LNET_DEV_MINOR 240 -#define OBD_DEV_ID 1 -#define OBD_DEV_NAME "obd" -#define OBD_DEV_PATH "/dev/" OBD_DEV_NAME -#define OBD_DEV_MAJOR 10 -#define OBD_DEV_MINOR 241 -#define SMFS_DEV_ID 2 -#define SMFS_DEV_PATH "/dev/snapdev" -#define SMFS_DEV_MAJOR 10 -#define SMFS_DEV_MINOR 242#endif drivers/staging/lustre/include/uapi/linux/lustre/lustre_ioctl.h +0
-2@@ -51,8 +51,6 @@ enum md_echo_cmd {#define OBD_DEV_ID 1#define OBD_DEV_NAME "obd"#define OBD_DEV_PATH "/dev/" OBD_DEV_NAME -#define OBD_DEV_MAJOR 10 -#define OBD_DEV_MINOR 241#define OBD_IOCTL_VERSION 0x00010004#define OBD_DEV_BY_DEVNAME 0xffffd0dedrivers/staging/lustre/lnet/libcfs/linux/linux-debug.c +0
-1@@ -48,7 +48,6 @@#include <linux/completion.h> #include <linux/fs.h> #include <linux/uaccess.h> -#include <linux/miscdevice.h> # define DEBUG_SUBSYSTEM S_LNETdrivers/staging/lustre/lnet/libcfs/linux/linux-module.c +2
-3@@ -33,10 +33,9 @@#define DEBUG_SUBSYSTEM S_LNET +#include <linux/miscdevice.h> #include <linux/libcfs/libcfs.h> -#define LNET_MINOR 240 -static inline size_t libcfs_ioctl_packlen (struct libcfs_ioctl_data *data) {size_t len =sizeof (*data);@@ -191,7 +190,7 @@ int libcfs_ioctl_getdata(struct libcfs_ioctl_hdr **hdr_pp, };struct miscdevice libcfs_dev = { - .minor =LNET_MINOR , + .minor =MISC_DYNAMIC_MINOR , .name ="lnet" , .fops = &libcfs_fops, };drivers/staging/lustre/lnet/libcfs/module.c +1
-0@@ -30,6 +30,7 @@* This file is part of Lustre, http://www.lustre.org/ * Lustre is a trademark of Sun Microsystems, Inc. */ +#include <linux/miscdevice.h> #include <linux/module.h> #include <linux/kernel.h> #include <linux/mm.h> drivers/staging/lustre/lustre/obdclass/class_obd.c +4
-2@@ -32,7 +32,9 @@*/ #define DEBUG_SUBSYSTEM S_CLASS -# include <linux/atomic.h> + +#include <linux/atomic.h> +#include <linux/miscdevice.h> #include <obd_support.h> #include <obd_class.h> @@ -462,7 +464,7 @@ static int __init obdclass_init(void) err =misc_register (&obd_psdev);if (err) { -CERROR ("cannot register %d err %d\n" ,OBD_DEV_MINOR , err); +CERROR ("cannot register OBD miscdevices: err %d\n" , err);return err; }drivers/staging/lustre/lustre/obdclass/linux/linux-module.c +1
-2@@ -42,7 +42,6 @@#include <linux/module.h> #include <linux/errno.h> #include <linux/kernel.h> -#include <linux/major.h> #include <linux/sched.h> #include <linux/lp.h> #include <linux/slab.h> @@ -271,7 +270,7 @@ static long obd_class_ioctl(struct file *filp, unsigned int cmd,/* modules setup */ struct miscdevice obd_psdev = { - .minor =OBD_DEV_MINOR , + .minor =MISC_DYNAMIC_MINOR , .name =OBD_DEV_NAME , .fops = &obd_psdev_fops, };Signature · 1 line
1.8.3.1
_______________________________________________
devel mailing list
[email protected]
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel