Lines Matching refs:bs

108 static BlockBackend *bdrv_first_blk(BlockDriverState *bs);
288 trace_blk_root_attach(child, blk, child->bs); in blk_root_attach()
291 bdrv_add_aio_context_notifier(child->bs, in blk_root_attach()
303 trace_blk_root_detach(child, blk, child->bs); in blk_root_detach()
306 bdrv_remove_aio_context_notifier(child->bs, in blk_root_detach()
394 BlockBackend *blk_new_with_bs(BlockDriverState *bs, uint64_t perm, in blk_new_with_bs() argument
397 BlockBackend *blk = blk_new(bdrv_get_aio_context(bs), perm, shared_perm); in blk_new_with_bs()
401 if (blk_insert_bs(blk, bs, errp) < 0) { in blk_new_with_bs()
427 BlockDriverState *bs; in blk_new_open() local
457 bs = bdrv_open(filename, reference, options, flags, errp); in blk_new_open()
458 if (!bs) { in blk_new_open()
463 blk = blk_new(bdrv_get_aio_context(bs), perm, shared); in blk_new_open()
467 blk_insert_bs(blk, bs, errp); in blk_new_open()
468 bdrv_unref(bs); in blk_new_open()
597 BlockDriverState *bs, *old_bs; in bdrv_next() local
602 old_bs = it->bs; in bdrv_next()
612 bs = it->blk ? blk_bs(it->blk) : NULL; in bdrv_next()
613 } while (it->blk && (bs == NULL || bdrv_first_blk(bs) != it->blk)); in bdrv_next()
620 if (bs) { in bdrv_next()
621 bdrv_ref(bs); in bdrv_next()
623 it->bs = bs; in bdrv_next()
624 return bs; in bdrv_next()
633 it->bs = bdrv_next_monitor_owned(it->bs); in bdrv_next()
634 bs = it->bs; in bdrv_next()
635 } while (bs && bdrv_has_blk(bs)); in bdrv_next()
637 if (bs) { in bdrv_next()
638 bdrv_ref(bs); in bdrv_next()
642 return bs; in bdrv_next()
666 bdrv_unref(it->bs); in bdrv_next_cleanup()
762 return blk->root ? blk->root->bs : NULL; in blk_bs()
765 static BlockBackend * GRAPH_RDLOCK bdrv_first_blk(BlockDriverState *bs) in bdrv_first_blk() argument
772 QLIST_FOREACH(child, &bs->parents, next_parent) { in bdrv_first_blk()
784 bool bdrv_has_blk(BlockDriverState *bs) in bdrv_has_blk() argument
787 return bdrv_first_blk(bs) != NULL; in bdrv_has_blk()
793 bool bdrv_is_root_node(BlockDriverState *bs) in bdrv_is_root_node() argument
800 QLIST_FOREACH(c, &bs->parents, next_parent) { in bdrv_is_root_node()
877 BlockDriverState *bs = blk_bs(blk); in blk_remove_bs() local
883 bdrv_ref(bs); in blk_remove_bs()
884 bdrv_drained_begin(bs); in blk_remove_bs()
887 bdrv_drained_end(bs); in blk_remove_bs()
888 bdrv_unref(bs); in blk_remove_bs()
909 int blk_insert_bs(BlockBackend *blk, BlockDriverState *bs, Error **errp) in blk_insert_bs() argument
914 bdrv_ref(bs); in blk_insert_bs()
916 blk->root = bdrv_root_attach_child(bs, "root", &child_root, in blk_insert_bs()
928 throttle_group_attach_aio_context(tgm, bdrv_get_aio_context(bs)); in blk_insert_bs()
1324 BlockDriverState *bs; in blk_co_do_preadv_part() local
1331 bs = blk_bs(blk); in blk_co_do_preadv_part()
1332 trace_blk_co_preadv(blk, bs, offset, bytes, flags); in blk_co_do_preadv_part()
1339 bdrv_inc_in_flight(bs); in blk_co_do_preadv_part()
1349 bdrv_dec_in_flight(bs); in blk_co_do_preadv_part()
1399 BlockDriverState *bs; in blk_co_do_pwritev_part() local
1406 bs = blk_bs(blk); in blk_co_do_pwritev_part()
1407 trace_blk_co_pwritev(blk, bs, offset, bytes, flags); in blk_co_do_pwritev_part()
1414 bdrv_inc_in_flight(bs); in blk_co_do_pwritev_part()
1427 bdrv_dec_in_flight(bs); in blk_co_do_pwritev_part()
1648 BlockDriverState *bs = blk_bs(blk); in blk_co_nb_sectors() local
1653 if (!bs) { in blk_co_nb_sectors()
1656 return bdrv_co_nb_sectors(bs); in blk_co_nb_sectors()
1666 BlockDriverState *bs = blk_bs(blk); in blk_nb_sectors() local
1670 if (!bs) { in blk_nb_sectors()
1673 return bdrv_nb_sectors(bs); in blk_nb_sectors()
2064 BlockDriverState *bs = blk_bs(blk); in blk_drain() local
2067 if (bs) { in blk_drain()
2068 bdrv_ref(bs); in blk_drain()
2069 bdrv_drained_begin(bs); in blk_drain()
2076 if (bs) { in blk_drain()
2077 bdrv_drained_end(bs); in blk_drain()
2078 bdrv_unref(bs); in blk_drain()
2139 BlockDriverState *bs = blk_bs(blk); in send_qmp_error_event() local
2143 bs ? bdrv_get_node_name(bs) : NULL, optype, in send_qmp_error_event()
2187 BlockDriverState *bs = blk_bs(blk); in blk_supports_write_perm() local
2190 if (bs) { in blk_supports_write_perm()
2191 return !bdrv_is_read_only(bs); in blk_supports_write_perm()
2209 BlockDriverState *bs = blk_bs(blk); in blk_is_sg() local
2212 if (!bs) { in blk_is_sg()
2216 return bdrv_is_sg(bs); in blk_is_sg()
2233 BlockDriverState *bs = blk_bs(blk); in blk_activate() local
2236 if (!bs) { in blk_activate()
2246 bdrv_co_activate(bs, errp); in blk_activate()
2249 bdrv_activate(bs, errp); in blk_activate()
2255 BlockDriverState *bs = blk_bs(blk); in blk_co_is_inserted() local
2259 return bs && bdrv_co_is_inserted(bs); in blk_co_is_inserted()
2270 BlockDriverState *bs = blk_bs(blk); in blk_co_lock_medium() local
2274 if (bs) { in blk_co_lock_medium()
2275 bdrv_co_lock_medium(bs, locked); in blk_co_lock_medium()
2281 BlockDriverState *bs = blk_bs(blk); in blk_co_eject() local
2286 if (bs) { in blk_co_eject()
2287 bdrv_co_eject(bs, eject_flag); in blk_co_eject()
2300 BlockDriverState *bs = blk_bs(blk); in blk_get_flags() local
2303 if (bs) { in blk_get_flags()
2304 return bdrv_get_flags(bs); in blk_get_flags()
2313 BlockDriverState *bs = blk_bs(blk); in blk_get_request_alignment() local
2315 return bs ? bs->bl.request_alignment : BDRV_SECTOR_SIZE; in blk_get_request_alignment()
2321 BlockDriverState *bs = blk_bs(blk); in blk_get_max_hw_transfer() local
2325 if (bs) { in blk_get_max_hw_transfer()
2326 max = MIN_NON_ZERO(max, bs->bl.max_hw_transfer); in blk_get_max_hw_transfer()
2327 max = MIN_NON_ZERO(max, bs->bl.max_transfer); in blk_get_max_hw_transfer()
2335 BlockDriverState *bs = blk_bs(blk); in blk_get_max_transfer() local
2339 if (bs) { in blk_get_max_transfer()
2340 max = MIN_NON_ZERO(max, bs->bl.max_transfer); in blk_get_max_transfer()
2348 return MIN_NON_ZERO(blk->root->bs->bl.max_hw_iov, in blk_get_max_hw_iov()
2349 blk->root->bs->bl.max_iov); in blk_get_max_hw_iov()
2355 return blk->root->bs->bl.max_iov; in blk_get_max_iov()
2372 BlockDriverState *bs = blk_bs(blk); in blk_op_is_blocked() local
2376 if (!bs) { in blk_op_is_blocked()
2380 return bdrv_op_is_blocked(bs, op, errp); in blk_op_is_blocked()
2385 BlockDriverState *bs = blk_bs(blk); in blk_op_unblock() local
2388 if (bs) { in blk_op_unblock()
2389 bdrv_op_unblock(bs, op, reason); in blk_op_unblock()
2395 BlockDriverState *bs = blk_bs(blk); in blk_op_block_all() local
2398 if (bs) { in blk_op_block_all()
2399 bdrv_op_block_all(bs, reason); in blk_op_block_all()
2405 BlockDriverState *bs = blk_bs(blk); in blk_op_unblock_all() local
2408 if (bs) { in blk_op_unblock_all()
2409 bdrv_op_unblock_all(bs, reason); in blk_op_unblock_all()
2435 BlockDriverState *bs = blk_bs(blk); in blk_set_aio_context() local
2440 if (!bs) { in blk_set_aio_context()
2445 bdrv_ref(bs); in blk_set_aio_context()
2450 ret = bdrv_try_change_aio_context(bs, new_context, NULL, errp); in blk_set_aio_context()
2454 bdrv_unref(bs); in blk_set_aio_context()
2517 BlockDriverState *bs = blk_bs(blk); in blk_add_aio_context_notifier() local
2526 if (bs) { in blk_add_aio_context_notifier()
2527 bdrv_add_aio_context_notifier(bs, attached_aio_context, in blk_add_aio_context_notifier()
2539 BlockDriverState *bs = blk_bs(blk); in blk_remove_aio_context_notifier() local
2543 if (bs) { in blk_remove_aio_context_notifier()
2544 bdrv_remove_aio_context_notifier(bs, attached_aio_context, in blk_remove_aio_context_notifier()
2680 blk->root_state.open_flags = blk->root->bs->open_flags; in blk_update_root_state()
2681 blk->root_state.detect_zeroes = blk->root->bs->detect_zeroes; in blk_update_root_state()
2741 BlockDriverState *bs = blk_bs(blk); in blk_io_limits_disable() local
2745 if (bs) { in blk_io_limits_disable()
2746 bdrv_ref(bs); in blk_io_limits_disable()
2747 bdrv_drained_begin(bs); in blk_io_limits_disable()
2750 if (bs) { in blk_io_limits_disable()
2751 bdrv_drained_end(bs); in blk_io_limits_disable()
2752 bdrv_unref(bs); in blk_io_limits_disable()
2838 BlockDriverState *bs = blk_bs(blk); in blk_register_buf() local
2842 if (bs) { in blk_register_buf()
2843 return bdrv_register_buf(bs, host, size, errp); in blk_register_buf()
2850 BlockDriverState *bs = blk_bs(blk); in blk_unregister_buf() local
2854 if (bs) { in blk_unregister_buf()
2855 bdrv_unregister_buf(bs, host, size); in blk_unregister_buf()