bdev: add compare fall-back separate md support
If the bdev does not natively support compare we use the fall-back which performs a read instead of a compare operation. We then compare the results of the read with the buffer provided by the user. In case the bdev has metadata, there are two options: 1) md is interleaved -> the md will be part of the data buffer allocated for the read and compared accordingly 2) md is separate -> currently we do not compare the metadata but just ignore it. This patch fixes 2) by comparing the md buffer after the read is done. Signed-off-by: Jonas Pfefferle <pepperjo@japf.ch> Change-Id: I1018b8c02540bffcba69408eb283bdc8f06bb747 Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/14132 Tested-by: SPDK CI Jenkins <sys_sgci@intel.com> Community-CI: Mellanox Build Bot Reviewed-by: Aleksey Marchuk <alexeymar@nvidia.com> Reviewed-by: Ben Walker <benjamin.walker@intel.com> Reviewed-by: Jim Harris <james.r.harris@intel.com>
This commit is contained in:
parent
442e13c01f
commit
9e50d53b1a
@ -4557,6 +4557,7 @@ static void
|
||||
bdev_compare_do_read_done(struct spdk_bdev_io *bdev_io, bool success, void *cb_arg)
|
||||
{
|
||||
struct spdk_bdev_io *parent_io = cb_arg;
|
||||
struct spdk_bdev *bdev = parent_io->bdev;
|
||||
uint8_t *read_buf = bdev_io->u.bdev.iovs[0].iov_base;
|
||||
int i, rc = 0;
|
||||
|
||||
@ -4577,6 +4578,12 @@ bdev_compare_do_read_done(struct spdk_bdev_io *bdev_io, bool success, void *cb_a
|
||||
read_buf += parent_io->u.bdev.iovs[i].iov_len;
|
||||
}
|
||||
|
||||
if (rc == 0 && parent_io->u.bdev.md_buf && spdk_bdev_is_md_separate(bdev)) {
|
||||
rc = memcmp(bdev_io->u.bdev.md_buf,
|
||||
parent_io->u.bdev.md_buf,
|
||||
spdk_bdev_get_md_size(bdev));
|
||||
}
|
||||
|
||||
spdk_bdev_free_io(bdev_io);
|
||||
|
||||
if (rc == 0) {
|
||||
|
Loading…
Reference in New Issue
Block a user