block.c (f3930ed0bb1945b59da8e591072b5c79606d0760) | block.c (6ee4ce1ee75a651c246d926c2302281b51981f6d) |
---|---|
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 --- 1945 unchanged lines hidden (view full) --- 1954 * bs_new must not be attached to a BlockBackend. 1955 * 1956 * This function does not create any image files. 1957 */ 1958void bdrv_swap(BlockDriverState *bs_new, BlockDriverState *bs_old) 1959{ 1960 BlockDriverState tmp; 1961 | 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 --- 1945 unchanged lines hidden (view full) --- 1954 * bs_new must not be attached to a BlockBackend. 1955 * 1956 * This function does not create any image files. 1957 */ 1958void bdrv_swap(BlockDriverState *bs_new, BlockDriverState *bs_old) 1959{ 1960 BlockDriverState tmp; 1961 |
1962 bdrv_drain(bs_new); 1963 bdrv_drain(bs_old); 1964 |
|
1962 /* The code needs to swap the node_name but simply swapping node_list won't 1963 * work so first remove the nodes from the graph list, do the swap then 1964 * insert them back if needed. 1965 */ 1966 if (bs_new->node_name[0] != '\0') { 1967 QTAILQ_REMOVE(&graph_bdrv_states, bs_new, node_list); 1968 } 1969 if (bs_old->node_name[0] != '\0') { --- 27 unchanged lines hidden (view full) --- 1997 /* insert the nodes back into the graph node list if needed */ 1998 if (bs_new->node_name[0] != '\0') { 1999 QTAILQ_INSERT_TAIL(&graph_bdrv_states, bs_new, node_list); 2000 } 2001 if (bs_old->node_name[0] != '\0') { 2002 QTAILQ_INSERT_TAIL(&graph_bdrv_states, bs_old, node_list); 2003 } 2004 | 1965 /* The code needs to swap the node_name but simply swapping node_list won't 1966 * work so first remove the nodes from the graph list, do the swap then 1967 * insert them back if needed. 1968 */ 1969 if (bs_new->node_name[0] != '\0') { 1970 QTAILQ_REMOVE(&graph_bdrv_states, bs_new, node_list); 1971 } 1972 if (bs_old->node_name[0] != '\0') { --- 27 unchanged lines hidden (view full) --- 2000 /* insert the nodes back into the graph node list if needed */ 2001 if (bs_new->node_name[0] != '\0') { 2002 QTAILQ_INSERT_TAIL(&graph_bdrv_states, bs_new, node_list); 2003 } 2004 if (bs_old->node_name[0] != '\0') { 2005 QTAILQ_INSERT_TAIL(&graph_bdrv_states, bs_old, node_list); 2006 } 2007 |
2008 assert(QLIST_EMPTY(&bs_old->tracked_requests)); 2009 assert(QLIST_EMPTY(&bs_new->tracked_requests)); 2010 |
|
2005 bdrv_rebind(bs_new); 2006 bdrv_rebind(bs_old); 2007} 2008 2009/* 2010 * Add new bs contents at the top of an image chain while the chain is 2011 * live, while keeping required fields on the top layer. 2012 * --- 2104 unchanged lines hidden --- | 2011 bdrv_rebind(bs_new); 2012 bdrv_rebind(bs_old); 2013} 2014 2015/* 2016 * Add new bs contents at the top of an image chain while the chain is 2017 * live, while keeping required fields on the top layer. 2018 * --- 2104 unchanged lines hidden --- |