Spdk/module/bdev/malloc/bdev_malloc.h
Shuhei Matsumoto 00bff560dd bdev/malloc: Support protection information for read and write
For write, verify DIF/DIX before submission and for read, verify
DIF/DIX after successful completion.

As same as the NVMe bdev module and the NULL bdev module, DIF/DIX
verification is done based on the DIF type and DIF insert/strip is
not supported.

In near future, the bdev I/O APIs bring an I/O flag to the underlying
bdev and the malloc bdev module will be able to decide DIF/DIX
verification based on the I/O flag.

One important feature is to setup protection information when
creating a malloc disk. Otherwise, all initial reads will fail
if protection information is enabled.

For users, add some explanation about the dif_type parameter
into doc/jsonrpc.md.

Signed-off-by: Shuhei Matsumoto <smatsumoto@nvidia.com>
Change-Id: I93757b77c03cade766c872e418bb46d44918bee2
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/14985
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-by: Aleksey Marchuk <alexeymar@nvidia.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Community-CI: Mellanox Build Bot
2022-10-28 06:49:40 +00:00

33 lines
826 B
C

/* SPDX-License-Identifier: BSD-3-Clause
* Copyright (c) Intel Corporation.
* All rights reserved.
* Copyright (c) 2021 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
*/
#ifndef SPDK_BDEV_MALLOC_H
#define SPDK_BDEV_MALLOC_H
#include "spdk/stdinc.h"
#include "spdk/bdev_module.h"
typedef void (*spdk_delete_malloc_complete)(void *cb_arg, int bdeverrno);
struct malloc_bdev_opts {
char *name;
struct spdk_uuid uuid;
uint64_t num_blocks;
uint32_t block_size;
uint32_t optimal_io_boundary;
uint32_t md_size;
bool md_interleave;
enum spdk_dif_type dif_type;
bool dif_is_head_of_md;
};
int create_malloc_disk(struct spdk_bdev **bdev, const struct malloc_bdev_opts *opts);
void delete_malloc_disk(const char *name, spdk_delete_malloc_complete cb_fn, void *cb_arg);
#endif /* SPDK_BDEV_MALLOC_H */