Commit 6fa5007e authored by Alexey Marchuk's avatar Alexey Marchuk Committed by Tomasz Zawadzki
Browse files

bdev/zone: Call bdev*_with_md even if md is NULL



The bdev*_with_md APIs now allow to pass NULL md
pointer, so calling this function without checking
for metadata simplifies code

Signed-off-by: default avatarAlexey Marchuk <alexeymar@nvidia.com>
Change-Id: Ie4137f7a6a7628a13d14c7c9a5e9aa1ceb99d322
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/15091


Tested-by: default avatarSPDK CI Jenkins <sys_sgci@intel.com>
Community-CI: Mellanox Build Bot
Reviewed-by: default avatarJim Harris <james.r.harris@intel.com>
Reviewed-by: default avatarShuhei Matsumoto <smatsumoto@nvidia.com>
Reviewed-by: default avatarPaul Luse <paul.e.luse@intel.com>
parent 0fec09fc
Loading
Loading
Loading
Loading
+11 −24
Original line number Diff line number Diff line
/*   SPDX-License-Identifier: BSD-3-Clause
 *   Copyright (c) Intel Corporation.
 *   Copyright (c) 2022 NVIDIA CORPORATION & AFFILIATES.
 *   All rights reserved.
 */

@@ -416,18 +417,11 @@ zone_block_write(struct bdev_zone_block *bdev_node, struct zone_block_io_channel
	}
	pthread_spin_unlock(&zone->lock);

	if (bdev_io->u.bdev.md_buf == NULL) {
		rc = spdk_bdev_writev_blocks(bdev_node->base_desc, ch->base_ch, bdev_io->u.bdev.iovs,
					     bdev_io->u.bdev.iovcnt, lba,
					     bdev_io->u.bdev.num_blocks, _zone_block_complete_write,
					     bdev_io);
	} else {
	rc = spdk_bdev_writev_blocks_with_md(bdev_node->base_desc, ch->base_ch,
					     bdev_io->u.bdev.iovs, bdev_io->u.bdev.iovcnt,
					     bdev_io->u.bdev.md_buf,
					     lba, bdev_io->u.bdev.num_blocks,
					     _zone_block_complete_write, bdev_io);
	}

	return rc;

@@ -469,18 +463,11 @@ zone_block_read(struct bdev_zone_block *bdev_node, struct zone_block_io_channel
		return -EINVAL;
	}

	if (bdev_io->u.bdev.md_buf == NULL) {
		rc = spdk_bdev_readv_blocks(bdev_node->base_desc, ch->base_ch, bdev_io->u.bdev.iovs,
					    bdev_io->u.bdev.iovcnt, lba,
					    len, _zone_block_complete_read,
					    bdev_io);
	} else {
	rc = spdk_bdev_readv_blocks_with_md(bdev_node->base_desc, ch->base_ch,
					    bdev_io->u.bdev.iovs, bdev_io->u.bdev.iovcnt,
					    bdev_io->u.bdev.md_buf,
					    lba, len,
					    _zone_block_complete_read, bdev_io);
	}

	return rc;
}