ut/raid5f: assume raid_io_info is always one stripe
Support for multi-stripe requests is not used anymore so remove it. Change-Id: I8f28817763452674c8a183c640800f3a4b4b3653 Signed-off-by: Artur Paszkiewicz <artur.paszkiewicz@intel.com>
This commit is contained in:
parent
284fd419cb
commit
d0c7517b84
@ -244,8 +244,6 @@ struct raid_io_info {
|
|||||||
void *reference_md_parity;
|
void *reference_md_parity;
|
||||||
size_t parity_md_buf_size;
|
size_t parity_md_buf_size;
|
||||||
enum spdk_bdev_io_status status;
|
enum spdk_bdev_io_status status;
|
||||||
bool failed;
|
|
||||||
int remaining;
|
|
||||||
TAILQ_HEAD(, spdk_bdev_io) bdev_io_queue;
|
TAILQ_HEAD(, spdk_bdev_io) bdev_io_queue;
|
||||||
TAILQ_HEAD(, spdk_bdev_io_wait_entry) bdev_io_wait_queue;
|
TAILQ_HEAD(, spdk_bdev_io_wait_entry) bdev_io_wait_queue;
|
||||||
struct {
|
struct {
|
||||||
@ -285,15 +283,9 @@ raid_bdev_io_completion_cb(struct spdk_bdev_io *bdev_io, bool success, void *cb_
|
|||||||
spdk_bdev_free_io(bdev_io);
|
spdk_bdev_free_io(bdev_io);
|
||||||
|
|
||||||
if (!success) {
|
if (!success) {
|
||||||
io_info->failed = true;
|
io_info->status = SPDK_BDEV_IO_STATUS_FAILED;
|
||||||
}
|
} else {
|
||||||
|
io_info->status = SPDK_BDEV_IO_STATUS_SUCCESS;
|
||||||
if (--io_info->remaining == 0) {
|
|
||||||
if (io_info->failed) {
|
|
||||||
io_info->status = SPDK_BDEV_IO_STATUS_FAILED;
|
|
||||||
} else {
|
|
||||||
io_info->status = SPDK_BDEV_IO_STATUS_SUCCESS;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -341,8 +333,6 @@ get_raid_io(struct raid_io_info *io_info)
|
|||||||
bdev_io->u.bdev.iovcnt = 1;
|
bdev_io->u.bdev.iovcnt = 1;
|
||||||
bdev_io->iov.iov_len = io_info->num_blocks * blocklen;
|
bdev_io->iov.iov_len = io_info->num_blocks * blocklen;
|
||||||
|
|
||||||
io_info->remaining++;
|
|
||||||
|
|
||||||
return raid_io;
|
return raid_io;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -432,7 +422,6 @@ spdk_bdev_writev_blocks_with_md(struct spdk_bdev_desc *desc, struct spdk_io_chan
|
|||||||
struct test_raid_bdev_io *test_raid_bdev_io;
|
struct test_raid_bdev_io *test_raid_bdev_io;
|
||||||
struct raid_io_info *io_info;
|
struct raid_io_info *io_info;
|
||||||
struct raid_bdev *raid_bdev;
|
struct raid_bdev *raid_bdev;
|
||||||
uint64_t stripe_idx_off;
|
|
||||||
uint8_t data_chunk_idx;
|
uint8_t data_chunk_idx;
|
||||||
uint64_t data_offset;
|
uint64_t data_offset;
|
||||||
void *dest_buf, *dest_md_buf;
|
void *dest_buf, *dest_md_buf;
|
||||||
@ -443,30 +432,20 @@ spdk_bdev_writev_blocks_with_md(struct spdk_bdev_desc *desc, struct spdk_io_chan
|
|||||||
stripe_req = raid5f_chunk_stripe_req(chunk);
|
stripe_req = raid5f_chunk_stripe_req(chunk);
|
||||||
test_raid_bdev_io = (struct test_raid_bdev_io *)spdk_bdev_io_from_ctx(stripe_req->raid_io);
|
test_raid_bdev_io = (struct test_raid_bdev_io *)spdk_bdev_io_from_ctx(stripe_req->raid_io);
|
||||||
io_info = test_raid_bdev_io->io_info;
|
io_info = test_raid_bdev_io->io_info;
|
||||||
|
|
||||||
raid_bdev = io_info->r5f_info->raid_bdev;
|
raid_bdev = io_info->r5f_info->raid_bdev;
|
||||||
|
|
||||||
stripe_idx_off = offset_blocks / raid_bdev->strip_size -
|
|
||||||
io_info->offset_blocks / io_info->r5f_info->stripe_blocks;
|
|
||||||
|
|
||||||
if (chunk == stripe_req->parity_chunk) {
|
if (chunk == stripe_req->parity_chunk) {
|
||||||
if (io_info->parity_buf == NULL) {
|
if (io_info->parity_buf == NULL) {
|
||||||
goto submit;
|
goto submit;
|
||||||
}
|
}
|
||||||
data_offset = stripe_idx_off * raid_bdev->strip_size_kb * 1024;
|
dest_buf = io_info->parity_buf;
|
||||||
dest_buf = io_info->parity_buf + data_offset;
|
|
||||||
|
|
||||||
if (md_buf != NULL) {
|
if (md_buf != NULL) {
|
||||||
data_offset = DATA_OFFSET_TO_MD_OFFSET(raid_bdev, data_offset);
|
dest_md_buf = io_info->parity_md_buf;
|
||||||
dest_md_buf = io_info->parity_md_buf + data_offset;
|
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
data_chunk_idx = chunk < stripe_req->parity_chunk ? chunk->index : chunk->index - 1;
|
data_chunk_idx = chunk < stripe_req->parity_chunk ? chunk->index : chunk->index - 1;
|
||||||
data_offset = (stripe_idx_off * io_info->r5f_info->stripe_blocks +
|
data_offset = data_chunk_idx * raid_bdev->strip_size * raid_bdev->bdev.blocklen;
|
||||||
data_chunk_idx * raid_bdev->strip_size) *
|
|
||||||
raid_bdev->bdev.blocklen;
|
|
||||||
dest_buf = test_raid_bdev_io->buf + data_offset;
|
dest_buf = test_raid_bdev_io->buf + data_offset;
|
||||||
|
|
||||||
if (md_buf != NULL) {
|
if (md_buf != NULL) {
|
||||||
data_offset = DATA_OFFSET_TO_MD_OFFSET(raid_bdev, data_offset);
|
data_offset = DATA_OFFSET_TO_MD_OFFSET(raid_bdev, data_offset);
|
||||||
dest_md_buf = test_raid_bdev_io->buf_md + data_offset;
|
dest_md_buf = test_raid_bdev_io->buf_md + data_offset;
|
||||||
@ -683,30 +662,24 @@ io_info_setup_parity(struct raid_io_info *io_info)
|
|||||||
struct raid5f_info *r5f_info = io_info->r5f_info;
|
struct raid5f_info *r5f_info = io_info->r5f_info;
|
||||||
struct raid_bdev *raid_bdev = r5f_info->raid_bdev;
|
struct raid_bdev *raid_bdev = r5f_info->raid_bdev;
|
||||||
uint32_t blocklen = raid_bdev->bdev.blocklen;
|
uint32_t blocklen = raid_bdev->bdev.blocklen;
|
||||||
uint64_t num_stripes = io_info->num_blocks / r5f_info->stripe_blocks;
|
|
||||||
size_t strip_len = raid_bdev->strip_size * blocklen;
|
size_t strip_len = raid_bdev->strip_size * blocklen;
|
||||||
size_t strip_md_len = raid_bdev->strip_size * raid_bdev->bdev.md_len;
|
size_t strip_md_len = raid_bdev->strip_size * raid_bdev->bdev.md_len;
|
||||||
void *src = io_info->src_buf;
|
void *src = io_info->src_buf;
|
||||||
void *dest;
|
unsigned i;
|
||||||
unsigned i, j;
|
|
||||||
|
|
||||||
io_info->parity_buf_size = num_stripes * strip_len;
|
io_info->parity_buf_size = strip_len;
|
||||||
io_info->parity_buf = calloc(1, io_info->parity_buf_size);
|
io_info->parity_buf = calloc(1, io_info->parity_buf_size);
|
||||||
SPDK_CU_ASSERT_FATAL(io_info->parity_buf != NULL);
|
SPDK_CU_ASSERT_FATAL(io_info->parity_buf != NULL);
|
||||||
|
|
||||||
io_info->reference_parity = calloc(1, io_info->parity_buf_size);
|
io_info->reference_parity = calloc(1, io_info->parity_buf_size);
|
||||||
SPDK_CU_ASSERT_FATAL(io_info->reference_parity != NULL);
|
SPDK_CU_ASSERT_FATAL(io_info->reference_parity != NULL);
|
||||||
|
|
||||||
dest = io_info->reference_parity;
|
for (i = 0; i < raid5f_stripe_data_chunks_num(raid_bdev); i++) {
|
||||||
for (i = 0; i < num_stripes; i++) {
|
xor_block(io_info->reference_parity, src, strip_len);
|
||||||
for (j = 0; j < raid5f_stripe_data_chunks_num(raid_bdev); j++) {
|
src += strip_len;
|
||||||
xor_block(dest, src, strip_len);
|
|
||||||
src += strip_len;
|
|
||||||
}
|
|
||||||
dest += strip_len;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
io_info->parity_md_buf_size = num_stripes * strip_md_len;
|
io_info->parity_md_buf_size = strip_md_len;
|
||||||
io_info->parity_md_buf = calloc(1, io_info->parity_md_buf_size);
|
io_info->parity_md_buf = calloc(1, io_info->parity_md_buf_size);
|
||||||
SPDK_CU_ASSERT_FATAL(io_info->parity_md_buf != NULL);
|
SPDK_CU_ASSERT_FATAL(io_info->parity_md_buf != NULL);
|
||||||
|
|
||||||
@ -714,13 +687,9 @@ io_info_setup_parity(struct raid_io_info *io_info)
|
|||||||
SPDK_CU_ASSERT_FATAL(io_info->reference_md_parity != NULL);
|
SPDK_CU_ASSERT_FATAL(io_info->reference_md_parity != NULL);
|
||||||
|
|
||||||
src = io_info->src_md_buf;
|
src = io_info->src_md_buf;
|
||||||
dest = io_info->reference_md_parity;
|
for (i = 0; i < raid5f_stripe_data_chunks_num(raid_bdev); i++) {
|
||||||
for (i = 0; i < num_stripes; i++) {
|
xor_block(io_info->reference_md_parity, src, strip_md_len);
|
||||||
for (j = 0; j < raid5f_stripe_data_chunks_num(raid_bdev); j++) {
|
src += strip_md_len;
|
||||||
xor_block(dest, src, strip_md_len);
|
|
||||||
src += strip_md_len;
|
|
||||||
}
|
|
||||||
dest += strip_md_len;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user