bdev: add bdev_unmap_should_split() function
Change-Id: I2680eef93da13d8378527349cdc5ba36859f89dc Signed-off-by: Changpeng Liu <changpeng.liu@intel.com> Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/7517 Community-CI: Broadcom CI Community-CI: Mellanox Build Bot Tested-by: SPDK CI Jenkins <sys_sgci@intel.com> Reviewed-by: Ben Walker <benjamin.walker@intel.com> Reviewed-by: Jim Harris <james.r.harris@intel.com> Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
This commit is contained in:
parent
d4d5e20d29
commit
4f1530c9eb
@ -2001,6 +2001,22 @@ bdev_rw_should_split(struct spdk_bdev_io *bdev_io)
|
||||
return false;
|
||||
}
|
||||
|
||||
static bool
|
||||
bdev_unmap_should_split(struct spdk_bdev_io *bdev_io)
|
||||
{
|
||||
uint32_t num_unmap_segments;
|
||||
|
||||
if (!bdev_io->bdev->max_unmap || !bdev_io->bdev->max_unmap_segments) {
|
||||
return false;
|
||||
}
|
||||
num_unmap_segments = spdk_divide_round_up(bdev_io->u.bdev.num_blocks, bdev_io->bdev->max_unmap);
|
||||
if (num_unmap_segments > bdev_io->bdev->max_unmap_segments) {
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
static bool
|
||||
bdev_io_should_split(struct spdk_bdev_io *bdev_io)
|
||||
{
|
||||
@ -2008,6 +2024,8 @@ bdev_io_should_split(struct spdk_bdev_io *bdev_io)
|
||||
case SPDK_BDEV_IO_TYPE_READ:
|
||||
case SPDK_BDEV_IO_TYPE_WRITE:
|
||||
return bdev_rw_should_split(bdev_io);
|
||||
case SPDK_BDEV_IO_TYPE_UNMAP:
|
||||
return bdev_unmap_should_split(bdev_io);
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user