block.c (23c88b24721ee907639705bf9de03dcd6b1e66ad) | block.c (04c01a5c8f006b6e45fa5be8ea857efe7d9c41f9) |
---|---|
1/* 2 * QEMU System Emulator block driver 3 * 4 * Copyright (c) 2003 Fabrice Bellard 5 * 6 * Permission is hereby granted, free of charge, to any person obtaining a copy 7 * of this software and associated documentation files (the "Software"), to deal 8 * in the Software without restriction, including without limitation the rights --- 1177 unchanged lines hidden (view full) --- 1186 } 1187 1188 if (!drv->bdrv_needs_filename) { 1189 qdict_del(*options, "filename"); 1190 } 1191 } 1192 1193 if (runstate_check(RUN_STATE_INMIGRATE)) { | 1/* 2 * QEMU System Emulator block driver 3 * 4 * Copyright (c) 2003 Fabrice Bellard 5 * 6 * Permission is hereby granted, free of charge, to any person obtaining a copy 7 * of this software and associated documentation files (the "Software"), to deal 8 * in the Software without restriction, including without limitation the rights --- 1177 unchanged lines hidden (view full) --- 1186 } 1187 1188 if (!drv->bdrv_needs_filename) { 1189 qdict_del(*options, "filename"); 1190 } 1191 } 1192 1193 if (runstate_check(RUN_STATE_INMIGRATE)) { |
1194 *flags |= BDRV_O_INCOMING; | 1194 *flags |= BDRV_O_INACTIVE; |
1195 } 1196 1197 return 0; 1198} 1199 1200static BdrvChild *bdrv_attach_child(BlockDriverState *parent_bs, 1201 BlockDriverState *child_bs, 1202 const char *child_name, --- 2053 unchanged lines hidden (view full) --- 3256{ 3257 Error *local_err = NULL; 3258 int ret; 3259 3260 if (!bs->drv) { 3261 return; 3262 } 3263 | 1195 } 1196 1197 return 0; 1198} 1199 1200static BdrvChild *bdrv_attach_child(BlockDriverState *parent_bs, 1201 BlockDriverState *child_bs, 1202 const char *child_name, --- 2053 unchanged lines hidden (view full) --- 3256{ 3257 Error *local_err = NULL; 3258 int ret; 3259 3260 if (!bs->drv) { 3261 return; 3262 } 3263 |
3264 if (!(bs->open_flags & BDRV_O_INCOMING)) { | 3264 if (!(bs->open_flags & BDRV_O_INACTIVE)) { |
3265 return; 3266 } | 3265 return; 3266 } |
3267 bs->open_flags &= ~BDRV_O_INCOMING; | 3267 bs->open_flags &= ~BDRV_O_INACTIVE; |
3268 3269 if (bs->drv->bdrv_invalidate_cache) { 3270 bs->drv->bdrv_invalidate_cache(bs, &local_err); 3271 } else if (bs->file) { 3272 bdrv_invalidate_cache(bs->file->bs, &local_err); 3273 } 3274 if (local_err) { | 3268 3269 if (bs->drv->bdrv_invalidate_cache) { 3270 bs->drv->bdrv_invalidate_cache(bs, &local_err); 3271 } else if (bs->file) { 3272 bdrv_invalidate_cache(bs->file->bs, &local_err); 3273 } 3274 if (local_err) { |
3275 bs->open_flags |= BDRV_O_INCOMING; | 3275 bs->open_flags |= BDRV_O_INACTIVE; |
3276 error_propagate(errp, local_err); 3277 return; 3278 } 3279 3280 ret = refresh_total_sectors(bs, bs->total_sectors); 3281 if (ret < 0) { | 3276 error_propagate(errp, local_err); 3277 return; 3278 } 3279 3280 ret = refresh_total_sectors(bs, bs->total_sectors); 3281 if (ret < 0) { |
3282 bs->open_flags |= BDRV_O_INCOMING; | 3282 bs->open_flags |= BDRV_O_INACTIVE; |
3283 error_setg_errno(errp, -ret, "Could not refresh total sector count"); 3284 return; 3285 } 3286} 3287 3288void bdrv_invalidate_cache_all(Error **errp) 3289{ 3290 BlockDriverState *bs; --- 1033 unchanged lines hidden --- | 3283 error_setg_errno(errp, -ret, "Could not refresh total sector count"); 3284 return; 3285 } 3286} 3287 3288void bdrv_invalidate_cache_all(Error **errp) 3289{ 3290 BlockDriverState *bs; --- 1033 unchanged lines hidden --- |