From 99719ef0495d84397a92ba6fa3b77ae719385a13 Mon Sep 17 00:00:00 2001 From: Alexey Marchuk Date: Mon, 7 Feb 2022 18:42:23 +0300 Subject: [PATCH] raid0: Use extended bdev rw API That is a preparation for support of memory domains in bdev_raid Signed-off-by: Alexey Marchuk Change-Id: I3a6e01eccd4d7e4bc197dc5ffe268d42081d41de Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/11429 Community-CI: Broadcom CI Community-CI: Mellanox Build Bot Tested-by: SPDK CI Jenkins Reviewed-by: Jim Harris Reviewed-by: Shuhei Matsumoto Reviewed-by: Tomasz Zawadzki --- module/bdev/raid/raid0.c | 17 ++++++++------- .../lib/bdev/raid/bdev_raid.c/bdev_raid_ut.c | 21 +++++++++++++++++++ 2 files changed, 30 insertions(+), 8 deletions(-) diff --git a/module/bdev/raid/raid0.c b/module/bdev/raid/raid0.c index 90b0761ba..d759a7b8f 100644 --- a/module/bdev/raid/raid0.c +++ b/module/bdev/raid/raid0.c @@ -3,6 +3,7 @@ * * Copyright (c) Intel Corporation. * All rights reserved. + * Copyright (c) 2022, NVIDIA CORPORATION & AFFILIATES. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -132,15 +133,15 @@ raid0_submit_rw_request(struct raid_bdev_io *raid_io) assert(raid_ch->base_channel); base_ch = raid_ch->base_channel[pd_idx]; if (bdev_io->type == SPDK_BDEV_IO_TYPE_READ) { - ret = spdk_bdev_readv_blocks(base_info->desc, base_ch, - bdev_io->u.bdev.iovs, bdev_io->u.bdev.iovcnt, - pd_lba, pd_blocks, raid0_bdev_io_completion, - raid_io); + ret = spdk_bdev_readv_blocks_ext(base_info->desc, base_ch, + bdev_io->u.bdev.iovs, bdev_io->u.bdev.iovcnt, + pd_lba, pd_blocks, raid0_bdev_io_completion, + raid_io, bdev_io->u.bdev.ext_opts); } else if (bdev_io->type == SPDK_BDEV_IO_TYPE_WRITE) { - ret = spdk_bdev_writev_blocks(base_info->desc, base_ch, - bdev_io->u.bdev.iovs, bdev_io->u.bdev.iovcnt, - pd_lba, pd_blocks, raid0_bdev_io_completion, - raid_io); + ret = spdk_bdev_writev_blocks_ext(base_info->desc, base_ch, + bdev_io->u.bdev.iovs, bdev_io->u.bdev.iovcnt, + pd_lba, pd_blocks, raid0_bdev_io_completion, + raid_io, bdev_io->u.bdev.ext_opts); } else { SPDK_ERRLOG("Recvd not supported io type %u\n", bdev_io->type); assert(0); diff --git a/test/unit/lib/bdev/raid/bdev_raid.c/bdev_raid_ut.c b/test/unit/lib/bdev/raid/bdev_raid.c/bdev_raid_ut.c index b30c23f9d..8177f8dec 100644 --- a/test/unit/lib/bdev/raid/bdev_raid.c/bdev_raid_ut.c +++ b/test/unit/lib/bdev/raid/bdev_raid.c/bdev_raid_ut.c @@ -3,6 +3,7 @@ * * Copyright (c) Intel Corporation. * All rights reserved. + * Copyright (c) 2022, NVIDIA CORPORATION & AFFILIATES. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -311,6 +312,16 @@ spdk_bdev_writev_blocks(struct spdk_bdev_desc *desc, struct spdk_io_channel *ch, return g_bdev_io_submit_status; } +int +spdk_bdev_writev_blocks_ext(struct spdk_bdev_desc *desc, struct spdk_io_channel *ch, + struct iovec *iov, int iovcnt, + uint64_t offset_blocks, uint64_t num_blocks, + spdk_bdev_io_completion_cb cb, void *cb_arg, + struct spdk_bdev_ext_io_opts *opts) +{ + return spdk_bdev_writev_blocks(desc, ch, iov, iovcnt, offset_blocks, num_blocks, cb, cb_arg); +} + int spdk_bdev_reset(struct spdk_bdev_desc *desc, struct spdk_io_channel *ch, spdk_bdev_io_completion_cb cb, void *cb_arg) @@ -460,6 +471,16 @@ spdk_bdev_readv_blocks(struct spdk_bdev_desc *desc, struct spdk_io_channel *ch, return g_bdev_io_submit_status; } +int +spdk_bdev_readv_blocks_ext(struct spdk_bdev_desc *desc, struct spdk_io_channel *ch, + struct iovec *iov, int iovcnt, + uint64_t offset_blocks, uint64_t num_blocks, + spdk_bdev_io_completion_cb cb, void *cb_arg, + struct spdk_bdev_ext_io_opts *opts) +{ + return spdk_bdev_readv_blocks(desc, ch, iov, iovcnt, offset_blocks, num_blocks, cb, cb_arg); +} + void spdk_bdev_module_release_bdev(struct spdk_bdev *bdev) {