ftl: wrappers for nv cache bdev io
Signed-off-by: Artur Paszkiewicz <artur.paszkiewicz@intel.com> Signed-off-by: Kozlowski Mateusz <mateusz.kozlowski@intel.com> Change-Id: I33d99ae35e2bd853a16a6d20336632a955679197 Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/13309 Tested-by: SPDK CI Jenkins <sys_sgci@intel.com> Reviewed-by: Jim Harris <james.r.harris@intel.com> Reviewed-by: Ben Walker <benjamin.walker@intel.com>
This commit is contained in:
parent
950cce2c9e
commit
d67952540f
64
lib/ftl/ftl_nv_cache_io.h
Normal file
64
lib/ftl/ftl_nv_cache_io.h
Normal file
@ -0,0 +1,64 @@
|
|||||||
|
/* SPDX-License-Identifier: BSD-3-Clause
|
||||||
|
* Copyright (c) Intel Corporation.
|
||||||
|
* All rights reserved.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef FTL_NV_CACHE_IO_H
|
||||||
|
#define FTL_NV_CACHE_IO_H
|
||||||
|
|
||||||
|
#include "spdk/bdev.h"
|
||||||
|
#include "ftl_core.h"
|
||||||
|
|
||||||
|
static inline int
|
||||||
|
ftl_nv_cache_bdev_readv_blocks_with_md(struct spdk_ftl_dev *dev,
|
||||||
|
struct spdk_bdev_desc *desc,
|
||||||
|
struct spdk_io_channel *ch,
|
||||||
|
struct iovec *iov, int iovcnt, void *md,
|
||||||
|
uint64_t offset_blocks, uint64_t num_blocks,
|
||||||
|
spdk_bdev_io_completion_cb cb, void *cb_arg)
|
||||||
|
{
|
||||||
|
return spdk_bdev_readv_blocks_with_md(desc, ch, iov, iovcnt, md,
|
||||||
|
offset_blocks, num_blocks,
|
||||||
|
cb, cb_arg);
|
||||||
|
}
|
||||||
|
|
||||||
|
static inline int
|
||||||
|
ftl_nv_cache_bdev_writev_blocks_with_md(struct spdk_ftl_dev *dev,
|
||||||
|
struct spdk_bdev_desc *desc,
|
||||||
|
struct spdk_io_channel *ch,
|
||||||
|
struct iovec *iov, int iovcnt, void *md_buf,
|
||||||
|
uint64_t offset_blocks, uint64_t num_blocks,
|
||||||
|
spdk_bdev_io_completion_cb cb, void *cb_arg)
|
||||||
|
{
|
||||||
|
return spdk_bdev_writev_blocks_with_md(desc, ch, iov, iovcnt, md_buf,
|
||||||
|
offset_blocks, num_blocks, cb,
|
||||||
|
cb_arg);
|
||||||
|
}
|
||||||
|
|
||||||
|
static inline int
|
||||||
|
ftl_nv_cache_bdev_read_blocks_with_md(struct spdk_ftl_dev *dev,
|
||||||
|
struct spdk_bdev_desc *desc,
|
||||||
|
struct spdk_io_channel *ch,
|
||||||
|
void *buf, void *md,
|
||||||
|
uint64_t offset_blocks, uint64_t num_blocks,
|
||||||
|
spdk_bdev_io_completion_cb cb, void *cb_arg)
|
||||||
|
{
|
||||||
|
return spdk_bdev_read_blocks_with_md(desc, ch, buf, md,
|
||||||
|
offset_blocks, num_blocks,
|
||||||
|
cb, cb_arg);
|
||||||
|
}
|
||||||
|
|
||||||
|
static inline int
|
||||||
|
ftl_nv_cache_bdev_write_blocks_with_md(struct spdk_ftl_dev *dev,
|
||||||
|
struct spdk_bdev_desc *desc,
|
||||||
|
struct spdk_io_channel *ch,
|
||||||
|
void *buf, void *md,
|
||||||
|
uint64_t offset_blocks, uint64_t num_blocks,
|
||||||
|
spdk_bdev_io_completion_cb cb, void *cb_arg)
|
||||||
|
{
|
||||||
|
return spdk_bdev_write_blocks_with_md(desc, ch, buf, md,
|
||||||
|
offset_blocks, num_blocks,
|
||||||
|
cb, cb_arg);
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif /* FTL_NV_CACHE_IO_H */
|
@ -8,6 +8,7 @@
|
|||||||
|
|
||||||
#include "ftl_core.h"
|
#include "ftl_core.h"
|
||||||
#include "ftl_md.h"
|
#include "ftl_md.h"
|
||||||
|
#include "ftl_nv_cache_io.h"
|
||||||
#include "ftl_utils.h"
|
#include "ftl_utils.h"
|
||||||
|
|
||||||
struct ftl_md;
|
struct ftl_md;
|
||||||
@ -260,7 +261,11 @@ read_blocks(struct spdk_ftl_dev *dev, struct spdk_bdev_desc *desc,
|
|||||||
uint64_t offset_blocks, uint64_t num_blocks,
|
uint64_t offset_blocks, uint64_t num_blocks,
|
||||||
spdk_bdev_io_completion_cb cb, void *cb_arg)
|
spdk_bdev_io_completion_cb cb, void *cb_arg)
|
||||||
{
|
{
|
||||||
if (md_buf) {
|
if (desc == dev->cache_bdev_desc) {
|
||||||
|
return ftl_nv_cache_bdev_read_blocks_with_md(dev, desc, ch, buf, md_buf,
|
||||||
|
offset_blocks, num_blocks,
|
||||||
|
cb, cb_arg);
|
||||||
|
} else if (md_buf) {
|
||||||
return spdk_bdev_read_blocks_with_md(desc, ch, buf, md_buf,
|
return spdk_bdev_read_blocks_with_md(desc, ch, buf, md_buf,
|
||||||
offset_blocks, num_blocks,
|
offset_blocks, num_blocks,
|
||||||
cb, cb_arg);
|
cb, cb_arg);
|
||||||
@ -278,7 +283,11 @@ write_blocks(struct spdk_ftl_dev *dev, struct spdk_bdev_desc *desc,
|
|||||||
uint64_t offset_blocks, uint64_t num_blocks,
|
uint64_t offset_blocks, uint64_t num_blocks,
|
||||||
spdk_bdev_io_completion_cb cb, void *cb_arg)
|
spdk_bdev_io_completion_cb cb, void *cb_arg)
|
||||||
{
|
{
|
||||||
if (md_buf) {
|
if (desc == dev->cache_bdev_desc) {
|
||||||
|
return ftl_nv_cache_bdev_write_blocks_with_md(dev, desc, ch, buf, md_buf,
|
||||||
|
offset_blocks, num_blocks,
|
||||||
|
cb, cb_arg);
|
||||||
|
} else if (md_buf) {
|
||||||
return spdk_bdev_write_blocks_with_md(desc, ch, buf, md_buf, offset_blocks,
|
return spdk_bdev_write_blocks_with_md(desc, ch, buf, md_buf, offset_blocks,
|
||||||
num_blocks, cb, cb_arg);
|
num_blocks, cb, cb_arg);
|
||||||
} else {
|
} else {
|
||||||
|
Loading…
Reference in New Issue
Block a user