bdev: rename need_aligned_buffer to required_alignment

This patch changes the name of the field. Following patches
will introduce logic that will guarantee that buffers
provided to bdev module will be aligned to value
specified in this field


Signed-off-by: Piotr Pelplinski <piotr.pelplinski@intel.com>
Change-Id: I5329b9fe26ef2417bc7beae86518cc643b263f97

Reviewed-on: https://review.gerrithub.io/430782
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Chandler-Test-Pool: SPDK Automated Test System <sys_sgsw@intel.com>
This commit is contained in:
Piotr Pelplinski 2018-10-24 09:02:31 +02:00 committed by Jim Harris
parent bf6a6019b2
commit 85b805f72e
7 changed files with 12 additions and 14 deletions

View File

@ -261,10 +261,13 @@ struct spdk_bdev {
uint64_t blockcnt;
/**
* This is used to make sure buffers are sector aligned.
* This causes double buffering on writes.
* Specifies an alignment requirement for data buffers associated with an spdk_bdev_io.
* 0 = no alignment requirement
* >0 = alignment requirement is 2 ^ required_alignment.
* bdev layer will automatically double buffer any spdk_bdev_io that violates this
* alignment, before the spdk_bdev_io is submitted to the bdev module.
*/
bool need_aligned_buffer;
uint8_t required_alignment;
/**
* Specifies whether the optimal_io_boundary is mandatory or

View File

@ -549,7 +549,6 @@ create_aio_disk(const char *name, const char *filename, uint32_t block_size)
fdisk->disk.product_name = "AIO disk";
fdisk->disk.module = &aio_if;
fdisk->disk.need_aligned_buffer = 1;
fdisk->disk.write_cache = 1;
detected_block_size = spdk_fd_get_blocklen(fdisk->fd);
@ -586,6 +585,7 @@ create_aio_disk(const char *name, const char *filename, uint32_t block_size)
}
fdisk->disk.blocklen = block_size;
fdisk->disk.required_alignment = spdk_u32log2(block_size);
if (disk_size % fdisk->disk.blocklen != 0) {
SPDK_ERRLOG("Disk size %" PRIu64 " is not a multiple of block size %" PRIu32 "\n",

View File

@ -2034,12 +2034,7 @@ spdk_bdev_get_qos_rate_limits(struct spdk_bdev *bdev, uint64_t *limits)
size_t
spdk_bdev_get_buf_align(const struct spdk_bdev *bdev)
{
/* TODO: push this logic down to the bdev modules */
if (bdev->need_aligned_buffer) {
return bdev->blocklen;
}
return 1;
return 1 << bdev->required_alignment;
}
uint32_t

View File

@ -1444,7 +1444,7 @@ vbdev_crypto_claim(struct spdk_bdev *bdev)
vbdev->crypto_bdev.product_name = "crypto";
vbdev->crypto_bdev.write_cache = bdev->write_cache;
vbdev->crypto_bdev.need_aligned_buffer = bdev->need_aligned_buffer;
vbdev->crypto_bdev.required_alignment = bdev->required_alignment;
/* Note: CRYPTO_MAX_IO is in units of bytes, optimal_io_boundary is
* in units of blocks.
*/

View File

@ -957,7 +957,7 @@ _create_lvol_disk(struct spdk_lvol *lvol, bool destroy)
assert((total_size % bdev->blocklen) == 0);
bdev->blockcnt = total_size / bdev->blocklen;
bdev->uuid = lvol->uuid;
bdev->need_aligned_buffer = lvs_bdev->bdev->need_aligned_buffer;
bdev->required_alignment = lvs_bdev->bdev->required_alignment;
bdev->split_on_optimal_io_boundary = true;
bdev->optimal_io_boundary = spdk_bs_get_cluster_size(lvol->lvol_store->blobstore) / bdev->blocklen;

View File

@ -327,7 +327,7 @@ spdk_bdev_part_construct(struct spdk_bdev_part *part, struct spdk_bdev_part_base
part->internal.offset_blocks = offset_blocks;
part->internal.bdev.write_cache = base->bdev->write_cache;
part->internal.bdev.need_aligned_buffer = base->bdev->need_aligned_buffer;
part->internal.bdev.required_alignment = base->bdev->required_alignment;
part->internal.bdev.ctxt = part;
part->internal.bdev.module = base->module;
part->internal.bdev.fn_table = base->fn_table;

View File

@ -550,7 +550,7 @@ vbdev_passthru_register(struct spdk_bdev *bdev)
/* Copy some properties from the underlying base bdev. */
pt_node->pt_bdev.write_cache = bdev->write_cache;
pt_node->pt_bdev.need_aligned_buffer = bdev->need_aligned_buffer;
pt_node->pt_bdev.required_alignment = bdev->required_alignment;
pt_node->pt_bdev.optimal_io_boundary = bdev->optimal_io_boundary;
pt_node->pt_bdev.blocklen = bdev->blocklen;
pt_node->pt_bdev.blockcnt = bdev->blockcnt;