@ -234,32 +234,32 @@ void drive_get_ref(DriveInfo *dinfo)
typedef struct {
QEMUBH * bh ;
DriveInfo * dinfo ;
} Drive PutRefBH;
BlockDriverState * bs ;
} BDRV PutRefBH;
static void dri ve _put_ref_bh ( void * opaque )
static void b drv_put_ref_bh( void * opaque )
{
Drive PutRefBH * s = opaque ;
BDRV PutRefBH * s = opaque ;
drive_put_ ref( s - > dinfo ) ;
bdrv_un ref( s - > bs ) ;
qemu_bh_delete ( s - > bh ) ;
g_free ( s ) ;
}
/*
* Release a drive reference in a BH
* Release a BDS reference in a BH
*
* It is not possible to use drive_put_ ref( ) from a callback function when the
* callers still need the driv e. In such cases we schedule a BH to release the
* reference .
* It is not safe to use bdrv_un ref( ) from a callback function when the callers
* still need the BlockDriverStat e. In such cases we schedule a BH to release
* the reference .
*/
static void dri ve _put_ref_bh_schedule ( DriveInfo * dinfo )
static void b drv_put_ref_bh_schedule( BlockDriverState * bs )
{
Drive PutRefBH * s ;
BDRV PutRefBH * s ;
s = g_new ( Drive PutRefBH, 1 ) ;
s - > bh = qemu_bh_new ( dri ve _put_ref_bh , s ) ;
s - > dinfo = dinfo ;
s = g_new ( BDRV PutRefBH, 1 ) ;
s - > bh = qemu_bh_new ( b drv_put_ref_bh, s ) ;
s - > bs = bs ;
qemu_bh_schedule ( s - > bh ) ;
}
@ -1436,7 +1436,7 @@ static void block_job_cb(void *opaque, int ret)
}
qobject_decref ( obj ) ;
dri ve _put_ref_bh_schedule ( drive_get_ by_blockdev ( bs ) ) ;
b drv_put_ref_bh_schedule( bs ) ;
}
void qmp_block_stream ( const char * device , bool has_base ,
@ -1473,11 +1473,6 @@ void qmp_block_stream(const char *device, bool has_base,
return ;
}
/* Grab a reference so hotplug does not delete the BlockDriverState from
* underneath us .
*/
drive_get_ref ( drive_get_by_blockdev ( bs ) ) ;
trace_qmp_block_stream ( bs , bs - > job ) ;
}
@ -1534,10 +1529,6 @@ void qmp_block_commit(const char *device,
error_propagate ( errp , local_err ) ;
return ;
}
/* Grab a reference so hotplug does not delete the BlockDriverState from
* underneath us .
*/
drive_get_ref ( drive_get_by_blockdev ( bs ) ) ;
}
void qmp_drive_backup ( const char * device , const char * target ,
@ -1650,11 +1641,6 @@ void qmp_drive_backup(const char *device, const char *target,
error_propagate ( errp , local_err ) ;
return ;
}
/* Grab a reference so hotplug does not delete the BlockDriverState from
* underneath us .
*/
drive_get_ref ( drive_get_by_blockdev ( bs ) ) ;
}
# define DEFAULT_MIRROR_BUF_SIZE (10 << 20)
@ -1791,11 +1777,6 @@ void qmp_drive_mirror(const char *device, const char *target,
error_propagate ( errp , local_err ) ;
return ;
}
/* Grab a reference so hotplug does not delete the BlockDriverState from
* underneath us .
*/
drive_get_ref ( drive_get_by_blockdev ( bs ) ) ;
}
static BlockJob * find_block_job ( const char * device )