block.c (3da71a2111de9f0bc475f8292d009265ab34365f) | block.c (fb2575f95411644abe7f0606594035b63a5132ad) |
---|---|
1/* 2 * QEMU System Emulator block driver 3 * 4 * Copyright (c) 2003 Fabrice Bellard 5 * Copyright (c) 2020 Virtuozzo International GmbH. 6 * 7 * Permission is hereby granted, free of charge, to any person obtaining a copy 8 * of this software and associated documentation files (the "Software"), to deal --- 3058 unchanged lines hidden (view full) --- 3067 */ 3068 parent_ctx = bdrv_child_get_parent_aio_context(new_child); 3069 if (child_ctx != parent_ctx) { 3070 Error *local_err = NULL; 3071 int ret = bdrv_try_change_aio_context(child_bs, parent_ctx, NULL, 3072 &local_err); 3073 3074 if (ret < 0 && child_class->change_aio_ctx) { | 1/* 2 * QEMU System Emulator block driver 3 * 4 * Copyright (c) 2003 Fabrice Bellard 5 * Copyright (c) 2020 Virtuozzo International GmbH. 6 * 7 * Permission is hereby granted, free of charge, to any person obtaining a copy 8 * of this software and associated documentation files (the "Software"), to deal --- 3058 unchanged lines hidden (view full) --- 3067 */ 3068 parent_ctx = bdrv_child_get_parent_aio_context(new_child); 3069 if (child_ctx != parent_ctx) { 3070 Error *local_err = NULL; 3071 int ret = bdrv_try_change_aio_context(child_bs, parent_ctx, NULL, 3072 &local_err); 3073 3074 if (ret < 0 && child_class->change_aio_ctx) { |
3075 Transaction *tran = tran_new(); | 3075 Transaction *aio_ctx_tran = tran_new(); |
3076 GHashTable *visited = g_hash_table_new(NULL, NULL); 3077 bool ret_child; 3078 3079 g_hash_table_add(visited, new_child); 3080 ret_child = child_class->change_aio_ctx(new_child, child_ctx, | 3076 GHashTable *visited = g_hash_table_new(NULL, NULL); 3077 bool ret_child; 3078 3079 g_hash_table_add(visited, new_child); 3080 ret_child = child_class->change_aio_ctx(new_child, child_ctx, |
3081 visited, tran, NULL); | 3081 visited, aio_ctx_tran, 3082 NULL); |
3082 if (ret_child == true) { 3083 error_free(local_err); 3084 ret = 0; 3085 } | 3083 if (ret_child == true) { 3084 error_free(local_err); 3085 ret = 0; 3086 } |
3086 tran_finalize(tran, ret_child == true ? 0 : -1); | 3087 tran_finalize(aio_ctx_tran, ret_child == true ? 0 : -1); |
3087 g_hash_table_destroy(visited); 3088 } 3089 3090 if (ret < 0) { 3091 error_propagate(errp, local_err); 3092 bdrv_child_free(new_child); 3093 return NULL; 3094 } --- 3108 unchanged lines hidden (view full) --- 6203 int i; 6204 const char **formats = NULL; 6205 6206 GLOBAL_STATE_CODE(); 6207 6208 QLIST_FOREACH(drv, &bdrv_drivers, list) { 6209 if (drv->format_name) { 6210 bool found = false; | 3088 g_hash_table_destroy(visited); 3089 } 3090 3091 if (ret < 0) { 3092 error_propagate(errp, local_err); 3093 bdrv_child_free(new_child); 3094 return NULL; 3095 } --- 3108 unchanged lines hidden (view full) --- 6204 int i; 6205 const char **formats = NULL; 6206 6207 GLOBAL_STATE_CODE(); 6208 6209 QLIST_FOREACH(drv, &bdrv_drivers, list) { 6210 if (drv->format_name) { 6211 bool found = false; |
6211 int i = count; | |
6212 6213 if (use_bdrv_whitelist && !bdrv_is_whitelisted(drv, read_only)) { 6214 continue; 6215 } 6216 | 6212 6213 if (use_bdrv_whitelist && !bdrv_is_whitelisted(drv, read_only)) { 6214 continue; 6215 } 6216 |
6217 i = count; |
|
6217 while (formats && i && !found) { 6218 found = !strcmp(formats[--i], drv->format_name); 6219 } 6220 6221 if (!found) { 6222 formats = g_renew(const char *, formats, count + 1); 6223 formats[count++] = drv->format_name; 6224 } --- 2342 unchanged lines hidden --- | 6218 while (formats && i && !found) { 6219 found = !strcmp(formats[--i], drv->format_name); 6220 } 6221 6222 if (!found) { 6223 formats = g_renew(const char *, formats, count + 1); 6224 formats[count++] = drv->format_name; 6225 } --- 2342 unchanged lines hidden --- |