FTL: Dump statistics on shutdown

Signed-off-by: Kozlowski Mateusz <mateusz.kozlowski@intel.com>
Signed-off-by: Artur Paszkiewicz <artur.paszkiewicz@intel.com>
Change-Id: I9168af3cacffe9c4efae169b56df974a35bd4e2c
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/13296
Community-CI: Mellanox Build Bot
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Konrad Sztyber <konrad.sztyber@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
This commit is contained in:
Kozlowski Mateusz 2022-06-20 11:44:35 +02:00 committed by Konrad Sztyber
parent 5022d8f372
commit 92b5ebe014
8 changed files with 50 additions and 1 deletions

View File

@ -17,7 +17,7 @@ CFLAGS += -I.
FTL_SUBDIRS := mngt utils
C_SRCS = ftl_core.c ftl_init.c ftl_layout.c
C_SRCS = ftl_core.c ftl_init.c ftl_layout.c ftl_debug.c
C_SRCS += mngt/ftl_mngt.c mngt/ftl_mngt_bdev.c mngt/ftl_mngt_shutdown.c mngt/ftl_mngt_startup.c
C_SRCS += mngt/ftl_mngt_md.c mngt/ftl_mngt_misc.c
C_SRCS += utils/ftl_conf.c utils/ftl_md.c

View File

@ -13,6 +13,7 @@
#include "spdk/crc32.h"
#include "ftl_core.h"
#include "ftl_debug.h"
#include "ftl_internal.h"
#include "mngt/ftl_mngt.h"

19
lib/ftl/ftl_debug.c Normal file
View File

@ -0,0 +1,19 @@
/* SPDX-License-Identifier: BSD-3-Clause
* Copyright (c) Intel Corporation.
* All rights reserved.
*/
#include "spdk/ftl.h"
#include "ftl_debug.h"
void
ftl_dev_dump_stats(const struct spdk_ftl_dev *dev)
{
size_t total = 0;
char uuid[SPDK_UUID_STRING_LEN];
spdk_uuid_fmt_lower(uuid, sizeof(uuid), &dev->conf.uuid);
FTL_NOTICELOG(dev, "\n");
FTL_NOTICELOG(dev, "device UUID: %s\n", uuid);
FTL_NOTICELOG(dev, "total valid LBAs: %zu\n", total);
}

14
lib/ftl/ftl_debug.h Normal file
View File

@ -0,0 +1,14 @@
/* SPDX-License-Identifier: BSD-3-Clause
* Copyright (c) Intel Corporation.
* All rights reserved.
*/
#ifndef FTL_DEBUG_H
#define FTL_DEBUG_H
#include "ftl_internal.h"
#include "ftl_core.h"
void ftl_dev_dump_stats(const struct spdk_ftl_dev *dev);
#endif /* FTL_DEBUG_H */

View File

@ -16,6 +16,7 @@
#include "spdk/config.h"
#include "ftl_core.h"
#include "ftl_debug.h"
#include "ftl_utils.h"
#include "mngt/ftl_mngt.h"

View File

@ -8,6 +8,7 @@
#include "ftl_mngt.h"
#include "ftl_mngt_steps.h"
#include "ftl_internal.h"
#include "ftl_debug.h"
void
ftl_mngt_check_conf(struct spdk_ftl_dev *dev, struct ftl_mngt_process *mngt)
@ -60,3 +61,10 @@ ftl_mngt_finalize_startup(struct spdk_ftl_dev *dev, struct ftl_mngt_process *mng
ftl_mngt_next_step(mngt);
}
void
ftl_mngt_dump_stats(struct spdk_ftl_dev *dev, struct ftl_mngt_process *mngt)
{
ftl_dev_dump_stats(dev);
ftl_mngt_next_step(mngt);
}

View File

@ -15,6 +15,10 @@ static const struct ftl_mngt_process_desc desc_shutdown = {
.name = "FTL shutdown",
.error_handler = ftl_mngt_rollback_device,
.steps = {
{
.name = "Dump statistics",
.action = ftl_mngt_dump_stats
},
{
.name = "Rollback FTL device",
.action = ftl_mngt_rollback_device

View File

@ -30,4 +30,6 @@ void ftl_mngt_deinit_md(struct spdk_ftl_dev *dev, struct ftl_mngt_process *mngt)
void ftl_mngt_rollback_device(struct spdk_ftl_dev *dev, struct ftl_mngt_process *mngt);
void ftl_mngt_dump_stats(struct spdk_ftl_dev *dev, struct ftl_mngt_process *mngt);
#endif /* FTL_MNGT_STEPS_H */