test/bdevio: add data length check for extended LBA format

When the block size is 520(512 + 8) Bytes, we should check the data
length before the tests.

Change-Id: I785e395c9427460238205a52220e8333eee99ec0
Signed-off-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/2905
Community-CI: Mellanox Build Bot
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
This commit is contained in:
Changpeng Liu 2020-06-15 20:40:59 -04:00 committed by Tomasz Zawadzki
parent c19fcb00d0
commit 45a3cb2be4

View File

@ -419,6 +419,7 @@ static bool
blockdev_io_valid_blocks(struct spdk_bdev *bdev, uint64_t data_length)
{
if (data_length < spdk_bdev_get_block_size(bdev) ||
data_length % spdk_bdev_get_block_size(bdev) ||
data_length / spdk_bdev_get_block_size(bdev) > spdk_bdev_get_num_blocks(bdev)) {
return false;
}