Lines Matching defs:bdev

8 #include "spdk/bdev.h"
25 struct spdk_bdev bdev;
59 struct null_bdev *bdev = ctx;
61 TAILQ_REMOVE(&g_null_bdev_head, bdev, tailq);
62 free(bdev->bdev.name);
63 free(bdev);
92 struct spdk_bdev *bdev = bdev_io->bdev;
98 if (SPDK_DIF_DISABLE != bdev->dif_type &&
102 dif_opts.dif_pi_format = bdev->dif_pi_format;
104 bdev->blocklen,
105 bdev->md_len,
106 bdev->md_interleave,
107 bdev->dif_is_head_of_md,
108 bdev->dif_type,
109 bdev_io->u.bdev.dif_check_flags,
110 bdev_io->u.bdev.offset_blocks & 0xFFFFFFFF,
121 if (bdev_io->u.bdev.iovs[0].iov_base == NULL) {
122 assert(bdev_io->u.bdev.iovcnt == 1);
123 if (spdk_likely(bdev_io->u.bdev.num_blocks * bdev_io->bdev->blocklen <=
125 bdev_io->u.bdev.iovs[0].iov_base = g_null_read_buf;
126 bdev_io->u.bdev.iovs[0].iov_len = bdev_io->u.bdev.num_blocks * bdev_io->bdev->blocklen;
129 bdev_io->u.bdev.num_blocks * bdev_io->bdev->blocklen,
135 if (SPDK_DIF_DISABLE != bdev->dif_type) {
136 rc = spdk_dif_generate(bdev_io->u.bdev.iovs, bdev_io->u.bdev.iovcnt,
137 bdev_io->u.bdev.num_blocks, &dif_ctx);
140 bdev_io->u.bdev.offset_blocks,
141 bdev_io->u.bdev.num_blocks);
149 if (SPDK_DIF_DISABLE != bdev->dif_type) {
150 rc = spdk_dif_verify(bdev_io->u.bdev.iovs, bdev_io->u.bdev.iovcnt,
151 bdev_io->u.bdev.num_blocks, &dif_ctx, &err_blk);
155 bdev_io->u.bdev.offset_blocks,
156 bdev_io->u.bdev.num_blocks,
210 bdev_null_write_config_json(struct spdk_bdev *bdev, struct spdk_json_write_ctx *w)
217 spdk_json_write_named_string(w, "name", bdev->name);
218 spdk_json_write_named_uint64(w, "num_blocks", bdev->blockcnt);
219 spdk_json_write_named_uint32(w, "block_size", bdev->blocklen);
220 spdk_json_write_named_uint32(w, "physical_block_size", bdev->phys_blocklen);
221 spdk_json_write_named_uint32(w, "md_size", bdev->md_len);
222 spdk_json_write_named_uint32(w, "dif_type", bdev->dif_type);
223 spdk_json_write_named_bool(w, "dif_is_head_of_md", bdev->dif_is_head_of_md);
224 spdk_json_write_named_uint32(w, "dif_pi_format", bdev->dif_pi_format);
225 spdk_json_write_named_uuid(w, "uuid", &bdev->uuid);
240 * craeted bdev.
243 _bdev_validate_dif_config(struct spdk_bdev *bdev)
249 dif_opts.dif_pi_format = bdev->dif_pi_format;
252 bdev->blocklen,
253 bdev->md_len,
255 bdev->dif_is_head_of_md,
256 bdev->dif_type,
257 bdev->dif_check_flags,
264 bdev_null_create(struct spdk_bdev **bdev, const struct null_bdev_opts *opts)
271 SPDK_ERRLOG("No options provided for Null bdev.\n");
311 null_disk->bdev.name = strdup(opts->name);
312 if (!null_disk->bdev.name) {
316 null_disk->bdev.product_name = "Null disk";
318 null_disk->bdev.write_cache = 0;
319 null_disk->bdev.blocklen = block_size;
320 null_disk->bdev.phys_blocklen = opts->physical_block_size;
321 null_disk->bdev.blockcnt = opts->num_blocks;
322 null_disk->bdev.md_len = opts->md_size;
323 null_disk->bdev.md_interleave = true;
324 null_disk->bdev.dif_type = opts->dif_type;
325 null_disk->bdev.dif_is_head_of_md = opts->dif_is_head_of_md;
333 null_disk->bdev.dif_check_flags = SPDK_DIF_FLAGS_GUARD_CHECK |
337 null_disk->bdev.dif_check_flags = SPDK_DIF_FLAGS_GUARD_CHECK;
342 null_disk->bdev.dif_pi_format = opts->dif_pi_format;
345 rc = _bdev_validate_dif_config(&null_disk->bdev);
354 spdk_uuid_copy(&null_disk->bdev.uuid, &opts->uuid);
357 null_disk->bdev.ctxt = null_disk;
358 null_disk->bdev.fn_table = &null_fn_table;
359 null_disk->bdev.module = &null_if;
361 rc = spdk_bdev_register(&null_disk->bdev);
363 free(null_disk->bdev.name);
368 *bdev = &(null_disk->bdev);
433 * Instead of using a real rbuf from the bdev pool, just always point to
453 dummy_bdev_event_cb(enum spdk_bdev_event_type type, struct spdk_bdev *bdev, void *ctx)
461 struct spdk_bdev *bdev;
468 SPDK_ERRLOG("failed to open bdev; %s.\n", bdev_name);
472 bdev = spdk_bdev_desc_get_bdev(desc);
474 if (bdev->module != &null_if) {
479 current_size_in_mb = bdev->blocklen * bdev->blockcnt / (1024 * 1024);
481 SPDK_ERRLOG("The new bdev size must not be smaller than current bdev size.\n");
488 rc = spdk_bdev_notify_blockcnt_change(bdev, new_size_in_byte / bdev->blocklen);