ftl: retrieve device’s attributes and configuration
Signed-off-by: Artur Paszkiewicz <artur.paszkiewicz@intel.com> Signed-off-by: Kozlowski Mateusz <mateusz.kozlowski@intel.com> Change-Id: Ide6bb24d2c1ec2b0da3f20ce4013a4cd6e339114 Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/13297 Community-CI: Mellanox Build Bot Tested-by: SPDK CI Jenkins <sys_sgci@intel.com> Reviewed-by: Jim Harris <james.r.harris@intel.com> Reviewed-by: Ben Walker <benjamin.walker@intel.com> Reviewed-by: Konrad Sztyber <konrad.sztyber@intel.com>
This commit is contained in:
parent
92b5ebe014
commit
d974bad6fc
@ -48,6 +48,19 @@ enum spdk_ftl_mode {
|
|||||||
SPDK_FTL_MODE_CREATE = (1 << 0),
|
SPDK_FTL_MODE_CREATE = (1 << 0),
|
||||||
};
|
};
|
||||||
|
|
||||||
|
struct spdk_ftl_attrs {
|
||||||
|
/* Number of logical blocks */
|
||||||
|
uint64_t num_blocks;
|
||||||
|
/* Logical block size */
|
||||||
|
uint64_t block_size;
|
||||||
|
/* Number of zones in the underlying device (including any offline ones) */
|
||||||
|
uint64_t num_zones;
|
||||||
|
/* Number of logical blocks per zone */
|
||||||
|
uint64_t zone_size;
|
||||||
|
/* Optimal IO size - bdev layer will split requests over this size */
|
||||||
|
uint64_t optimum_io_size;
|
||||||
|
};
|
||||||
|
|
||||||
typedef void (*spdk_ftl_fn)(void *cb_arg, int status);
|
typedef void (*spdk_ftl_fn)(void *cb_arg, int status);
|
||||||
typedef void (*spdk_ftl_init_fn)(struct spdk_ftl_dev *dev, void *cb_arg, int status);
|
typedef void (*spdk_ftl_init_fn)(struct spdk_ftl_dev *dev, void *cb_arg, int status);
|
||||||
|
|
||||||
@ -74,6 +87,22 @@ int spdk_ftl_dev_init(const struct spdk_ftl_conf *conf, spdk_ftl_init_fn cb, voi
|
|||||||
*/
|
*/
|
||||||
int spdk_ftl_dev_free(struct spdk_ftl_dev *dev, spdk_ftl_fn cb, void *cb_arg);
|
int spdk_ftl_dev_free(struct spdk_ftl_dev *dev, spdk_ftl_fn cb, void *cb_arg);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Retrieve device’s attributes.
|
||||||
|
*
|
||||||
|
* \param dev device
|
||||||
|
* \param attr Attribute structure to fill
|
||||||
|
*/
|
||||||
|
void spdk_ftl_dev_get_attrs(const struct spdk_ftl_dev *dev, struct spdk_ftl_attrs *attr);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Retrieve device’s configuration.
|
||||||
|
*
|
||||||
|
* \param dev device
|
||||||
|
* \param conf FTL configuration structure to fill
|
||||||
|
*/
|
||||||
|
void spdk_ftl_dev_get_conf(const struct spdk_ftl_dev *dev, struct spdk_ftl_conf *conf);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Initialize FTL configuration structure with default values.
|
* Initialize FTL configuration structure with default values.
|
||||||
*
|
*
|
||||||
|
@ -17,4 +17,14 @@
|
|||||||
#include "ftl_internal.h"
|
#include "ftl_internal.h"
|
||||||
#include "mngt/ftl_mngt.h"
|
#include "mngt/ftl_mngt.h"
|
||||||
|
|
||||||
|
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;
|
||||||
|
}
|
||||||
|
|
||||||
SPDK_LOG_REGISTER_COMPONENT(ftl_core)
|
SPDK_LOG_REGISTER_COMPONENT(ftl_core)
|
||||||
|
@ -122,4 +122,16 @@ ftl_get_write_unit_size(struct spdk_bdev *bdev)
|
|||||||
return 32;
|
return 32;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static inline size_t
|
||||||
|
ftl_get_num_bands(const struct spdk_ftl_dev *dev)
|
||||||
|
{
|
||||||
|
return dev->num_bands;
|
||||||
|
}
|
||||||
|
|
||||||
|
static inline size_t
|
||||||
|
ftl_get_num_zones(const struct spdk_ftl_dev *dev)
|
||||||
|
{
|
||||||
|
return ftl_get_num_bands(dev) * ftl_get_num_zones_in_band(dev);
|
||||||
|
}
|
||||||
|
|
||||||
#endif /* FTL_CORE_H */
|
#endif /* FTL_CORE_H */
|
||||||
|
@ -5,6 +5,8 @@
|
|||||||
spdk_ftl_dev_init;
|
spdk_ftl_dev_init;
|
||||||
spdk_ftl_dev_free;
|
spdk_ftl_dev_free;
|
||||||
spdk_ftl_get_default_conf;
|
spdk_ftl_get_default_conf;
|
||||||
|
spdk_ftl_dev_get_attrs;
|
||||||
|
spdk_ftl_dev_get_conf;
|
||||||
|
|
||||||
local: *;
|
local: *;
|
||||||
};
|
};
|
||||||
|
@ -20,6 +20,12 @@ spdk_ftl_get_default_conf(struct spdk_ftl_conf *conf)
|
|||||||
*conf = g_default_conf;
|
*conf = g_default_conf;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
spdk_ftl_dev_get_conf(const struct spdk_ftl_dev *dev, struct spdk_ftl_conf *conf)
|
||||||
|
{
|
||||||
|
*conf = dev->conf;
|
||||||
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
ftl_conf_cpy(struct spdk_ftl_conf *dst, const struct spdk_ftl_conf *src)
|
ftl_conf_cpy(struct spdk_ftl_conf *dst, const struct spdk_ftl_conf *src)
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user