Commit 92595a58 authored by Konrad Sztyber's avatar Konrad Sztyber
Browse files

bdev: remove {small,large}_buf_pool_size from spdk_bdev_opts



These options were marked as deprecated and to be removed in v23.05.
Users should use iobuf_set_options instead.

Signed-off-by: default avatarKonrad Sztyber <konrad.sztyber@intel.com>
Change-Id: Iaba5796c81f8bae89a1c779da9c3944539d9b658
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/18123


Reviewed-by: default avatarJim Harris <james.r.harris@intel.com>
Reviewed-by: default avatarTomasz Zawadzki <tomasz.zawadzki@intel.com>
Tested-by: default avatarSPDK CI Jenkins <sys_sgci@intel.com>
Community-CI: Mellanox Build Bot
parent 73ba05f7
Loading
Loading
Loading
Loading
+2 −4
Original line number Diff line number Diff line
@@ -200,10 +200,8 @@ struct spdk_bdev_opts {
	 */
	size_t opts_size;

	/** Deprecated, use spdk_iobuf_set_opts() instead */
	uint32_t small_buf_pool_size;
	/** Deprecated, use spdk_iobuf_set_opts() instead */
	uint32_t large_buf_pool_size;
	/* Hole at bytes 24-31. */
	uint8_t reserved[8];
} __attribute__((packed));
SPDK_STATIC_ASSERT(sizeof(struct spdk_bdev_opts) == 32, "Incorrect size");

+0 −31
Original line number Diff line number Diff line
@@ -147,8 +147,6 @@ static struct spdk_bdev_opts g_bdev_opts = {
	.bdev_io_pool_size = SPDK_BDEV_IO_POOL_SIZE,
	.bdev_io_cache_size = SPDK_BDEV_IO_CACHE_SIZE,
	.bdev_auto_examine = SPDK_BDEV_AUTO_EXAMINE,
	.small_buf_pool_size = BUF_SMALL_POOL_SIZE,
	.large_buf_pool_size = BUF_LARGE_POOL_SIZE,
};

static spdk_bdev_init_cb	g_init_cb_fn = NULL;
@@ -452,8 +450,6 @@ spdk_bdev_get_opts(struct spdk_bdev_opts *opts, size_t opts_size)
	SET_FIELD(bdev_io_pool_size);
	SET_FIELD(bdev_io_cache_size);
	SET_FIELD(bdev_auto_examine);
	SET_FIELD(small_buf_pool_size);
	SET_FIELD(large_buf_pool_size);

	/* Do not remove this statement, you should always update this statement when you adding a new field,
	 * and do not forget to add the SET_FIELD statement for your added field. */
@@ -462,16 +458,10 @@ spdk_bdev_get_opts(struct spdk_bdev_opts *opts, size_t opts_size)
#undef SET_FIELD
}

SPDK_LOG_DEPRECATION_REGISTER(bdev_opts_small_buf_pool_size, "spdk_bdev_opts.small_buf_pool_size",
			      "v23.05", 0);
SPDK_LOG_DEPRECATION_REGISTER(bdev_opts_large_buf_pool_size, "spdk_bdev_opts.large_buf_pool_size",
			      "v23.05", 0);
