[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PULL 10/15] vvfat: Replace bdrv_{read, write}() with bdrv_
From: |
Kevin Wolf |
Subject: |
[Qemu-devel] [PULL 10/15] vvfat: Replace bdrv_{read, write}() with bdrv_{pread, pwrite}() |
Date: |
Fri, 10 May 2019 18:16:09 +0200 |
From: Alberto Garcia <address@hidden>
There's only a couple of bdrv_read() and bdrv_write() calls left in
the vvfat code, and they can be trivially replaced with the byte-based
bdrv_pread() and bdrv_pwrite().
Signed-off-by: Alberto Garcia <address@hidden>
Signed-off-by: Kevin Wolf <address@hidden>
---
block/vvfat.c | 12 +++++++-----
1 file changed, 7 insertions(+), 5 deletions(-)
diff --git a/block/vvfat.c b/block/vvfat.c
index 5f66787890..253cc716dd 100644
--- a/block/vvfat.c
+++ b/block/vvfat.c
@@ -1494,8 +1494,8 @@ static int vvfat_read(BlockDriverState *bs, int64_t
sector_num,
DLOG(fprintf(stderr, "sectors %" PRId64 "+%" PRId64
" allocated\n", sector_num,
n >> BDRV_SECTOR_BITS));
- if (bdrv_read(s->qcow, sector_num, buf + i * 0x200,
- n >> BDRV_SECTOR_BITS)) {
+ if (bdrv_pread(s->qcow, sector_num * BDRV_SECTOR_SIZE,
+ buf + i * 0x200, n) < 0) {
return -1;
}
i += (n >> BDRV_SECTOR_BITS) - 1;
@@ -1983,8 +1983,9 @@ static uint32_t
get_cluster_count_for_direntry(BDRVVVFATState* s,
if (res) {
return -1;
}
- res = bdrv_write(s->qcow, offset, s->cluster_buffer,
1);
- if (res) {
+ res = bdrv_pwrite(s->qcow, offset * BDRV_SECTOR_SIZE,
+ s->cluster_buffer, BDRV_SECTOR_SIZE);
+ if (res < 0) {
return -2;
}
}
@@ -3050,7 +3051,8 @@ DLOG(checkpoint());
* Use qcow backend. Commit later.
*/
DLOG(fprintf(stderr, "Write to qcow backend: %d + %d\n", (int)sector_num,
nb_sectors));
- ret = bdrv_write(s->qcow, sector_num, buf, nb_sectors);
+ ret = bdrv_pwrite(s->qcow, sector_num * BDRV_SECTOR_SIZE, buf,
+ nb_sectors * BDRV_SECTOR_SIZE);
if (ret < 0) {
fprintf(stderr, "Error writing to qcow backend\n");
return ret;
--
2.20.1
- [Qemu-devel] [PULL 01/15] block: remove bs from lists before closing, (continued)
- [Qemu-devel] [PULL 01/15] block: remove bs from lists before closing, Kevin Wolf, 2019/05/10
- [Qemu-devel] [PULL 02/15] MAINTAINERS: Downgrade status of block sections without "M:" to "Odd Fixes", Kevin Wolf, 2019/05/10
- [Qemu-devel] [PULL 03/15] MAINTAINERS: Add an entry for the Parallel NOR Flash devices, Kevin Wolf, 2019/05/10
- [Qemu-devel] [PULL 04/15] qemu-iotests: Fix cleanup for 192, Kevin Wolf, 2019/05/10
- [Qemu-devel] [PULL 05/15] blockjob: Fix coroutine thread after AioContext change, Kevin Wolf, 2019/05/10
- [Qemu-devel] [PULL 06/15] test-block-iothread: Job coroutine thread after AioContext switch, Kevin Wolf, 2019/05/10
- [Qemu-devel] [PULL 07/15] qemu-img: Use IEC binary prefixes for size constants, Kevin Wolf, 2019/05/10
- [Qemu-devel] [PULL 08/15] qcow2: Replace bdrv_write() with bdrv_pwrite(), Kevin Wolf, 2019/05/10
- [Qemu-devel] [PULL 09/15] vdi: Replace bdrv_{read, write}() with bdrv_{pread, pwrite}(), Kevin Wolf, 2019/05/10
- [Qemu-devel] [PULL 11/15] block: Remove bdrv_read() and bdrv_write(), Kevin Wolf, 2019/05/10
- [Qemu-devel] [PULL 10/15] vvfat: Replace bdrv_{read, write}() with bdrv_{pread, pwrite}(),
Kevin Wolf <=
- [Qemu-devel] [PULL 12/15] qcow2: Remove BDRVQcow2State.cluster_sectors, Kevin Wolf, 2019/05/10
- [Qemu-devel] [PULL 14/15] qemu-img: Use zero writes after source backing EOF, Kevin Wolf, 2019/05/10
- [Qemu-devel] [PULL 13/15] qemu-img: Allow rebase with no input base, Kevin Wolf, 2019/05/10
- [Qemu-devel] [PULL 15/15] iotests: Add test for rebase without input base, Kevin Wolf, 2019/05/10
- Re: [Qemu-devel] [PULL 00/15] Block layer patches, Peter Maydell, 2019/05/13