LCOV - code coverage report
Current view: top level - lib/ftl - ftl_debug.h (source / functions) Hit Total Coverage
Test: ut_cov_unit.info Lines: 0 4 0.0 %
Date: 2024-12-08 21:49:40 Functions: 0 1 0.0 %

          Line data    Source code
       1             : /*   SPDX-License-Identifier: BSD-3-Clause
       2             :  *   Copyright (C) 2018 Intel Corporation.
       3             :  *   All rights reserved.
       4             :  */
       5             : 
       6             : #ifndef FTL_DEBUG_H
       7             : #define FTL_DEBUG_H
       8             : 
       9             : #include "ftl_internal.h"
      10             : #include "ftl_band.h"
      11             : #include "ftl_core.h"
      12             : 
      13             : #if defined(DEBUG)
      14             : void ftl_band_validate_md(struct ftl_band *band, ftl_band_validate_md_cb cb);
      15             : void ftl_dev_dump_bands(struct spdk_ftl_dev *dev);
      16             : static inline void
      17           0 : ftl_debug_inject_trim_error(void)
      18             : {
      19             :         static int trim_no = 0;
      20             : 
      21           0 :         if (getenv("FTL_CRASH_ON_TRIM") && trim_no++ == 256) {
      22           0 :                 abort();
      23             :         }
      24           0 : }
      25             : #else
      26             : 
      27             : static void
      28             : _validate_cb(void *ctx)
      29             : {
      30             :         struct ftl_band *band = ctx;
      31             : 
      32             :         band->validate_cb(band, true);
      33             : }
      34             : 
      35             : static inline void
      36             : ftl_band_validate_md(struct ftl_band *band, ftl_band_validate_md_cb cb)
      37             : {
      38             :         /* For release builds this is a NOP operation, but should still be asynchronous to keep the behavior consistent */
      39             :         band->validate_cb = cb;
      40             :         spdk_thread_send_msg(band->dev->core_thread, _validate_cb, band);
      41             : }
      42             : 
      43             : static inline void
      44             : ftl_dev_dump_bands(struct spdk_ftl_dev *dev)
      45             : {
      46             : }
      47             : static inline void
      48             : ftl_debug_inject_trim_error(void)
      49             : {
      50             : }
      51             : #endif
      52             : 
      53             : void ftl_dev_dump_stats(const struct spdk_ftl_dev *dev);
      54             : 
      55             : #endif /* FTL_DEBUG_H */

Generated by: LCOV version 1.15