aboutsummaryrefslogtreecommitdiff
path: root/block
diff options
context:
space:
mode:
authorAlberto Faria <afaria@redhat.com>2022-07-05 17:15:10 +0100
committerHanna Reitz <hreitz@redhat.com>2022-07-12 12:14:56 +0200
commit3b35d4542c8537a9269f6372df531ced6c960084 (patch)
tree0a59e4957fa7193db852233956f77515e37a2c41 /block
parentbf5b16fa401633475d21d69c66532f5b29e8433d (diff)
block: Add a 'flags' param to blk_pread()
For consistency with other I/O functions, and in preparation to implement it using generated_co_wrapper. Callers were updated using this Coccinelle script: @@ expression blk, offset, buf, bytes; @@ - blk_pread(blk, offset, buf, bytes) + blk_pread(blk, offset, buf, bytes, 0) It had no effect on hw/block/nand.c, presumably due to the #if, so that file was updated manually. Overly-long lines were then fixed by hand. Signed-off-by: Alberto Faria <afaria@redhat.com> Reviewed-by: Paolo Bonzini <pbonzini@redhat.com> Reviewed-by: Greg Kurz <groug@kaod.org> Reviewed-by: Hanna Reitz <hreitz@redhat.com> Message-Id: <20220705161527.1054072-3-afaria@redhat.com> Signed-off-by: Hanna Reitz <hreitz@redhat.com>
Diffstat (limited to 'block')
-rw-r--r--block/block-backend.c5
-rw-r--r--block/commit.c2
-rw-r--r--block/export/fuse.c2
3 files changed, 5 insertions, 4 deletions
diff --git a/block/block-backend.c b/block/block-backend.c
index 4c5e130615..bdde90d235 100644
--- a/block/block-backend.c
+++ b/block/block-backend.c
@@ -1563,14 +1563,15 @@ BlockAIOCB *blk_aio_pwrite_zeroes(BlockBackend *blk, int64_t offset,
flags | BDRV_REQ_ZERO_WRITE, cb, opaque);
}
-int blk_pread(BlockBackend *blk, int64_t offset, void *buf, int bytes)
+int blk_pread(BlockBackend *blk, int64_t offset, void *buf, int bytes,
+ BdrvRequestFlags flags)
{
int ret;
QEMUIOVector qiov = QEMU_IOVEC_INIT_BUF(qiov, buf, bytes);
IO_OR_GS_CODE();
blk_inc_in_flight(blk);
- ret = blk_do_preadv(blk, offset, bytes, &qiov, 0);
+ ret = blk_do_preadv(blk, offset, bytes, &qiov, flags);
blk_dec_in_flight(blk);
return ret;
diff --git a/block/commit.c b/block/commit.c
index 851d1c557a..e5b3ad08da 100644
--- a/block/commit.c
+++ b/block/commit.c
@@ -527,7 +527,7 @@ int bdrv_commit(BlockDriverState *bs)
goto ro_cleanup;
}
if (ret) {
- ret = blk_pread(src, offset, buf, n);
+ ret = blk_pread(src, offset, buf, n, 0);
if (ret < 0) {
goto ro_cleanup;
}
diff --git a/block/export/fuse.c b/block/export/fuse.c
index e80b24a867..dcf8f225f3 100644
--- a/block/export/fuse.c
+++ b/block/export/fuse.c
@@ -554,7 +554,7 @@ static void fuse_read(fuse_req_t req, fuse_ino_t inode,
return;
}
- ret = blk_pread(exp->common.blk, offset, buf, size);
+ ret = blk_pread(exp->common.blk, offset, buf, size, 0);
if (ret >= 0) {
fuse_reply_buf(req, buf, size);
} else {