bdev: change blocklen from uint64_t to uint32_t
This is the size of a logical block in bytes; 4 GB is more than plenty. Also allows cleaning up casts to uint32_t in the SCSI translation layer. Change-Id: I3ec2e2f41fd378f1a83f31aac25c46ef780f63e9 Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
This commit is contained in:
parent
60a91f33cc
commit
040c0193f4
@ -107,7 +107,7 @@ struct spdk_bdev {
|
|||||||
char product_name[SPDK_BDEV_MAX_PRODUCT_NAME_LENGTH];
|
char product_name[SPDK_BDEV_MAX_PRODUCT_NAME_LENGTH];
|
||||||
|
|
||||||
/** Size in bytes of a logical block for the backend */
|
/** Size in bytes of a logical block for the backend */
|
||||||
uint64_t blocklen;
|
uint32_t blocklen;
|
||||||
|
|
||||||
/** Number of blocks */
|
/** Number of blocks */
|
||||||
uint64_t blockcnt;
|
uint64_t blockcnt;
|
||||||
|
@ -515,8 +515,7 @@ spdk_bdev_scsi_inquiry(struct spdk_bdev *bdev, struct spdk_scsi_task *task,
|
|||||||
/* support zero length in WRITE SAME */
|
/* support zero length in WRITE SAME */
|
||||||
|
|
||||||
/* MAXIMUM COMPARE AND WRITE LENGTH */
|
/* MAXIMUM COMPARE AND WRITE LENGTH */
|
||||||
blocks = SPDK_WORK_ATS_BLOCK_SIZE /
|
blocks = SPDK_WORK_ATS_BLOCK_SIZE / bdev->blocklen;
|
||||||
(uint32_t)bdev->blocklen;
|
|
||||||
|
|
||||||
if (blocks > 0xff)
|
if (blocks > 0xff)
|
||||||
blocks = 0xff;
|
blocks = 0xff;
|
||||||
@ -525,15 +524,14 @@ spdk_bdev_scsi_inquiry(struct spdk_bdev *bdev, struct spdk_scsi_task *task,
|
|||||||
|
|
||||||
/* force align to 4KB */
|
/* force align to 4KB */
|
||||||
if (bdev->blocklen < 4096) {
|
if (bdev->blocklen < 4096) {
|
||||||
blocks = 4096 / (uint32_t)bdev->blocklen;
|
blocks = 4096 / bdev->blocklen;
|
||||||
/* OPTIMAL TRANSFER LENGTH GRANULARITY */
|
/* OPTIMAL TRANSFER LENGTH GRANULARITY */
|
||||||
to_be16(&data[6], blocks);
|
to_be16(&data[6], blocks);
|
||||||
|
|
||||||
/* MAXIMUM TRANSFER LENGTH */
|
/* MAXIMUM TRANSFER LENGTH */
|
||||||
|
|
||||||
/* OPTIMAL TRANSFER LENGTH */
|
/* OPTIMAL TRANSFER LENGTH */
|
||||||
blocks = SPDK_WORK_BLOCK_SIZE /
|
blocks = SPDK_WORK_BLOCK_SIZE / bdev->blocklen;
|
||||||
(uint32_t)bdev->blocklen;
|
|
||||||
|
|
||||||
to_be32(&data[12], blocks);
|
to_be32(&data[12], blocks);
|
||||||
|
|
||||||
@ -547,8 +545,7 @@ spdk_bdev_scsi_inquiry(struct spdk_bdev *bdev, struct spdk_scsi_task *task,
|
|||||||
/* MAXIMUM TRANSFER LENGTH */
|
/* MAXIMUM TRANSFER LENGTH */
|
||||||
|
|
||||||
/* OPTIMAL TRANSFER LENGTH */
|
/* OPTIMAL TRANSFER LENGTH */
|
||||||
blocks = SPDK_WORK_BLOCK_SIZE /
|
blocks = SPDK_WORK_BLOCK_SIZE / bdev->blocklen;
|
||||||
(uint32_t)bdev->blocklen;
|
|
||||||
to_be32(&data[12], blocks);
|
to_be32(&data[12], blocks);
|
||||||
|
|
||||||
/* MAXIMUM PREFETCH XDREAD XDWRITE TRANSFER LENGTH */
|
/* MAXIMUM PREFETCH XDREAD XDWRITE TRANSFER LENGTH */
|
||||||
@ -1559,7 +1556,7 @@ spdk_bdev_scsi_process_block(struct spdk_bdev *bdev,
|
|||||||
case SPDK_SBC_SAI_READ_CAPACITY_16:
|
case SPDK_SBC_SAI_READ_CAPACITY_16:
|
||||||
spdk_scsi_task_alloc_data(task, 32, &data);
|
spdk_scsi_task_alloc_data(task, 32, &data);
|
||||||
to_be64(&data[0], bdev->blockcnt - 1);
|
to_be64(&data[0], bdev->blockcnt - 1);
|
||||||
to_be32(&data[8], (uint32_t)bdev->blocklen);
|
to_be32(&data[8], bdev->blocklen);
|
||||||
/*
|
/*
|
||||||
* Set the TPE bit to 1 to indicate thin provisioning.
|
* Set the TPE bit to 1 to indicate thin provisioning.
|
||||||
* The position of TPE bit is the 7th bit in 14th byte
|
* The position of TPE bit is the 7th bit in 14th byte
|
||||||
|
Loading…
Reference in New Issue
Block a user