xref: /spdk/lib/ftl/ftl_debug.h (revision 510f4c134a21b45ff3a5add9ebc6c6cf7e49aeab)
1 /*   SPDX-License-Identifier: BSD-3-Clause
2  *   Copyright (c) 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 #else
17 
18 static void
19 _validate_cb(void *ctx)
20 {
21 	struct ftl_band *band = ctx;
22 
23 	band->validate_cb(band, true);
24 }
25 
26 static inline void
27 ftl_band_validate_md(struct ftl_band *band, ftl_band_validate_md_cb cb)
28 {
29 	/* For release builds this is a NOP operation, but should still be asynchronous to keep the behavior consistent */
30 	band->validate_cb = cb;
31 	spdk_thread_send_msg(band->dev->core_thread, _validate_cb, band);
32 }
33 
34 static inline void
35 ftl_dev_dump_bands(struct spdk_ftl_dev *dev)
36 {
37 }
38 #endif
39 
40 void ftl_dev_dump_stats(const struct spdk_ftl_dev *dev);
41 
42 #endif /* FTL_DEBUG_H */
43