diff mbox series

[1/1] block: use 'unsigned' for in_flight field on driver state

Message ID 20220530103957.629398-1-den@openvz.org (mailing list archive)
State New, archived
Headers show
Series [1/1] block: use 'unsigned' for in_flight field on driver state | expand

Commit Message

Denis V. Lunev May 30, 2022, 10:39 a.m. UTC
This patch makes in_flight field 'unsigned' for BDRVNBDState and
MirrorBlockJob. This matches the definition of this field on BDS
and is generically correct - we should never get negative value here.

Signed-off-by: Denis V. Lunev <den@openvz.org>
CC: John Snow <jsnow@redhat.com>
CC: Vladimir Sementsov-Ogievskiy <vsementsov@yandex-team.ru>
CC: Kevin Wolf <kwolf@redhat.com>
CC: Hanna Reitz <hreitz@redhat.com>
CC: Eric Blake <eblake@redhat.com>
---
 block/mirror.c | 2 +-
 block/nbd.c    | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

Comments

Vladimir Sementsov-Ogievskiy June 2, 2022, 10:34 a.m. UTC | #1
On 5/30/22 13:39, Denis V. Lunev wrote:
> This patch makes in_flight field 'unsigned' for BDRVNBDState and
> MirrorBlockJob. This matches the definition of this field on BDS
> and is generically correct - we should never get negative value here.
> 
> Signed-off-by: Denis V. Lunev<den@openvz.org>
> CC: John Snow<jsnow@redhat.com>
> CC: Vladimir Sementsov-Ogievskiy<vsementsov@yandex-team.ru>
> CC: Kevin Wolf<kwolf@redhat.com>
> CC: Hanna Reitz<hreitz@redhat.com>
> CC: Eric Blake<eblake@redhat.com>

Reviewed-by: Vladimir Sementsov-Ogievskiy <vsementsov@yandex-team.ru>
Philippe Mathieu-Daudé June 2, 2022, 10:45 a.m. UTC | #2
On 30/5/22 12:39, Denis V. Lunev wrote:
> This patch makes in_flight field 'unsigned' for BDRVNBDState and
> MirrorBlockJob. This matches the definition of this field on BDS
> and is generically correct - we should never get negative value here.
> 
> Signed-off-by: Denis V. Lunev <den@openvz.org>
> CC: John Snow <jsnow@redhat.com>
> CC: Vladimir Sementsov-Ogievskiy <vsementsov@yandex-team.ru>
> CC: Kevin Wolf <kwolf@redhat.com>
> CC: Hanna Reitz <hreitz@redhat.com>
> CC: Eric Blake <eblake@redhat.com>
> ---
>   block/mirror.c | 2 +-
>   block/nbd.c    | 2 +-
>   2 files changed, 2 insertions(+), 2 deletions(-)

