From: pr.jung Date: Tue, 13 Mar 2018 11:26:19 +0000 (+0900) Subject: block: Fix code to be more readable X-Git-Tag: submit/tizen/20180319.102056~1 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=f7ef75adb9e94e872ce8cd9527fb8db340ce4aab;p=platform%2Fcore%2Fsystem%2Fstoraged.git block: Fix code to be more readable Change-Id: I413ad40cb7cd633f5ad2f2af3af4343e9e497e79 Signed-off-by: pr.jung --- diff --git a/src/block/block.c b/src/block/block.c index 10c3f56..9eec602 100644 --- a/src/block/block.c +++ b/src/block/block.c @@ -2003,7 +2003,7 @@ static int add_operation(struct block_device *bdev, DD_LIST_APPEND(bdev->op_queue, op); th_manager[thread_id].op_len++; - if (th_manager[thread_id].op_len == 1 && !start_th) + if (th_manager[thread_id].op_len == 1 && start_th) pthread_cond_signal(&(th_manager[thread_id].cond)); pthread_mutex_unlock(&(th_manager[thread_id].mutex)); @@ -2018,9 +2018,9 @@ static int add_operation(struct block_device *bdev, _E("app2ext_disable_all_external_pkgs() failed"); - if (start_th) { + if (!start_th) { _D("Start New thread for block device"); - th_manager[thread_id].start_th = false; + th_manager[thread_id].start_th = true; ret = pthread_create(&(th_manager[thread_id].th), NULL, block_th_start, &th_manager[thread_id]); if (ret != 0) { _E("fail to create thread for %s", bdev->data->devnode); @@ -3651,7 +3651,7 @@ static void block_init(void *data) for (i = 0; i < THREAD_MAX; i++) { th_manager[i].num_dev = 0; th_manager[i].op_len = 0; - th_manager[i].start_th = true; + th_manager[i].start_th = false; th_manager[i].thread_id = i; pthread_mutex_init(&(th_manager[i].mutex), NULL); pthread_cond_init(&(th_manager[i].cond), NULL); @@ -3719,7 +3719,7 @@ static void block_exit(void *data) remove_whole_block_device(); for (i = 0; i < THREAD_MAX; i++) { - if (!th_manager[i].start_th) + if (th_manager[i].start_th) pthread_cancel(th_manager[i].th); DD_LIST_FOREACH_SAFE(th_manager[i].th_node_list, elem, elem_next, temp) { DD_LIST_REMOVE(th_manager[i].th_node_list, temp);