scst: Introduce scst_pr_init() and scst_pr_cleanup()

git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@6485 d57e44dd-8a1f-0410-8b47-8ef2f437770f
This commit is contained in:
Bart Van Assche
2015-08-26 23:34:36 +00:00
parent 2e5d1a4a6e
commit 3732ee39f8
3 changed files with 25 additions and 7 deletions

View File

@@ -3964,13 +3964,7 @@ int scst_alloc_device(gfp_t gfp_mask, struct scst_device **out_dev)
dev->dev_double_ua_possible = 1;
dev->queue_alg = SCST_QUEUE_ALG_1_UNRESTRICTED_REORDER;
mutex_init(&dev->dev_pr_mutex);
dev->pr_generation = 0;
dev->pr_is_set = 0;
dev->pr_holder = NULL;
dev->pr_scope = SCOPE_LU;
dev->pr_type = TYPE_UNSPECIFIED;
INIT_LIST_HEAD(&dev->dev_registrants_list);
scst_pr_init(dev);
BUILD_BUG_ON(SCST_DIF_NO_CHECK_APP_TAG != 0);
dev->dev_dif_static_app_tag = SCST_DIF_NO_CHECK_APP_TAG;
@@ -4003,6 +3997,8 @@ void scst_free_device(struct scst_device *dev)
scst_deinit_threads(&dev->dev_cmd_threads);
scst_pr_cleanup(dev);
kfree(dev->virt_name);
kmem_cache_free(scst_dev_cachep, dev);

View File

@@ -1150,6 +1150,25 @@ out:
return res;
}
/* Initialize the PR members in *dev. */
int scst_pr_init(struct scst_device *dev)
{
mutex_init(&dev->dev_pr_mutex);
dev->pr_generation = 0;
dev->pr_is_set = 0;
dev->pr_holder = NULL;
dev->pr_scope = SCOPE_LU;
dev->pr_type = TYPE_UNSPECIFIED;
INIT_LIST_HEAD(&dev->dev_registrants_list);
return 0;
}
/* Free the resources allocated by scst_pr_init(). */
void scst_pr_cleanup(struct scst_device *dev)
{
}
/* Must be called under dev_pr_mutex or before dev is on the device list. */
int scst_pr_init_dev(struct scst_device *dev)
{

View File

@@ -772,6 +772,9 @@ void scst_unthrottle_cmd(struct scst_cmd *cmd);
int scst_do_internal_parsing(struct scst_cmd *cmd);
int scst_parse_descriptors(struct scst_cmd *cmd);
int scst_pr_init(struct scst_device *dev);
void scst_pr_cleanup(struct scst_device *dev);
#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 39)
void scst_vfs_unlink_and_put(struct nameidata *nd);
#else