Commit b45556e2 authored by Changpeng Liu's avatar Changpeng Liu Committed by Tomasz Zawadzki
Browse files

include/bdev_module.h: add `SPDK_` prefix to macros



`BDEV_IO_NUM_CHILD_IOV` and `BDEV_RESET_IO_DRAIN_RECOMMENDED_VALUE`
are public macro definitions without `SPDK_` prefix, so we add the
`SPDK_` prefix to them.

Change-Id: I4be86459f0b6ba3a4636a2c8130b2f12757ea2da
Signed-off-by: default avatarChangpeng Liu <changpeng.liu@intel.com>
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/15425


Community-CI: Mellanox Build Bot
Tested-by: default avatarSPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: default avatarPaul Luse <paul.e.luse@intel.com>
Reviewed-by: default avatarJim Harris <james.r.harris@intel.com>
Reviewed-by: default avatarTomasz Zawadzki <tomasz.zawadzki@intel.com>
parent c0c333e2
Loading
Loading
Loading
Loading
+5 −4
Original line number Diff line number Diff line
@@ -31,7 +31,7 @@ extern "C" {
/* This parameter is best defined for bdevs that share an underlying bdev,
 * such as multiple lvol bdevs sharing an nvme device, to avoid unnecessarily
 * resetting the underlying bdev and affecting other bdevs that are sharing it. */
#define BDEV_RESET_IO_DRAIN_RECOMMENDED_VALUE 5
#define SPDK_BDEV_RESET_IO_DRAIN_RECOMMENDED_VALUE 5

/** Block device module */
struct spdk_bdev_module {
@@ -464,7 +464,7 @@ struct spdk_bdev {
	 * `reset_io_drain_timeout` seconds for outstanding IO that are present
	 * on any bdev channel, before sending a reset down to the underlying device.
	 * That way we can avoid sending "empty" resets and interrupting work of
	 * other lvols that use the same bdev. BDEV_RESET_IO_DRAIN_RECOMMENDED_VALUE
	 * other lvols that use the same bdev. SPDK_BDEV_RESET_IO_DRAIN_RECOMMENDED_VALUE
	 * is a good choice for the value of this parameter.
	 *
	 * If this parameter remains equal to zero, the bdev reset will be forcefully
@@ -585,7 +585,8 @@ typedef void (*spdk_bdev_io_get_buf_cb)(struct spdk_io_channel *ch, struct spdk_
typedef void (*spdk_bdev_io_get_aux_buf_cb)(struct spdk_io_channel *ch,
		struct spdk_bdev_io *bdev_io, void *aux_buf);

#define BDEV_IO_NUM_CHILD_IOV 32
/* Maximum number of IOVs used for I/O splitting */
#define SPDK_BDEV_IO_NUM_CHILD_IOV 32

struct spdk_bdev_io {
	/** The block device that this I/O belongs to. */
@@ -601,7 +602,7 @@ struct spdk_bdev_io {
	struct iovec iov;

	/** Array of iovecs used for I/O splitting. */
	struct iovec child_iov[BDEV_IO_NUM_CHILD_IOV];
	struct iovec child_iov[SPDK_BDEV_IO_NUM_CHILD_IOV];

	union {
		struct {
+7 −6
Original line number Diff line number Diff line
@@ -2521,8 +2521,8 @@ _bdev_rw_split(void *_bdev_io)
	int rc;

	max_segment_size = max_segment_size ? max_segment_size : UINT32_MAX;
	max_child_iovcnt = max_child_iovcnt ? spdk_min(max_child_iovcnt, BDEV_IO_NUM_CHILD_IOV) :
			   BDEV_IO_NUM_CHILD_IOV;
	max_child_iovcnt = max_child_iovcnt ? spdk_min(max_child_iovcnt, SPDK_BDEV_IO_NUM_CHILD_IOV) :
			   SPDK_BDEV_IO_NUM_CHILD_IOV;

	if (bdev_io->type == SPDK_BDEV_IO_TYPE_WRITE && bdev->split_on_write_unit) {
		io_boundary = bdev->write_unit_size;
@@ -2547,7 +2547,8 @@ _bdev_rw_split(void *_bdev_io)
	}

	child_iovcnt = 0;
	while (remaining > 0 && parent_iovpos < parent_iovcnt && child_iovcnt < BDEV_IO_NUM_CHILD_IOV) {
	while (remaining > 0 && parent_iovpos < parent_iovcnt &&
	       child_iovcnt < SPDK_BDEV_IO_NUM_CHILD_IOV) {
		to_next_boundary = _to_next_boundary(current_offset, io_boundary);
		to_next_boundary = spdk_min(remaining, to_next_boundary);
		to_next_boundary_bytes = to_next_boundary * blocklen;
@@ -2560,7 +2561,7 @@ _bdev_rw_split(void *_bdev_io)
				 (current_offset - parent_offset) * spdk_bdev_get_md_size(bdev);
		}

		child_iovsize = spdk_min(BDEV_IO_NUM_CHILD_IOV - child_iovcnt, max_child_iovcnt);
		child_iovsize = spdk_min(SPDK_BDEV_IO_NUM_CHILD_IOV - child_iovcnt, max_child_iovcnt);
		while (to_next_boundary_bytes > 0 && parent_iovpos < parent_iovcnt &&
		       iovcnt < child_iovsize) {
			parent_iov = &bdev_io->u.bdev.iovs[parent_iovpos];
@@ -2590,12 +2591,12 @@ _bdev_rw_split(void *_bdev_io)
			 * then adjust to_next_boundary before starting the
			 * child I/O.
			 */
			assert(child_iovcnt == BDEV_IO_NUM_CHILD_IOV ||
			assert(child_iovcnt == SPDK_BDEV_IO_NUM_CHILD_IOV ||
			       iovcnt == child_iovsize);
			to_last_block_bytes = to_next_boundary_bytes % blocklen;
			if (to_last_block_bytes != 0) {
				uint32_t child_iovpos = child_iovcnt - 1;
				/* don't decrease child_iovcnt when it equals to BDEV_IO_NUM_CHILD_IOV
				/* don't decrease child_iovcnt when it equals to SPDK_BDEV_IO_NUM_CHILD_IOV
				 * so the loop will naturally end
				 */

+1 −1
Original line number Diff line number Diff line
@@ -1512,7 +1512,7 @@ vhost_blk_get_config(struct spdk_vhost_dev *vdev, uint8_t *config,
		blkcnt = spdk_bdev_get_num_blocks(bdev);
		if (spdk_bdev_get_buf_align(bdev) > 1) {
			blkcfg.size_max = SPDK_BDEV_LARGE_BUF_MAX_SIZE;
			blkcfg.seg_max = spdk_min(SPDK_VHOST_IOVS_MAX - 2 - 1, BDEV_IO_NUM_CHILD_IOV - 2 - 1);
			blkcfg.seg_max = spdk_min(SPDK_VHOST_IOVS_MAX - 2 - 1, SPDK_BDEV_IO_NUM_CHILD_IOV - 2 - 1);
		} else {
			blkcfg.size_max = 131072;
			/*  -2 for REQ and RESP and -1 for region boundary splitting */
+1 −1
Original line number Diff line number Diff line
@@ -1046,7 +1046,7 @@ _create_lvol_disk(struct spdk_lvol *lvol, bool destroy)
	 * bdev module.
	 * Setting this parameter is mainly to avoid "empty" resets to a shared
	 * bdev that may be used by multiple lvols. */
	bdev->reset_io_drain_timeout = BDEV_RESET_IO_DRAIN_RECOMMENDED_VALUE;
	bdev->reset_io_drain_timeout = SPDK_BDEV_RESET_IO_DRAIN_RECOMMENDED_VALUE;

	rc = spdk_bdev_register(bdev);
	if (rc) {
+1 −1
Original line number Diff line number Diff line
@@ -344,7 +344,7 @@ virtio_blk_update_config(struct virtio_blk_config *blk_cfg, struct spdk_bdev *bd

	if (spdk_bdev_get_buf_align(bdev) > 1) {
		blk_cfg->size_max = SPDK_BDEV_LARGE_BUF_MAX_SIZE;
		blk_cfg->seg_max = spdk_min(VIRTIO_DEV_MAX_IOVS - 2 - 1, BDEV_IO_NUM_CHILD_IOV - 2 - 1);
		blk_cfg->seg_max = spdk_min(VIRTIO_DEV_MAX_IOVS - 2 - 1, SPDK_BDEV_IO_NUM_CHILD_IOV - 2 - 1);
	} else {
		blk_cfg->size_max = 131072;
		/*  -2 for REQ and RESP and -1 for region boundary splitting */
Loading