FWIW there is another occurrence in qemu-img.c.
Denis V. Lunev June 6, 2022, 2:36 p.m. UTC | #3
On 30.05.2022 12:39, Denis V. Lunev wrote:
> This patch makes in_flight field 'unsigned' for BDRVNBDState and
> MirrorBlockJob. This matches the definition of this field on BDS
> and is generically correct - we should never get negative value here.
>
> Signed-off-by: Denis V. Lunev <den@openvz.org>
> CC: John Snow <jsnow@redhat.com>
> CC: Vladimir Sementsov-Ogievskiy <vsementsov@yandex-team.ru>
> CC: Kevin Wolf <kwolf@redhat.com>
> CC: Hanna Reitz <hreitz@redhat.com>
> CC: Eric Blake <eblake@redhat.com>
> ---
>   block/mirror.c | 2 +-
>   block/nbd.c    | 2 +-
>   2 files changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/block/mirror.c b/block/mirror.c
> index d8ecb9efa2..3c4ab1159d 100644
> --- a/block/mirror.c
> +++ b/block/mirror.c
> @@ -73,7 +73,7 @@ typedef struct MirrorBlockJob {
>   
>       uint64_t last_pause_ns;
>       unsigned long *in_flight_bitmap;
> -    int in_flight;
> +    unsigned in_flight;
>       int64_t bytes_in_flight;
>       QTAILQ_HEAD(, MirrorOp) ops_in_flight;
>       int ret;
> diff --git a/block/nbd.c b/block/nbd.c
> index 6085ab1d2c..512a53bf73 100644
> --- a/block/nbd.c
> +++ b/block/nbd.c
> @@ -77,7 +77,7 @@ typedef struct BDRVNBDState {
>       QemuMutex requests_lock;
>       NBDClientState state;
>       CoQueue free_sema;
> -    int in_flight;
> +    unsigned in_flight;
>       NBDClientRequest requests[MAX_NBD_REQUESTS];
>       QEMUTimer *reconnect_delay_timer;
>   
ping
Denis V. Lunev June 13, 2022, 11:29 a.m. UTC | #4
On 30.05.2022 12:39, Denis V. Lunev wrote:
> This patch makes in_flight field 'unsigned' for BDRVNBDState and
> MirrorBlockJob. This matches the definition of this field on BDS
> and is generically correct - we should never get negative value here.
>
> Signed-off-by: Denis V. Lunev <den@openvz.org>
> CC: John Snow <jsnow@redhat.com>
> CC: Vladimir Sementsov-Ogievskiy <vsementsov@yandex-team.ru>
> CC: Kevin Wolf <kwolf@redhat.com>
> CC: Hanna Reitz <hreitz@redhat.com>
> CC: Eric Blake <eblake@redhat.com>
> ---
>   block/mirror.c | 2 +-
>   block/nbd.c    | 2 +-
>   2 files changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/block/mirror.c b/block/mirror.c
> index d8ecb9efa2..3c4ab1159d 100644
> --- a/block/mirror.c
> +++ b/block/mirror.c
> @@ -73,7 +73,7 @@ typedef struct MirrorBlockJob {
>   
>       uint64_t last_pause_ns;
>       unsigned long *in_flight_bitmap;
> -    int in_flight;
> +    unsigned in_flight;
>       int64_t bytes_in_flight;
>       QTAILQ_HEAD(, MirrorOp) ops_in_flight;
>       int ret;
> diff --git a/block/nbd.c b/block/nbd.c
> index 6085ab1d2c..512a53bf73 100644
> --- a/block/nbd.c
> +++ b/block/nbd.c
> @@ -77,7 +77,7 @@ typedef struct BDRVNBDState {
>       QemuMutex requests_lock;
>       NBDClientState state;
>       CoQueue free_sema;
> -    int in_flight;
> +    unsigned in_flight;
>       NBDClientRequest requests[MAX_NBD_REQUESTS];
>       QEMUTimer *reconnect_delay_timer;
>   
ping v2
Vladimir Sementsov-Ogievskiy June 14, 2022, 7:50 a.m. UTC | #5
On 5/30/22 13:39, Denis V. Lunev wrote:
> This patch makes in_flight field 'unsigned' for BDRVNBDState and
> MirrorBlockJob. This matches the definition of this field on BDS
> and is generically correct - we should never get negative value here.
> 
> Signed-off-by: Denis V. Lunev<den@openvz.org>
> CC: John Snow<jsnow@redhat.com>
> CC: Vladimir Sementsov-Ogievskiy<vsementsov@yandex-team.ru>
> CC: Kevin Wolf<kwolf@redhat.com>
> CC: Hanna Reitz<hreitz@redhat.com>
> CC: Eric Blake<eblake@redhat.com>


Thanks, applied to my block branch at https://gitlab.com/vsementsov/qemu/-/commits/block
diff mbox series

Patch

diff --git a/block/mirror.c b/block/mirror.c
index d8ecb9efa2..3c4ab1159d 100644
--- a/block/mirror.c
+++ b/block/mirror.c
@@ -73,7 +73,7 @@  typedef struct MirrorBlockJob {
 
     uint64_t last_pause_ns;
     unsigned long *in_flight_bitmap;
-    int in_flight;
+    unsigned in_flight;
     int64_t bytes_in_flight;
     QTAILQ_HEAD(, MirrorOp) ops_in_flight;
     int ret;
diff --git a/block/nbd.c b/block/nbd.c
index 6085ab1d2c..512a53bf73 100644
--- a/block/nbd.c
+++ b/block/nbd.c
@@ -77,7 +77,7 @@  typedef struct BDRVNBDState {
     QemuMutex requests_lock;
     NBDClientState state;
     CoQueue free_sema;
-    int in_flight;
+    unsigned in_flight;
     NBDClientRequest requests[MAX_NBD_REQUESTS];
     QEMUTimer *reconnect_delay_timer;