Lines Matching refs:bs

473 static int blkdebug_open(BlockDriverState *bs, QDict *options, int flags,  in blkdebug_open()  argument
476 BDRVBlkdebugState *s = bs->opaque; in blkdebug_open()
506 bs, errp); in blkdebug_open()
513 bs->supported_write_flags = BDRV_REQ_WRITE_UNCHANGED | in blkdebug_open()
514 (BDRV_REQ_FUA & bs->file->bs->supported_write_flags); in blkdebug_open()
515 bs->supported_zero_flags = BDRV_REQ_WRITE_UNCHANGED | in blkdebug_open()
517 bs->file->bs->supported_zero_flags); in blkdebug_open()
527 align = MAX(s->align, bs->file->bs->bl.request_alignment); in blkdebug_open()
576 bdrv_debug_event(bs, BLKDBG_NONE); in blkdebug_open()
590 static int coroutine_fn rule_check(BlockDriverState *bs, uint64_t offset, in rule_check() argument
593 BDRVBlkdebugState *s = bs->opaque; in rule_check()
634 blkdebug_co_preadv(BlockDriverState *bs, int64_t offset, int64_t bytes, in blkdebug_co_preadv() argument
640 assert(QEMU_IS_ALIGNED(offset, bs->bl.request_alignment)); in blkdebug_co_preadv()
641 assert(QEMU_IS_ALIGNED(bytes, bs->bl.request_alignment)); in blkdebug_co_preadv()
642 if (bs->bl.max_transfer) { in blkdebug_co_preadv()
643 assert(bytes <= bs->bl.max_transfer); in blkdebug_co_preadv()
646 err = rule_check(bs, offset, bytes, BLKDEBUG_IO_TYPE_READ); in blkdebug_co_preadv()
651 return bdrv_co_preadv(bs->file, offset, bytes, qiov, flags); in blkdebug_co_preadv()
655 blkdebug_co_pwritev(BlockDriverState *bs, int64_t offset, int64_t bytes, in blkdebug_co_pwritev() argument
661 assert(QEMU_IS_ALIGNED(offset, bs->bl.request_alignment)); in blkdebug_co_pwritev()
662 assert(QEMU_IS_ALIGNED(bytes, bs->bl.request_alignment)); in blkdebug_co_pwritev()
663 if (bs->bl.max_transfer) { in blkdebug_co_pwritev()
664 assert(bytes <= bs->bl.max_transfer); in blkdebug_co_pwritev()
667 err = rule_check(bs, offset, bytes, BLKDEBUG_IO_TYPE_WRITE); in blkdebug_co_pwritev()
672 return bdrv_co_pwritev(bs->file, offset, bytes, qiov, flags); in blkdebug_co_pwritev()
675 static int GRAPH_RDLOCK coroutine_fn blkdebug_co_flush(BlockDriverState *bs) in blkdebug_co_flush() argument
677 int err = rule_check(bs, 0, 0, BLKDEBUG_IO_TYPE_FLUSH); in blkdebug_co_flush()
683 return bdrv_co_flush(bs->file->bs); in blkdebug_co_flush()
687 blkdebug_co_pwrite_zeroes(BlockDriverState *bs, int64_t offset, int64_t bytes, in blkdebug_co_pwrite_zeroes() argument
690 uint32_t align = MAX(bs->bl.request_alignment, in blkdebug_co_pwrite_zeroes()
691 bs->bl.pwrite_zeroes_alignment); in blkdebug_co_pwrite_zeroes()
707 if (bs->bl.max_pwrite_zeroes) { in blkdebug_co_pwrite_zeroes()
708 assert(bytes <= bs->bl.max_pwrite_zeroes); in blkdebug_co_pwrite_zeroes()
711 err = rule_check(bs, offset, bytes, BLKDEBUG_IO_TYPE_WRITE_ZEROES); in blkdebug_co_pwrite_zeroes()
716 return bdrv_co_pwrite_zeroes(bs->file, offset, bytes, flags); in blkdebug_co_pwrite_zeroes()
720 blkdebug_co_pdiscard(BlockDriverState *bs, int64_t offset, int64_t bytes) in blkdebug_co_pdiscard() argument
722 uint32_t align = bs->bl.pdiscard_alignment; in blkdebug_co_pdiscard()
728 if (bytes < bs->bl.request_alignment) { in blkdebug_co_pdiscard()
735 assert(QEMU_IS_ALIGNED(offset, bs->bl.request_alignment)); in blkdebug_co_pdiscard()
736 assert(QEMU_IS_ALIGNED(bytes, bs->bl.request_alignment)); in blkdebug_co_pdiscard()
741 if (bs->bl.max_pdiscard) { in blkdebug_co_pdiscard()
742 assert(bytes <= bs->bl.max_pdiscard); in blkdebug_co_pdiscard()
745 err = rule_check(bs, offset, bytes, BLKDEBUG_IO_TYPE_DISCARD); in blkdebug_co_pdiscard()
750 return bdrv_co_pdiscard(bs->file, offset, bytes); in blkdebug_co_pdiscard()
754 blkdebug_co_block_status(BlockDriverState *bs, bool want_zero, int64_t offset, in blkdebug_co_block_status() argument
760 assert(QEMU_IS_ALIGNED(offset | bytes, bs->bl.request_alignment)); in blkdebug_co_block_status()
762 err = rule_check(bs, offset, bytes, BLKDEBUG_IO_TYPE_BLOCK_STATUS); in blkdebug_co_block_status()
767 assert(bs->file && bs->file->bs); in blkdebug_co_block_status()
770 *file = bs->file->bs; in blkdebug_co_block_status()
774 static void blkdebug_close(BlockDriverState *bs) in blkdebug_close() argument
776 BDRVBlkdebugState *s = bs->opaque; in blkdebug_close()
791 static void suspend_request(BlockDriverState *bs, BlkdebugRule *rule) in suspend_request() argument
793 BDRVBlkdebugState *s = bs->opaque; in suspend_request()
810 static void process_rule(BlockDriverState *bs, struct BlkdebugRule *rule, in process_rule() argument
813 BDRVBlkdebugState *s = bs->opaque; in process_rule()
835 suspend_request(bs, rule); in process_rule()
841 blkdebug_co_debug_event(BlockDriverState *bs, BlkdebugEvent event) in blkdebug_co_debug_event() argument
843 BDRVBlkdebugState *s = bs->opaque; in blkdebug_co_debug_event()
853 process_rule(bs, rule, actions_count, &new_state); in blkdebug_co_debug_event()
864 static int blkdebug_debug_breakpoint(BlockDriverState *bs, const char *event, in blkdebug_debug_breakpoint() argument
867 BDRVBlkdebugState *s = bs->opaque; in blkdebug_debug_breakpoint()
927 static int blkdebug_debug_resume(BlockDriverState *bs, const char *tag) in blkdebug_debug_resume() argument
929 BDRVBlkdebugState *s = bs->opaque; in blkdebug_debug_resume()
934 static int blkdebug_debug_remove_breakpoint(BlockDriverState *bs, in blkdebug_debug_remove_breakpoint() argument
937 BDRVBlkdebugState *s = bs->opaque; in blkdebug_debug_remove_breakpoint()
957 static bool blkdebug_debug_is_suspended(BlockDriverState *bs, const char *tag) in blkdebug_debug_is_suspended() argument
959 BDRVBlkdebugState *s = bs->opaque; in blkdebug_debug_is_suspended()
972 blkdebug_co_getlength(BlockDriverState *bs) in blkdebug_co_getlength() argument
974 return bdrv_co_getlength(bs->file->bs); in blkdebug_co_getlength()
977 static void GRAPH_RDLOCK blkdebug_refresh_filename(BlockDriverState *bs) in blkdebug_refresh_filename() argument
979 BDRVBlkdebugState *s = bs->opaque; in blkdebug_refresh_filename()
983 if (!bs->file->bs->exact_filename[0]) { in blkdebug_refresh_filename()
987 for (e = qdict_first(bs->full_open_options); e; in blkdebug_refresh_filename()
988 e = qdict_next(bs->full_open_options, e)) in blkdebug_refresh_filename()
1001 ret = snprintf(bs->exact_filename, sizeof(bs->exact_filename), in blkdebug_refresh_filename()
1003 s->config_file ?: "", bs->file->bs->exact_filename); in blkdebug_refresh_filename()
1004 if (ret >= sizeof(bs->exact_filename)) { in blkdebug_refresh_filename()
1006 bs->exact_filename[0] = 0; in blkdebug_refresh_filename()
1010 static void blkdebug_refresh_limits(BlockDriverState *bs, Error **errp) in blkdebug_refresh_limits() argument
1012 BDRVBlkdebugState *s = bs->opaque; in blkdebug_refresh_limits()
1015 bs->bl.request_alignment = s->align; in blkdebug_refresh_limits()
1018 bs->bl.max_transfer = s->max_transfer; in blkdebug_refresh_limits()
1021 bs->bl.pwrite_zeroes_alignment = s->opt_write_zero; in blkdebug_refresh_limits()
1024 bs->bl.max_pwrite_zeroes = s->max_write_zero; in blkdebug_refresh_limits()
1027 bs->bl.pdiscard_alignment = s->opt_discard; in blkdebug_refresh_limits()
1030 bs->bl.max_pdiscard = s->max_discard; in blkdebug_refresh_limits()
1040 static void blkdebug_child_perm(BlockDriverState *bs, BdrvChild *c, in blkdebug_child_perm() argument
1046 BDRVBlkdebugState *s = bs->opaque; in blkdebug_child_perm()
1048 bdrv_default_perms(bs, c, role, reopen_queue, in blkdebug_child_perm()