diff options
author | Manos Pitsidianakis <el13635@mail.ntua.gr> | 2017-06-09 13:18:08 +0300 |
---|---|---|
committer | Max Reitz <mreitz@redhat.com> | 2017-06-26 14:54:46 +0200 |
commit | f5a5ca796932d04cb2a1cb9382a55f72795b3e06 (patch) | |
tree | 4a34a4deddf9ab05de27ea83df28bcc03498fdc4 /block/io.c | |
parent | c5f1ad429cdf26023cf331075a7d327708e3db6d (diff) |
block: change variable names in BlockDriverState
Change the 'int count' parameter in *pwrite_zeros, *pdiscard related
functions (and some others) to 'int bytes', as they both refer to bytes.
This helps with code legibility.
Signed-off-by: Manos Pitsidianakis <el13635@mail.ntua.gr>
Message-id: 20170609101808.13506-1-el13635@mail.ntua.gr
Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
Signed-off-by: Max Reitz <mreitz@redhat.com>
Diffstat (limited to 'block/io.c')
-rw-r--r-- | block/io.c | 48 |
1 files changed, 24 insertions, 24 deletions
diff --git a/block/io.c b/block/io.c index 132bcbbd7a..9bba730a7e 100644 --- a/block/io.c +++ b/block/io.c @@ -35,7 +35,7 @@ #define NOT_DONE 0x7fffffff /* used while emulated sync operation in progress */ static int coroutine_fn bdrv_co_do_pwrite_zeroes(BlockDriverState *bs, - int64_t offset, int count, BdrvRequestFlags flags); + int64_t offset, int bytes, BdrvRequestFlags flags); void bdrv_parent_drained_begin(BlockDriverState *bs) { @@ -666,12 +666,12 @@ int bdrv_write(BdrvChild *child, int64_t sector_num, } int bdrv_pwrite_zeroes(BdrvChild *child, int64_t offset, - int count, BdrvRequestFlags flags) + int bytes, BdrvRequestFlags flags) { QEMUIOVector qiov; struct iovec iov = { .iov_base = NULL, - .iov_len = count, + .iov_len = bytes, }; qemu_iovec_init_external(&qiov, &iov, 1); @@ -1212,7 +1212,7 @@ int coroutine_fn bdrv_co_readv(BdrvChild *child, int64_t sector_num, #define MAX_WRITE_ZEROES_BOUNCE_BUFFER (32768 << BDRV_SECTOR_BITS) static int coroutine_fn bdrv_co_do_pwrite_zeroes(BlockDriverState *bs, - int64_t offset, int count, BdrvRequestFlags flags) + int64_t offset, int bytes, BdrvRequestFlags flags) { BlockDriver *drv = bs->drv; QEMUIOVector qiov; @@ -1230,12 +1230,12 @@ static int coroutine_fn bdrv_co_do_pwrite_zeroes(BlockDriverState *bs, assert(alignment % bs->bl.request_alignment == 0); head = offset % alignment; - tail = (offset + count) % alignment; + tail = (offset + bytes) % alignment; max_write_zeroes = QEMU_ALIGN_DOWN(max_write_zeroes, alignment); assert(max_write_zeroes >= bs->bl.request_alignment); - while (count > 0 && !ret) { - int num = count; + while (bytes > 0 && !ret) { + int num = bytes; /* Align request. Block drivers can expect the "bulk" of the request * to be aligned, and that unaligned requests do not cross cluster @@ -1245,7 +1245,7 @@ static int coroutine_fn bdrv_co_do_pwrite_zeroes(BlockDriverState *bs, /* Make a small request up to the first aligned sector. For * convenience, limit this request to max_transfer even if * we don't need to fall back to writes. */ - num = MIN(MIN(count, max_transfer), alignment - head); + num = MIN(MIN(bytes, max_transfer), alignment - head); head = (head + num) % alignment; assert(num < max_write_zeroes); } else if (tail && num > alignment) { @@ -1306,7 +1306,7 @@ static int coroutine_fn bdrv_co_do_pwrite_zeroes(BlockDriverState *bs, } offset += num; - count -= num; + bytes -= num; } fail: @@ -1658,15 +1658,15 @@ int coroutine_fn bdrv_co_writev(BdrvChild *child, int64_t sector_num, } int coroutine_fn bdrv_co_pwrite_zeroes(BdrvChild *child, int64_t offset, - int count, BdrvRequestFlags flags) + int bytes, BdrvRequestFlags flags) { - trace_bdrv_co_pwrite_zeroes(child->bs, offset, count, flags); + trace_bdrv_co_pwrite_zeroes(child->bs, offset, bytes, flags); if (!(child->bs->open_flags & BDRV_O_UNMAP)) { flags &= ~BDRV_REQ_MAY_UNMAP; } - return bdrv_co_pwritev(child, offset, count, NULL, + return bdrv_co_pwritev(child, offset, bytes, NULL, BDRV_REQ_ZERO_WRITE | flags); } @@ -2248,18 +2248,18 @@ int bdrv_flush(BlockDriverState *bs) typedef struct DiscardCo { BlockDriverState *bs; int64_t offset; - int count; + int bytes; int ret; } DiscardCo; static void coroutine_fn bdrv_pdiscard_co_entry(void *opaque) { DiscardCo *rwco = opaque; - rwco->ret = bdrv_co_pdiscard(rwco->bs, rwco->offset, rwco->count); + rwco->ret = bdrv_co_pdiscard(rwco->bs, rwco->offset, rwco->bytes); } int coroutine_fn bdrv_co_pdiscard(BlockDriverState *bs, int64_t offset, - int count) + int bytes) { BdrvTrackedRequest req; int max_pdiscard, ret; @@ -2269,7 +2269,7 @@ int coroutine_fn bdrv_co_pdiscard(BlockDriverState *bs, int64_t offset, return -ENOMEDIUM; } - ret = bdrv_check_byte_request(bs, offset, count); + ret = bdrv_check_byte_request(bs, offset, bytes); if (ret < 0) { return ret; } else if (bs->read_only) { @@ -2294,10 +2294,10 @@ int coroutine_fn bdrv_co_pdiscard(BlockDriverState *bs, int64_t offset, align = MAX(bs->bl.pdiscard_alignment, bs->bl.request_alignment); assert(align % bs->bl.request_alignment == 0); head = offset % align; - tail = (offset + count) % align; + tail = (offset + bytes) % align; bdrv_inc_in_flight(bs); - tracked_request_begin(&req, bs, offset, count, BDRV_TRACKED_DISCARD); + tracked_request_begin(&req, bs, offset, bytes, BDRV_TRACKED_DISCARD); ret = notifier_with_return_list_notify(&bs->before_write_notifiers, &req); if (ret < 0) { @@ -2308,13 +2308,13 @@ int coroutine_fn bdrv_co_pdiscard(BlockDriverState *bs, int64_t offset, align); assert(max_pdiscard >= bs->bl.request_alignment); - while (count > 0) { + while (bytes > 0) { int ret; - int num = count; + int num = bytes; if (head) { /* Make small requests to get to alignment boundaries. */ - num = MIN(count, align - head); + num = MIN(bytes, align - head); if (!QEMU_IS_ALIGNED(num, bs->bl.request_alignment)) { num %= bs->bl.request_alignment; } @@ -2358,7 +2358,7 @@ int coroutine_fn bdrv_co_pdiscard(BlockDriverState *bs, int64_t offset, } offset += num; - count -= num; + bytes -= num; } ret = 0; out: @@ -2370,13 +2370,13 @@ out: return ret; } -int bdrv_pdiscard(BlockDriverState *bs, int64_t offset, int count) +int bdrv_pdiscard(BlockDriverState *bs, int64_t offset, int bytes) { Coroutine *co; DiscardCo rwco = { .bs = bs, .offset = offset, - .count = count, + .bytes = bytes, .ret = NOT_DONE, }; |