block: Fix code to be more readable 82/172382/1
authorpr.jung <pr.jung@samsung.com>
Tue, 13 Mar 2018 11:26:19 +0000 (20:26 +0900)
committerpr.jung <pr.jung@samsung.com>
Tue, 13 Mar 2018 11:26:19 +0000 (20:26 +0900)
Change-Id: I413ad40cb7cd633f5ad2f2af3af4343e9e497e79
Signed-off-by: pr.jung <pr.jung@samsung.com>
src/block/block.c

index 10c3f56..9eec602 100644 (file)
@@ -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);