From: dennis.wu Date: Sat, 21 May 2022 15:27:35 +0000 (+0800) Subject: pmemblk.c: fix one logic bug - read always with write X-Git-Tag: test-tag-2022-08-09~54^2 X-Git-Url: https://git.kernel.dk/?a=commitdiff_plain;h=b60ccee9a1f0ce878c7270938143a29e6d1eb108;p=fio.git pmemblk.c: fix one logic bug - read always with write logic issue,if read success and return 0, then pmemblk_write called as well: if (io_u->ddir == DDIR_READ && 0 != pmemblk_read(pmb->pmb_pool, buf, off)) { io_u->error = errno; break; } else if (0 != pmemblk_write(pmb->pmb_pool, buf, off)) { io_u->error = errno; break; } Signed-off-by: dennis.wu --- diff --git a/engines/pmemblk.c b/engines/pmemblk.c index fc6358e8..849d8a15 100644 --- a/engines/pmemblk.c +++ b/engines/pmemblk.c @@ -375,10 +375,11 @@ static enum fio_q_status fio_pmemblk_queue(struct thread_data *td, off /= pmb->pmb_bsize; len /= pmb->pmb_bsize; while (0 < len) { - if (io_u->ddir == DDIR_READ && - 0 != pmemblk_read(pmb->pmb_pool, buf, off)) { - io_u->error = errno; - break; + if (io_u->ddir == DDIR_READ) { + if (0 != pmemblk_read(pmb->pmb_pool, buf, off)) { + io_u->error = errno; + break; + } } else if (0 != pmemblk_write(pmb->pmb_pool, buf, off)) { io_u->error = errno; break;