int
spdk_bdev_set_opts(struct spdk_bdev_opts *opts)
{
	struct spdk_iobuf_opts iobuf_opts;
	uint32_t min_pool_size;
	int rc;

	if (!opts) {
		SPDK_ERRLOG("opts cannot be NULL\n");
@@ -497,13 +487,6 @@ spdk_bdev_set_opts(struct spdk_bdev_opts *opts)
		return -1;
	}

	if (opts->small_buf_pool_size != BUF_SMALL_POOL_SIZE) {
		SPDK_LOG_DEPRECATED(bdev_opts_small_buf_pool_size);
	}
	if (opts->large_buf_pool_size != BUF_LARGE_POOL_SIZE) {
		SPDK_LOG_DEPRECATED(bdev_opts_large_buf_pool_size);
	}

#define SET_FIELD(field) \
        if (offsetof(struct spdk_bdev_opts, field) + sizeof(opts->field) <= opts->opts_size) { \
                g_bdev_opts.field = opts->field; \
@@ -512,20 +495,6 @@ spdk_bdev_set_opts(struct spdk_bdev_opts *opts)
	SET_FIELD(bdev_io_pool_size);
	SET_FIELD(bdev_io_cache_size);
	SET_FIELD(bdev_auto_examine);
	SET_FIELD(small_buf_pool_size);
	SET_FIELD(large_buf_pool_size);

	spdk_iobuf_get_opts(&iobuf_opts);
	iobuf_opts.small_pool_count = opts->small_buf_pool_size;
	iobuf_opts.small_bufsize = SPDK_BDEV_BUF_SIZE_WITH_MD(SPDK_BDEV_SMALL_BUF_MAX_SIZE);
	iobuf_opts.large_pool_count = opts->large_buf_pool_size;
	iobuf_opts.large_bufsize = SPDK_BDEV_BUF_SIZE_WITH_MD(SPDK_BDEV_LARGE_BUF_MAX_SIZE);

	rc = spdk_iobuf_set_opts(&iobuf_opts);
	if (rc != 0) {
		SPDK_ERRLOG("Failed to set iobuf opts\n");
		return -1;
	}

	g_bdev_opts.opts_size = opts->opts_size;

+0 −12
Original line number Diff line number Diff line
@@ -27,16 +27,12 @@ struct spdk_rpc_set_bdev_opts {
	uint32_t bdev_io_pool_size;
	uint32_t bdev_io_cache_size;
	bool bdev_auto_examine;
	uint32_t small_buf_pool_size;
	uint32_t large_buf_pool_size;
};

static const struct spdk_json_object_decoder rpc_set_bdev_opts_decoders[] = {
	{"bdev_io_pool_size", offsetof(struct spdk_rpc_set_bdev_opts, bdev_io_pool_size), spdk_json_decode_uint32, true},
	{"bdev_io_cache_size", offsetof(struct spdk_rpc_set_bdev_opts, bdev_io_cache_size), spdk_json_decode_uint32, true},
	{"bdev_auto_examine", offsetof(struct spdk_rpc_set_bdev_opts, bdev_auto_examine), spdk_json_decode_bool, true},
	{"small_buf_pool_size", offsetof(struct spdk_rpc_set_bdev_opts, small_buf_pool_size), spdk_json_decode_uint32, true},
	{"large_buf_pool_size", offsetof(struct spdk_rpc_set_bdev_opts, large_buf_pool_size), spdk_json_decode_uint32, true},
};

static void
@@ -48,8 +44,6 @@ rpc_bdev_set_options(struct spdk_jsonrpc_request *request, const struct spdk_jso

	rpc_opts.bdev_io_pool_size = UINT32_MAX;
	rpc_opts.bdev_io_cache_size = UINT32_MAX;
	rpc_opts.small_buf_pool_size = UINT32_MAX;
	rpc_opts.large_buf_pool_size = UINT32_MAX;
	rpc_opts.bdev_auto_examine = true;

	if (params != NULL) {
@@ -70,12 +64,6 @@ rpc_bdev_set_options(struct spdk_jsonrpc_request *request, const struct spdk_jso
		bdev_opts.bdev_io_cache_size = rpc_opts.bdev_io_cache_size;
	}
	bdev_opts.bdev_auto_examine = rpc_opts.bdev_auto_examine;
	if (rpc_opts.small_buf_pool_size != UINT32_MAX) {
		bdev_opts.small_buf_pool_size = rpc_opts.small_buf_pool_size;
	}
	if (rpc_opts.large_buf_pool_size != UINT32_MAX) {
		bdev_opts.large_buf_pool_size = rpc_opts.large_buf_pool_size;
	}

	rc = spdk_bdev_set_opts(&bdev_opts);

+2 −8
Original line number Diff line number Diff line
@@ -4,16 +4,14 @@
#  Copyright (c) 2022 Dell Inc, or its subsidiaries.


def bdev_set_options(client, bdev_io_pool_size=None, bdev_io_cache_size=None, bdev_auto_examine=None,
                     small_buf_pool_size=None, large_buf_pool_size=None):
def bdev_set_options(client, bdev_io_pool_size=None, bdev_io_cache_size=None,
                     bdev_auto_examine=None):
    """Set parameters for the bdev subsystem.

    Args:
        bdev_io_pool_size: number of bdev_io structures in shared buffer pool (optional)
        bdev_io_cache_size: maximum number of bdev_io structures cached per thread (optional)
        bdev_auto_examine: if set to false, the bdev layer will not examine every disks automatically (optional)
        small_buf_pool_size: maximum number of small buffer (8KB buffer) pool size (optional)
        large_buf_pool_size: maximum number of large buffer (64KB buffer) pool size (optional)
    """
    params = {}

@@ -23,10 +21,6 @@ def bdev_set_options(client, bdev_io_pool_size=None, bdev_io_cache_size=None, bd
        params['bdev_io_cache_size'] = bdev_io_cache_size
    if bdev_auto_examine is not None:
        params["bdev_auto_examine"] = bdev_auto_examine
    if small_buf_pool_size:
        params['small_buf_pool_size'] = small_buf_pool_size
    if large_buf_pool_size:
        params['large_buf_pool_size'] = large_buf_pool_size
    return client.call('bdev_set_options', params)


+1 −5
Original line number Diff line number Diff line
@@ -204,16 +204,12 @@ if __name__ == "__main__":
        rpc.bdev.bdev_set_options(args.client,
                                  bdev_io_pool_size=args.bdev_io_pool_size,
                                  bdev_io_cache_size=args.bdev_io_cache_size,
                                  bdev_auto_examine=args.bdev_auto_examine,
                                  small_buf_pool_size=args.small_buf_pool_size,
                                  large_buf_pool_size=args.large_buf_pool_size)
                                  bdev_auto_examine=args.bdev_auto_examine)

    p = subparsers.add_parser('bdev_set_options',
                              help="""Set options of bdev subsystem""")
    p.add_argument('-p', '--bdev-io-pool-size', help='Number of bdev_io structures in shared buffer pool', type=int)
    p.add_argument('-c', '--bdev-io-cache-size', help='Maximum number of bdev_io structures cached per thread', type=int)
    p.add_argument('-s', '--small-buf-pool-size', help='Maximum number of small buf (i.e., 8KB) pool size', type=int)
    p.add_argument('-l', '--large-buf-pool-size', help='Maximum number of large buf (i.e., 64KB) pool size', type=int)
    group = p.add_mutually_exclusive_group()
    group.add_argument('-e', '--enable-auto-examine', dest='bdev_auto_examine', help='Allow to auto examine', action='store_true')
    group.add_argument('-d', '--disable-auto-examine', dest='bdev_auto_examine', help='Not allow to auto examine', action='store_false')
Loading