block.c (cb9ff6c25a25179736b7d8d9ddf00d45e5112a2b) block.c (cca43ae1e1a5e2faf42d2db778edc8e76e10dc47)
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

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

3049
3050 assert(!bs->job);
3051 assert(!bs->refcnt);
3052
3053 bdrv_drained_begin(bs); /* complete I/O */
3054 bdrv_flush(bs);
3055 bdrv_drain(bs); /* in case flush left pending I/O */
3056
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

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

3049
3050 assert(!bs->job);
3051 assert(!bs->refcnt);
3052
3053 bdrv_drained_begin(bs); /* complete I/O */
3054 bdrv_flush(bs);
3055 bdrv_drain(bs); /* in case flush left pending I/O */
3056
3057 bdrv_release_named_dirty_bitmaps(bs);
3058 assert(QLIST_EMPTY(&bs->dirty_bitmaps));
3059
3060 if (bs->drv) {
3061 BdrvChild *child, *next;
3062
3063 bs->drv->bdrv_close(bs);
3064 bs->drv = NULL;
3065
3066 bdrv_set_backing_hd(bs, NULL, &error_abort);
3067

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

3089 bs->sg = false;
3090 QDECREF(bs->options);
3091 QDECREF(bs->explicit_options);
3092 bs->options = NULL;
3093 QDECREF(bs->full_open_options);
3094 bs->full_open_options = NULL;
3095 }
3096
3057 if (bs->drv) {
3058 BdrvChild *child, *next;
3059
3060 bs->drv->bdrv_close(bs);
3061 bs->drv = NULL;
3062
3063 bdrv_set_backing_hd(bs, NULL, &error_abort);
3064

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

3086 bs->sg = false;
3087 QDECREF(bs->options);
3088 QDECREF(bs->explicit_options);
3089 bs->options = NULL;
3090 QDECREF(bs->full_open_options);
3091 bs->full_open_options = NULL;
3092 }
3093
3094 bdrv_release_named_dirty_bitmaps(bs);
3095 assert(QLIST_EMPTY(&bs->dirty_bitmaps));
3096
3097 QLIST_FOREACH_SAFE(ban, &bs->aio_notifiers, list, ban_next) {
3098 g_free(ban);
3099 }
3100 QLIST_INIT(&bs->aio_notifiers);
3101 bdrv_drained_end(bs);
3102}
3103
3104void bdrv_close_all(void)

--- 1778 unchanged lines hidden ---
3097 QLIST_FOREACH_SAFE(ban, &bs->aio_notifiers, list, ban_next) {
3098 g_free(ban);
3099 }
3100 QLIST_INIT(&bs->aio_notifiers);
3101 bdrv_drained_end(bs);
3102}
3103
3104void bdrv_close_all(void)

--- 1778 unchanged lines hidden ---