[PATCH RFC tip/core/rcu 1/4] dax/super: Dynamically allocate dax_srcu

From: Paul E. McKenney
Date: Tue Apr 02 2019 - 10:29:48 EST


Having DEFINE_SRCU() or DEFINE_STATIC_SRCU() in a loadable module
requires that the size of the reserved region be increased, which is
not something we really want to be doing. This commit therefore removes
the DEFINE_STATIC_SRCU() from drivers/dax/super.c in favor of defining
dax_srcu as a simple srcu_struct, initializing it in dax_core_init(),
and cleaning it up in dax_core_exit().

Reported-by: kbuild test robot <lkp@xxxxxxxxx>
Signed-off-by: Paul E. McKenney <paulmck@xxxxxxxxxxxxx>
Cc: Dan Williams <dan.j.williams@xxxxxxxxx>
Cc: Vishal Verma <vishal.l.verma@xxxxxxxxx>
Cc: Keith Busch <keith.busch@xxxxxxxxx>
Cc: Dave Jiang <dave.jiang@xxxxxxxxx>
Cc: Tejun Heo <tj@xxxxxxxxxx>
Cc: <linux-nvdimm@xxxxxxxxxxxx>
---
drivers/dax/super.c | 10 +++++++++-
1 file changed, 9 insertions(+), 1 deletion(-)

diff --git a/drivers/dax/super.c b/drivers/dax/super.c
index 0a339b85133e..3b152db30c6b 100644
--- a/drivers/dax/super.c
+++ b/drivers/dax/super.c
@@ -25,7 +25,7 @@
#include "dax-private.h"

static dev_t dax_devt;
-DEFINE_STATIC_SRCU(dax_srcu);
+static struct srcu_struct dax_srcu;
static struct vfsmount *dax_mnt;
static DEFINE_IDA(dax_minor_ida);
static struct kmem_cache *dax_cache __read_mostly;
@@ -665,6 +665,10 @@ static int __init dax_core_init(void)
{
int rc;

+ rc = init_srcu_struct(&dax_srcu);
+ if (rc)
+ goto err_srcu;
+
rc = dax_fs_init();
if (rc)
return rc;
@@ -678,10 +682,13 @@ static int __init dax_core_init(void)
goto err_bus;
return 0;

+
err_bus:
unregister_chrdev_region(dax_devt, MINORMASK+1);
err_chrdev:
dax_fs_exit();
+ cleanup_srcu_struct(&dax_srcu);
+err_srcu:
return 0;
}

@@ -690,6 +697,7 @@ static void __exit dax_core_exit(void)
unregister_chrdev_region(dax_devt, MINORMASK+1);
ida_destroy(&dax_minor_ida);
dax_fs_exit();
+ cleanup_srcu_struct(&dax_srcu);
}

MODULE_AUTHOR("Intel Corporation");
--
2.17.1