From: Kevin Wolf <kwolf@redhat.com>
To: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
Cc: fam@euphon.net, berto@igalia.com, stefanha@redhat.com,
qemu-block@nongnu.org, dillaman@redhat.com,
pavel.dovgaluk@ispras.ru, sw@weilnetz.de, pl@kamp.de,
qemu-devel@nongnu.org, mreitz@redhat.com, jsnow@redhat.com,
ronniesahlberg@gmail.com, den@openvz.org, pbonzini@redhat.com,
ari@tuxera.com
Subject: Re: [PATCH 1/3] block: use int64_t as bytes type in tracked requests
Date: Thu, 23 Apr 2020 17:25:35 +0200 [thread overview]
Message-ID: <20200423152535.GC23654@linux.fritz.box> (raw)
In-Reply-To: <20200330141818.31294-2-vsementsov@virtuozzo.com>
Am 30.03.2020 um 16:18 hat Vladimir Sementsov-Ogievskiy geschrieben:
> We are generally moving to int64_t for both offset and bytes paramaters
> on all io paths. Convert tracked requests now.
>
> Signed-off-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
> ---
> include/block/block_int.h | 4 ++--
> block/io.c | 11 ++++++-----
> 2 files changed, 8 insertions(+), 7 deletions(-)
>
> diff --git a/include/block/block_int.h b/include/block/block_int.h
> index 4c3587ea19..c8daba608b 100644
> --- a/include/block/block_int.h
> +++ b/include/block/block_int.h
> @@ -70,12 +70,12 @@ enum BdrvTrackedRequestType {
> typedef struct BdrvTrackedRequest {
> BlockDriverState *bs;
> int64_t offset;
> - uint64_t bytes;
> + int64_t bytes;
> enum BdrvTrackedRequestType type;
>
> bool serialising;
> int64_t overlap_offset;
> - uint64_t overlap_bytes;
> + int64_t overlap_bytes;
>
> QLIST_ENTRY(BdrvTrackedRequest) list;
> Coroutine *co; /* owner, used for deadlock detection */
> diff --git a/block/io.c b/block/io.c
> index aba67f66b9..7cbb80bd24 100644
> --- a/block/io.c
> +++ b/block/io.c
> @@ -692,10 +692,11 @@ static void tracked_request_end(BdrvTrackedRequest *req)
> static void tracked_request_begin(BdrvTrackedRequest *req,
> BlockDriverState *bs,
> int64_t offset,
> - uint64_t bytes,
> + int64_t bytes,
> enum BdrvTrackedRequestType type)
> {
> - assert(bytes <= INT64_MAX && offset <= INT64_MAX - bytes);
> + assert(offset >= 0 && bytes >= 0 &&
> + bytes <= INT64_MAX && offset <= INT64_MAX - bytes);
>
> *req = (BdrvTrackedRequest){
> .bs = bs,
> @@ -716,7 +717,7 @@ static void tracked_request_begin(BdrvTrackedRequest *req,
> }
>
> static bool tracked_request_overlaps(BdrvTrackedRequest *req,
> - int64_t offset, uint64_t bytes)
> + int64_t offset, int64_t bytes)
> {
> /* aaaa bbbb */
> if (offset >= req->overlap_offset + req->overlap_bytes) {
> @@ -773,8 +774,8 @@ bool bdrv_mark_request_serialising(BdrvTrackedRequest *req, uint64_t align)
> {
> BlockDriverState *bs = req->bs;
> int64_t overlap_offset = req->offset & ~(align - 1);
> - uint64_t overlap_bytes = ROUND_UP(req->offset + req->bytes, align)
> - - overlap_offset;
> + int64_t overlap_bytes =
> + ROUND_UP(req->offset + req->bytes, align) - overlap_offset;
An indentation with 8 spaces is unconventional in QEMU.
Kevin
next prev parent reply other threads:[~2020-04-23 15:26 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-03-30 14:18 [RFC 0/3] 64bit block-layer part I Vladimir Sementsov-Ogievskiy
2020-03-30 14:18 ` [PATCH 1/3] block: use int64_t as bytes type in tracked requests Vladimir Sementsov-Ogievskiy
2020-04-22 15:37 ` Stefan Hajnoczi
2020-04-23 15:25 ` Kevin Wolf [this message]
2020-03-30 14:18 ` [PATCH 2/3] block/io: convert generic io path to use int64_t parameters Vladimir Sementsov-Ogievskiy
2020-04-22 15:50 ` Stefan Hajnoczi
2020-04-22 17:45 ` Vladimir Sementsov-Ogievskiy
2020-03-30 14:18 ` [PATCH 3/3] block: use int64_t instead of uint64_t in driver handlers Vladimir Sementsov-Ogievskiy
2020-03-30 17:43 ` [RFC 0/3] 64bit block-layer part I no-reply
2020-03-30 17:48 ` no-reply
2020-03-30 17:50 ` no-reply
2020-04-22 14:29 ` Vladimir Sementsov-Ogievskiy
2020-04-22 14:52 ` Eric Blake
2020-04-22 15:53 ` Stefan Hajnoczi
2020-04-22 18:24 ` Vladimir Sementsov-Ogievskiy
2020-04-22 19:32 ` Eric Blake
2020-04-23 15:43 ` Kevin Wolf
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20200423152535.GC23654@linux.fritz.box \
--to=kwolf@redhat.com \
--cc=ari@tuxera.com \
--cc=berto@igalia.com \
--cc=den@openvz.org \
--cc=dillaman@redhat.com \
--cc=fam@euphon.net \
--cc=jsnow@redhat.com \
--cc=mreitz@redhat.com \
--cc=pavel.dovgaluk@ispras.ru \
--cc=pbonzini@redhat.com \
--cc=pl@kamp.de \
--cc=qemu-block@nongnu.org \
--cc=qemu-devel@nongnu.org \
--cc=ronniesahlberg@gmail.com \
--cc=stefanha@redhat.com \
--cc=sw@weilnetz.de \
--cc=vsementsov@virtuozzo.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.