block.c (d470ad42acfc73c45d3e8ed5311a491160b4c100) block.c (5e003f17ec518cd96f5d2ac23ce9e14144426235)
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

--- 4241 unchanged lines hidden (view full) ---

4250 for (bs = bdrv_first(&it); bs; bs = bdrv_next(&it)) {
4251 AioContext *aio_context = bdrv_get_aio_context(bs);
4252
4253 aio_context_acquire(aio_context);
4254 bdrv_invalidate_cache(bs, &local_err);
4255 aio_context_release(aio_context);
4256 if (local_err) {
4257 error_propagate(errp, local_err);
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

--- 4241 unchanged lines hidden (view full) ---

4250 for (bs = bdrv_first(&it); bs; bs = bdrv_next(&it)) {
4251 AioContext *aio_context = bdrv_get_aio_context(bs);
4252
4253 aio_context_acquire(aio_context);
4254 bdrv_invalidate_cache(bs, &local_err);
4255 aio_context_release(aio_context);
4256 if (local_err) {
4257 error_propagate(errp, local_err);
4258 bdrv_next_cleanup(&it);
4258 return;
4259 }
4260 }
4261}
4262
4263static int bdrv_inactivate_recurse(BlockDriverState *bs,
4264 bool setting_flag)
4265{

--- 59 unchanged lines hidden (view full) ---

4325 /* We do two passes of inactivation. The first pass calls to drivers'
4326 * .bdrv_inactivate callbacks recursively so all cache is flushed to disk;
4327 * the second pass sets the BDRV_O_INACTIVE flag so that no further write
4328 * is allowed. */
4329 for (pass = 0; pass < 2; pass++) {
4330 for (bs = bdrv_first(&it); bs; bs = bdrv_next(&it)) {
4331 ret = bdrv_inactivate_recurse(bs, pass);
4332 if (ret < 0) {
4259 return;
4260 }
4261 }
4262}
4263
4264static int bdrv_inactivate_recurse(BlockDriverState *bs,
4265 bool setting_flag)
4266{

--- 59 unchanged lines hidden (view full) ---

4326 /* We do two passes of inactivation. The first pass calls to drivers'
4327 * .bdrv_inactivate callbacks recursively so all cache is flushed to disk;
4328 * the second pass sets the BDRV_O_INACTIVE flag so that no further write
4329 * is allowed. */
4330 for (pass = 0; pass < 2; pass++) {
4331 for (bs = bdrv_first(&it); bs; bs = bdrv_next(&it)) {
4332 ret = bdrv_inactivate_recurse(bs, pass);
4333 if (ret < 0) {
4334 bdrv_next_cleanup(&it);
4333 goto out;
4334 }
4335 }
4336 }
4337
4338out:
4339 for (bs = bdrv_first(&it); bs; bs = bdrv_next(&it)) {
4340 aio_context_release(bdrv_get_aio_context(bs));

--- 518 unchanged lines hidden (view full) ---

4859 for (bs = bdrv_first(&it); bs; bs = bdrv_next(&it)) {
4860 bool perm;
4861
4862 /* try to recurse in this top level bs */
4863 perm = bdrv_recurse_is_first_non_filter(bs, candidate);
4864
4865 /* candidate is the first non filter */
4866 if (perm) {
4335 goto out;
4336 }
4337 }
4338 }
4339
4340out:
4341 for (bs = bdrv_first(&it); bs; bs = bdrv_next(&it)) {
4342 aio_context_release(bdrv_get_aio_context(bs));

--- 518 unchanged lines hidden (view full) ---

4861 for (bs = bdrv_first(&it); bs; bs = bdrv_next(&it)) {
4862 bool perm;
4863
4864 /* try to recurse in this top level bs */
4865 perm = bdrv_recurse_is_first_non_filter(bs, candidate);
4866
4867 /* candidate is the first non filter */
4868 if (perm) {
4869 bdrv_next_cleanup(&it);
4867 return true;
4868 }
4869 }
4870
4871 return false;
4872}
4873
4874BlockDriverState *check_to_replace_node(BlockDriverState *parent_bs,

--- 253 unchanged lines hidden ---
4870 return true;
4871 }
4872 }
4873
4874 return false;
4875}
4876
4877BlockDriverState *check_to_replace_node(BlockDriverState *parent_bs,

--- 253 unchanged lines hidden ---