The malloc bdev module supports both of interleaved and separated metadata in this patch. Different from the NULL bdev module, opts->block_size is a data block size and a block size is caculated internally as a sum of opts->block_size and opts->md_size if opts->md_interleave is true, or opts->block_size otherwise. This will be more intuitive. Additionally, opts->md_size accepts only either of 0, 8, 16, 32, 64, or 128. Protection information (T10 DIF/DIX) will be supported in the following patches. Signed-off-by: Shuhei Matsumoto <smatsumoto@nvidia.com> Change-Id: Icd9e92c8ea94e30139e416f8c533ab4cf473d2a8 Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/14984 Tested-by: SPDK CI Jenkins <sys_sgci@intel.com> Reviewed-by: Changpeng Liu <changpeng.liu@intel.com> Reviewed-by: Aleksey Marchuk <alexeymar@nvidia.com> Community-CI: Mellanox Build Bot
31 lines
771 B
C
31 lines
771 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;
|
|
};
|
|
|
|
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 */
|