mirror of
https://github.com/SCST-project/scst.git
synced 2026-08-18 05:06:31 +00:00
Minor threads related fixes
git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@127 d57e44dd-8a1f-0410-8b47-8ef2f437770f
This commit is contained in:
@@ -1181,7 +1181,7 @@ struct scst_device
|
||||
/* Pointer to lists of commands with the lock */
|
||||
struct scst_cmd_lists *p_cmd_lists;
|
||||
|
||||
/* Lists of commands with the lock, if dedicated threads are used */
|
||||
/* Lists of commands with lock, if dedicated threads are used */
|
||||
struct scst_cmd_lists cmd_lists;
|
||||
|
||||
/* How many cmds alive on this dev */
|
||||
@@ -1257,8 +1257,11 @@ struct scst_device
|
||||
/* List of acg_dev's, one per acg, protected by scst_mutex */
|
||||
struct list_head dev_acg_dev_list;
|
||||
|
||||
/* List of dedicated threads. Doesn't need any protection. */
|
||||
/* List of dedicated threads, protected by scst_mutex */
|
||||
struct list_head threads_list;
|
||||
|
||||
/* Device number */
|
||||
int dev_num;
|
||||
};
|
||||
|
||||
/*
|
||||
|
||||
+6
-6
@@ -898,17 +898,17 @@ void scst_unregister_virtual_dev_driver(struct scst_dev_type *dev_type)
|
||||
int scst_add_dev_threads(struct scst_device *dev, int num)
|
||||
{
|
||||
int i, res = 0;
|
||||
static atomic_t major = ATOMIC_INIT(0);
|
||||
int N, n = 0;
|
||||
int n = 0;
|
||||
struct scst_cmd_thread_t *thr;
|
||||
char nm[12];
|
||||
|
||||
TRACE_ENTRY();
|
||||
|
||||
N = atomic_inc_return(&major);
|
||||
list_for_each_entry(thr, &dev->threads_list, thread_list_entry) {
|
||||
n++;
|
||||
}
|
||||
|
||||
for (i = 0; i < num; i++) {
|
||||
struct scst_cmd_thread_t *thr;
|
||||
|
||||
thr = kmalloc(sizeof(*thr), GFP_KERNEL);
|
||||
if (!thr) {
|
||||
res = -ENOMEM;
|
||||
@@ -918,7 +918,7 @@ int scst_add_dev_threads(struct scst_device *dev, int num)
|
||||
strncpy(nm, dev->handler->name, ARRAY_SIZE(nm)-1);
|
||||
nm[ARRAY_SIZE(nm)-1] = '\0';
|
||||
thr->cmd_thread = kthread_run(scst_cmd_thread,
|
||||
&dev->cmd_lists, "%sd%d_%d", nm, N, n++);
|
||||
&dev->cmd_lists, "%sd%d_%d", nm, dev->dev_num, n++);
|
||||
if (IS_ERR(thr->cmd_thread)) {
|
||||
res = PTR_ERR(thr->cmd_thread);
|
||||
PRINT_ERROR_PR("kthread_create() failed: %d", res);
|
||||
|
||||
@@ -150,6 +150,7 @@ int scst_alloc_device(int gfp_mask, struct scst_device **out_dev)
|
||||
{
|
||||
struct scst_device *dev;
|
||||
int res = 0;
|
||||
static int dev_num; /* protected by scst_mutex */
|
||||
|
||||
TRACE_ENTRY();
|
||||
|
||||
@@ -172,6 +173,7 @@ int scst_alloc_device(int gfp_mask, struct scst_device **out_dev)
|
||||
init_waitqueue_head(&dev->on_dev_waitQ);
|
||||
dev->dev_double_ua_possible = 1;
|
||||
dev->dev_serialized = 1;
|
||||
dev->dev_num = dev_num++;
|
||||
|
||||
*out_dev = dev;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user