trivial patch to dm-log.c
PATCH 1/1 trivial patch to dm-log.c
This patches dm-log.c. In dm-register-dirty-log-type, I didn't seem any reason for the try_module_get to be within locked region of code. So I moved it. I also added the error return case, in the event try_module_get() fails.
I added THIS_MODULE intializers to the _core_type and _disk_type declarations. This isn't strictly necessary, but I think is good for consistency.
I reordered the __init declaration in dm_dirty_log_init() I removed dm_dirty_log_init and dm_dirty_log_exit() from the EXPORT_SYMBOL() list.
drivers/md/dm-log.c +6 -5
@@ -17,10 +17,11 @@int dm_register_dirty_log_type (struct dirty_log_type *type) { +if (!try_module_get (type->module)) +return -EINVAL ; +spin_lock (&_lock); type->use_count =0 ; -try_module_get (type->module); -list_add (&type->list, &_log_types);spin_unlock (&_lock);
@@ -567,6 +568,7 @@static struct dirty_log_type _core_type = { .name ="core" , + .module =THIS_MODULE , .ctr = core_ctr, .dtr = core_dtr, .get_region_size = core_get_region_size,
@@ -582,6 +584,7 @@static struct dirty_log_type _disk_type = { .name ="disk" , + .module =THIS_MODULE , .ctr = disk_ctr, .dtr = disk_dtr, .suspend = disk_flush,
@@ -597,7 +600,7 @@ .get_sync_count = core_get_sync_count }; -__init int dm_dirty_log_init (void ) +int __init dm_dirty_log_init (void ) {int r;
@@ -622,7 +625,5 @@EXPORT_SYMBOL (dm_register_dirty_log_type);EXPORT_SYMBOL (dm_unregister_dirty_log_type); -EXPORT_SYMBOL (dm_dirty_log_init); -EXPORT_SYMBOL (dm_dirty_log_exit);EXPORT_SYMBOL (dm_create_dirty_log);EXPORT_SYMBOL (dm_destroy_dirty_log);