mirror of
https://github.com/SCST-project/scst.git
synced 2026-08-18 05:06:31 +00:00
1. Fix for a possible hang on threading model changing
2. Performance improvement on rotating storage git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@1943 d57e44dd-8a1f-0410-8b47-8ef2f437770f
This commit is contained in:
@@ -456,7 +456,7 @@ static struct kmem_cache *blockio_work_cachep;
|
||||
static struct scst_dev_type vdisk_blk_devtype = {
|
||||
.name = "vdisk_blockio",
|
||||
.type = TYPE_DISK,
|
||||
.threads_num = 0,
|
||||
.threads_num = 1,
|
||||
.parse_atomic = 1,
|
||||
.dev_done_atomic = 1,
|
||||
#ifdef CONFIG_SCST_PROC
|
||||
@@ -4273,10 +4273,14 @@ static int vdisk_write_proc(char *buffer, char **start, off_t offset,
|
||||
} else if (!strncmp("NULLIO", p, 6)) {
|
||||
p += 6;
|
||||
virt_dev->nullio = 1;
|
||||
/* Bad hack for anyway going out procfs */
|
||||
virt_dev->vdev_devt = &vdisk_null_devtype;
|
||||
TRACE_DBG("%s", "NULLIO");
|
||||
} else if (!strncmp("BLOCKIO", p, 7)) {
|
||||
p += 7;
|
||||
virt_dev->blockio = 1;
|
||||
/* Bad hack for anyway going out procfs */
|
||||
virt_dev->vdev_devt = &vdisk_blk_devtype;
|
||||
TRACE_DBG("%s", "BLOCKIO");
|
||||
} else if (!strncmp("REMOVABLE", p, 9)) {
|
||||
p += 9;
|
||||
@@ -4313,7 +4317,7 @@ static int vdisk_write_proc(char *buffer, char **start, off_t offset,
|
||||
|
||||
vdisk_report_registering(virt_dev);
|
||||
virt_dev->virt_id = scst_register_virtual_device(
|
||||
dev_type, virt_dev->name);
|
||||
virt_dev->vdev_devt, virt_dev->name);
|
||||
if (virt_dev->virt_id < 0) {
|
||||
res = virt_dev->virt_id;
|
||||
goto out_free_vpath;
|
||||
|
||||
+15
-1
@@ -1480,10 +1480,18 @@ int scst_add_threads(struct scst_cmd_threads *cmd_threads,
|
||||
|
||||
TRACE_ENTRY();
|
||||
|
||||
if (num == 0) {
|
||||
res = 0;
|
||||
goto out;
|
||||
}
|
||||
|
||||
list_for_each_entry(thr, &cmd_threads->threads_list, thread_list_entry) {
|
||||
n++;
|
||||
}
|
||||
|
||||
TRACE_DBG("cmd_threads %p, dev %p, tgt_dev %p, num %d, n %d",
|
||||
cmd_threads, dev, tgt_dev, num, n);
|
||||
|
||||
if (tgt_dev != NULL) {
|
||||
struct scst_tgt_dev *t;
|
||||
list_for_each_entry(t, &tgt_dev->dev->dev_tgt_dev_list,
|
||||
@@ -1526,6 +1534,9 @@ int scst_add_threads(struct scst_cmd_threads *cmd_threads,
|
||||
list_add(&thr->thread_list_entry, &cmd_threads->threads_list);
|
||||
cmd_threads->nr_threads++;
|
||||
|
||||
TRACE_DBG("Added thr %p to threads list (nr_threads %d, n %d)",
|
||||
thr, cmd_threads->nr_threads, n);
|
||||
|
||||
wake_up_process(thr->cmd_thread);
|
||||
}
|
||||
|
||||
@@ -1534,8 +1545,11 @@ int scst_add_threads(struct scst_cmd_threads *cmd_threads,
|
||||
* Wait for io_context gets initialized to avoid possible races
|
||||
* for it from the sharing it tgt_devs.
|
||||
*/
|
||||
while (cmd_threads->io_context == NULL)
|
||||
while (cmd_threads->io_context == NULL) {
|
||||
TRACE_DBG("Waiting for io_context for cmd_threads %p "
|
||||
"initialized", cmd_threads);
|
||||
msleep(50);
|
||||
}
|
||||
}
|
||||
|
||||
res = 0;
|
||||
|
||||
Reference in New Issue
Block a user