diff --git a/module/bdev/ftl/bdev_ftl.c b/module/bdev/ftl/bdev_ftl.c index d1503aef4..fa3f94228 100644 --- a/module/bdev/ftl/bdev_ftl.c +++ b/module/bdev/ftl/bdev_ftl.c @@ -246,6 +246,9 @@ bdev_ftl_write_config_json(struct spdk_bdev *bdev, struct spdk_json_write_ctx *w spdk_json_write_named_uint64(w, "limit_low_threshold", conf->limits[SPDK_FTL_LIMIT_LOW].thld); spdk_json_write_named_uint64(w, "limit_start", conf->limits[SPDK_FTL_LIMIT_START].limit); spdk_json_write_named_uint64(w, "limit_start_threshold", conf->limits[SPDK_FTL_LIMIT_START].thld); + if (conf->l2p_path) { + spdk_json_write_named_string(w, "l2p_path", conf->l2p_path); + } spdk_uuid_fmt_lower(uuid, sizeof(uuid), &attrs.uuid); spdk_json_write_named_string(w, "uuid", uuid); diff --git a/module/bdev/ftl/bdev_ftl_rpc.c b/module/bdev/ftl/bdev_ftl_rpc.c index bf9c2bca2..c63afb549 100644 --- a/module/bdev/ftl/bdev_ftl_rpc.c +++ b/module/bdev/ftl/bdev_ftl_rpc.c @@ -54,6 +54,7 @@ free_rpc_bdev_ftl_create(struct rpc_bdev_ftl_create *req) free(req->base_bdev); free(req->uuid); free(req->cache_bdev); + free((char *)req->ftl_conf.l2p_path); } static const struct spdk_json_object_decoder rpc_bdev_ftl_create_decoders[] = { @@ -73,6 +74,11 @@ static const struct spdk_json_object_decoder rpc_bdev_ftl_create_decoders[] = { "use_append", offsetof(struct rpc_bdev_ftl_create, ftl_conf) + offsetof(struct spdk_ftl_conf, use_append), spdk_json_decode_bool, true }, + { + "l2p_path", offsetof(struct rpc_bdev_ftl_create, ftl_conf) + + offsetof(struct spdk_ftl_conf, l2p_path), + spdk_json_decode_string, true + }, { "limit_crit", offsetof(struct rpc_bdev_ftl_create, ftl_conf) + offsetof(struct spdk_ftl_conf, limits[SPDK_FTL_LIMIT_CRIT]) + diff --git a/scripts/rpc.py b/scripts/rpc.py index 94462bc8a..ea8bcf180 100755 --- a/scripts/rpc.py +++ b/scripts/rpc.py @@ -1550,6 +1550,7 @@ Format: 'user:u1 secret:s1 muser:mu1 msecret:ms1,user:u2 secret:s2 muser:mu2 mse cache=args.cache, allow_open_bands=args.allow_open_bands, overprovisioning=args.overprovisioning, + l2p_path=args.l2p_path, use_append=args.use_append, **arg_limits)) @@ -1564,6 +1565,8 @@ Format: 'user:u1 secret:s1 muser:mu1 msecret:ms1,user:u2 secret:s2 muser:mu2 mse ' result in partial data recovery, instead of error', action='store_true') p.add_argument('--overprovisioning', help='Percentage of device used for relocation, not exposed' ' to user (optional)', type=int) + p.add_argument('--l2p_path', help='Path to persistent memory file or device to store l2p onto, ' + 'by default l2p is kept in DRAM and is volatile (optional)') p.add_argument('--use_append', help='Use appends instead of writes', action='store_true') limits = p.add_argument_group('Defrag limits', 'Configures defrag limits and thresholds for'