Lines Matching +full:on +full:- +full:demand

7  * later.  See the COPYING file in the top-level directory.
11 #include "block/block_int-common.h"
13 #include "system/block-backend.h"
17 #include "qapi/qapi-types-block.h"
20 * Read the non-zeroes parts of @blk into @buf
23 * the non-zeroes block into @buf.
25 * Return 0 on success, non-zero on error.
34 bytes = MIN(size - offset, BDRV_REQUEST_MAX_BYTES); in blk_pread_nonzeroes()
56 * On success, return true.
57 * On failure, store an error through @errp and return false.
59 * This function not intended for actual block devices, which read on
60 * demand. It's for things like memory devices that (ab)use a block
76 error_setg_errno(errp, -blk_len, in blk_check_size_and_read_all()
93 * block device and read only on demand. in blk_check_size_and_read_all()
99 error_setg_errno(errp, -ret, "can't read %s block backend" in blk_check_size_and_read_all()
110 BlockBackend *blk = conf->blk; in blkconf_blocksizes()
116 switch (conf->backend_defaults) { in blkconf_blocksizes()
138 if (!conf->physical_block_size) { in blkconf_blocksizes()
140 conf->physical_block_size = blocksizes.phys; in blkconf_blocksizes()
142 conf->physical_block_size = BDRV_SECTOR_SIZE; in blkconf_blocksizes()
145 if (!conf->logical_block_size) { in blkconf_blocksizes()
147 conf->logical_block_size = blocksizes.log; in blkconf_blocksizes()
149 conf->logical_block_size = BDRV_SECTOR_SIZE; in blkconf_blocksizes()
153 if (!conf->opt_io_size) { in blkconf_blocksizes()
154 conf->opt_io_size = bs->bl.opt_transfer; in blkconf_blocksizes()
156 if (conf->discard_granularity == -1) { in blkconf_blocksizes()
157 if (bs->bl.pdiscard_alignment) { in blkconf_blocksizes()
158 conf->discard_granularity = bs->bl.pdiscard_alignment; in blkconf_blocksizes()
159 } else if (bs->bl.request_alignment != 1) { in blkconf_blocksizes()
160 conf->discard_granularity = bs->bl.request_alignment; in blkconf_blocksizes()
165 if (conf->logical_block_size > conf->physical_block_size) { in blkconf_blocksizes()
171 if (!QEMU_IS_ALIGNED(conf->min_io_size, conf->logical_block_size)) { in blkconf_blocksizes()
178 * all devices which support min_io_size (scsi and virtio-blk) expose it to in blkconf_blocksizes()
181 if (conf->min_io_size / conf->logical_block_size > UINT16_MAX) { in blkconf_blocksizes()
187 if (!QEMU_IS_ALIGNED(conf->opt_io_size, conf->logical_block_size)) { in blkconf_blocksizes()
193 if (conf->discard_granularity != -1 && in blkconf_blocksizes()
194 !QEMU_IS_ALIGNED(conf->discard_granularity, in blkconf_blocksizes()
195 conf->logical_block_size)) { in blkconf_blocksizes()
207 BlockBackend *blk = conf->blk; in blkconf_apply_backend_options()
222 if (conf->share_rw) { in blkconf_apply_backend_options()
231 switch (conf->wce) { in blkconf_apply_backend_options()
239 rerror = conf->rerror; in blkconf_apply_backend_options()
244 werror = conf->werror; in blkconf_apply_backend_options()
252 block_acct_setup(blk_get_stats(blk), conf->account_invalid, in blkconf_apply_backend_options()
253 conf->account_failed); in blkconf_apply_backend_options()
261 if (!conf->cyls && !conf->heads && !conf->secs) { in blkconf_geometry()
262 hd_geometry_guess(conf->blk, in blkconf_geometry()
263 &conf->cyls, &conf->heads, &conf->secs, in blkconf_geometry()
266 *ptrans = hd_bios_chs_auto_trans(conf->cyls, conf->heads, conf->secs); in blkconf_geometry()
268 if (conf->cyls || conf->heads || conf->secs) { in blkconf_geometry()
269 if (conf->cyls < 1 || conf->cyls > cyls_max) { in blkconf_geometry()
273 if (conf->heads < 1 || conf->heads > heads_max) { in blkconf_geometry()
277 if (conf->secs < 1 || conf->secs > secs_max) { in blkconf_geometry()