LCOV - code coverage report
Current view: top level - spdk/lib/ftl - ftl_nv_cache_io.h (source / functions) Hit Total Coverage
Test: Combined Lines: 6 14 42.9 %
Date: 2024-12-10 15:44:17 Functions: 2 2 100.0 %
Legend: Lines: hit not hit | Branches: + taken - not taken # not executed Branches: 6 8 75.0 %

           Branch data     Line data    Source code
       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                 :    1295484 : 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         [ +  - ]:    1295484 :         if (spdk_bdev_get_md_size(spdk_bdev_desc_get_bdev(desc))) {
      22         [ +  + ]:    1295484 :                 return spdk_bdev_read_blocks_with_md(desc, ch, buf, md ? : g_ftl_read_buf,
      23                 :          0 :                                                      offset_blocks, num_blocks, cb, cb_arg);
      24                 :            :         } else {
      25                 :          0 :                 return spdk_bdev_read_blocks(desc, ch, buf, offset_blocks, num_blocks,
      26                 :          0 :                                              cb, cb_arg);
      27                 :            :         }
      28                 :          0 : }
      29                 :            : 
      30                 :            : static inline int
      31                 :     124326 : ftl_nv_cache_bdev_write_blocks_with_md(struct spdk_ftl_dev *dev,
      32                 :            :                                        struct spdk_bdev_desc *desc,
      33                 :            :                                        struct spdk_io_channel *ch,
      34                 :            :                                        void *buf, void *md,
      35                 :            :                                        uint64_t offset_blocks, uint64_t num_blocks,
      36                 :            :                                        spdk_bdev_io_completion_cb cb, void *cb_arg)
      37                 :            : {
      38         [ +  - ]:     124326 :         if (spdk_bdev_get_md_size(spdk_bdev_desc_get_bdev(desc))) {
      39         [ +  + ]:     124326 :                 return spdk_bdev_write_blocks_with_md(desc, ch, buf, md ? : g_ftl_write_buf,
      40                 :          0 :                                                       offset_blocks, num_blocks, cb, cb_arg);
      41                 :            :         } else {
      42                 :          0 :                 return spdk_bdev_write_blocks(desc, ch, buf, offset_blocks, num_blocks,
      43                 :          0 :                                               cb, cb_arg);
      44                 :            :         }
      45                 :          0 : }
      46                 :            : 
      47                 :            : #endif /* FTL_NV_CACHE_IO_H */

Generated by: LCOV version 1.15