xref: /spdk/lib/ftl/ftl_nv_cache_io.h (revision 34edd9f1bf5fda4c987f4500ddc3c9f50be32e7d)
1 /*   SPDX-License-Identifier: BSD-3-Clause
2  *   Copyright 2023 Solidigm All Rights Reserved
3  *   Copyright (C) 2022 Intel Corporation.
4  *   All rights reserved.
5  */
6 
7 #ifndef FTL_NV_CACHE_IO_H
8 #define FTL_NV_CACHE_IO_H
9 
10 #include "spdk/bdev.h"
11 #include "ftl_core.h"
12 
13 static inline int
14 ftl_nv_cache_bdev_read_blocks_with_md(struct spdk_ftl_dev *dev,
15 				      struct spdk_bdev_desc *desc,
16 				      struct spdk_io_channel *ch,
17 				      void *buf, void *md,
18 				      uint64_t offset_blocks, uint64_t num_blocks,
19 				      spdk_bdev_io_completion_cb cb, void *cb_arg)
20 {
21 	return spdk_bdev_read_blocks_with_md(desc, ch, buf, md ? : g_ftl_read_buf,
22 					     offset_blocks, num_blocks,
23 					     cb, cb_arg);
24 }
25 
26 static inline int
27 ftl_nv_cache_bdev_write_blocks_with_md(struct spdk_ftl_dev *dev,
28 				       struct spdk_bdev_desc *desc,
29 				       struct spdk_io_channel *ch,
30 				       void *buf, void *md,
31 				       uint64_t offset_blocks, uint64_t num_blocks,
32 				       spdk_bdev_io_completion_cb cb, void *cb_arg)
33 {
34 	return spdk_bdev_write_blocks_with_md(desc, ch, buf, md ? : g_ftl_write_buf,
35 					      offset_blocks, num_blocks,
36 					      cb, cb_arg);
37 }
38 
39 #endif /* FTL_NV_CACHE_IO_H */
40