Lines Matching refs:conf
103 bool blkconf_blocksizes(BlockConf *conf, Error **errp) in blkconf_blocksizes() argument
105 BlockBackend *blk = conf->blk; in blkconf_blocksizes()
111 switch (conf->backend_defaults) { in blkconf_blocksizes()
133 if (!conf->physical_block_size) { in blkconf_blocksizes()
135 conf->physical_block_size = blocksizes.phys; in blkconf_blocksizes()
137 conf->physical_block_size = BDRV_SECTOR_SIZE; in blkconf_blocksizes()
140 if (!conf->logical_block_size) { in blkconf_blocksizes()
142 conf->logical_block_size = blocksizes.log; in blkconf_blocksizes()
144 conf->logical_block_size = BDRV_SECTOR_SIZE; in blkconf_blocksizes()
148 if (!conf->opt_io_size) { in blkconf_blocksizes()
149 conf->opt_io_size = bs->bl.opt_transfer; in blkconf_blocksizes()
151 if (conf->discard_granularity == -1) { in blkconf_blocksizes()
153 conf->discard_granularity = bs->bl.pdiscard_alignment; in blkconf_blocksizes()
155 conf->discard_granularity = bs->bl.request_alignment; in blkconf_blocksizes()
160 if (conf->logical_block_size > conf->physical_block_size) { in blkconf_blocksizes()
166 if (!QEMU_IS_ALIGNED(conf->min_io_size, conf->logical_block_size)) { in blkconf_blocksizes()
176 if (conf->min_io_size / conf->logical_block_size > UINT16_MAX) { in blkconf_blocksizes()
182 if (!QEMU_IS_ALIGNED(conf->opt_io_size, conf->logical_block_size)) { in blkconf_blocksizes()
188 if (conf->discard_granularity != -1 && in blkconf_blocksizes()
189 !QEMU_IS_ALIGNED(conf->discard_granularity, in blkconf_blocksizes()
190 conf->logical_block_size)) { in blkconf_blocksizes()
199 bool blkconf_apply_backend_options(BlockConf *conf, bool readonly, in blkconf_apply_backend_options() argument
202 BlockBackend *blk = conf->blk; in blkconf_apply_backend_options()
217 if (conf->share_rw) { in blkconf_apply_backend_options()
226 switch (conf->wce) { in blkconf_apply_backend_options()
234 rerror = conf->rerror; in blkconf_apply_backend_options()
239 werror = conf->werror; in blkconf_apply_backend_options()
247 block_acct_setup(blk_get_stats(blk), conf->account_invalid, in blkconf_apply_backend_options()
248 conf->account_failed); in blkconf_apply_backend_options()
252 bool blkconf_geometry(BlockConf *conf, int *ptrans, in blkconf_geometry() argument
256 if (!conf->cyls && !conf->heads && !conf->secs) { in blkconf_geometry()
257 hd_geometry_guess(conf->blk, in blkconf_geometry()
258 &conf->cyls, &conf->heads, &conf->secs, in blkconf_geometry()
261 *ptrans = hd_bios_chs_auto_trans(conf->cyls, conf->heads, conf->secs); in blkconf_geometry()
263 if (conf->cyls || conf->heads || conf->secs) { in blkconf_geometry()
264 if (conf->cyls < 1 || conf->cyls > cyls_max) { in blkconf_geometry()
268 if (conf->heads < 1 || conf->heads > heads_max) { in blkconf_geometry()
272 if (conf->secs < 1 || conf->secs > secs_max) { in blkconf_geometry()