Signed-off-by: Kozlowski Mateusz <mateusz.kozlowski@intel.com> Signed-off-by: Artur Paszkiewicz <artur.paszkiewicz@intel.com> Change-Id: I8c40b96f0726d83d6a307e8b9a04b7c210b80255 Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/13299 Reviewed-by: Jim Harris <james.r.harris@intel.com> Reviewed-by: Ben Walker <benjamin.walker@intel.com> Community-CI: Mellanox Build Bot Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
65 lines
1.3 KiB
C
65 lines
1.3 KiB
C
/* SPDX-License-Identifier: BSD-3-Clause
|
|
* Copyright (c) Intel Corporation.
|
|
* All rights reserved.
|
|
*/
|
|
|
|
#include "spdk/likely.h"
|
|
#include "spdk/stdinc.h"
|
|
#include "spdk/nvme.h"
|
|
#include "spdk/thread.h"
|
|
#include "spdk/bdev_module.h"
|
|
#include "spdk/string.h"
|
|
#include "spdk/ftl.h"
|
|
#include "spdk/crc32.h"
|
|
|
|
#include "ftl_core.h"
|
|
#include "ftl_debug.h"
|
|
#include "ftl_internal.h"
|
|
#include "mngt/ftl_mngt.h"
|
|
|
|
static int
|
|
ftl_shutdown_complete(struct spdk_ftl_dev *dev)
|
|
{
|
|
if (dev->num_inflight) {
|
|
return 0;
|
|
}
|
|
|
|
return 1;
|
|
}
|
|
|
|
void
|
|
spdk_ftl_dev_get_attrs(const struct spdk_ftl_dev *dev, struct spdk_ftl_attrs *attrs)
|
|
{
|
|
attrs->num_blocks = dev->num_lbas;
|
|
attrs->block_size = FTL_BLOCK_SIZE;
|
|
attrs->num_zones = ftl_get_num_zones(dev);
|
|
attrs->zone_size = ftl_get_num_blocks_in_zone(dev);
|
|
attrs->optimum_io_size = dev->xfer_size;
|
|
}
|
|
|
|
int
|
|
ftl_core_poller(void *ctx)
|
|
{
|
|
struct spdk_ftl_dev *dev = ctx;
|
|
uint64_t io_activity_total_old = dev->io_activity_total;
|
|
|
|
if (dev->halt && ftl_shutdown_complete(dev)) {
|
|
spdk_poller_unregister(&dev->core_poller);
|
|
return SPDK_POLLER_IDLE;
|
|
}
|
|
|
|
if (io_activity_total_old != dev->io_activity_total) {
|
|
return SPDK_POLLER_BUSY;
|
|
}
|
|
|
|
return SPDK_POLLER_IDLE;
|
|
}
|
|
|
|
struct spdk_io_channel *
|
|
spdk_ftl_get_io_channel(struct spdk_ftl_dev *dev)
|
|
{
|
|
return spdk_get_io_channel(dev);
|
|
}
|
|
|
|
SPDK_LOG_REGISTER_COMPONENT(ftl_core)
|