block: use 'unsigned' for in_flight field on driver state
PATCH 1/1 block: use 'unsigned' for in_flight field on driver state
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.
--- block/mirror.c | 2 +- block/nbd.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-)
block/mirror.c +1 -1
@@ -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;
block/nbd.c +1 -1
@@ -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;
Signature · 1 line
2.32.0
Quoted 10 lines · Denis V. Lunev
This patch makes
in_flightfield '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<[email protected]>CC John Snow<[email protected]>CC Vladimir Sementsov-Ogievskiy<[email protected]>CC Kevin Wolf<[email protected]>CC Hanna Reitz<[email protected]>CC Eric Blake<[email protected]>
Signature · 2 lines
Best regards, Vladimir
Quoted 10 lines · Denis V. Lunev
This patch makes
in_flightfield '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 <[email protected]>CC John Snow <[email protected]>CC Vladimir Sementsov-Ogievskiy <[email protected]>CC Kevin Wolf <[email protected]>CC Hanna Reitz <[email protected]>CC Eric Blake <[email protected]>
Quoted 4 lines
--- block/mirror.c | 2 +- block/nbd.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-)
FWIW there is another occurrence in qemu-img.c.
Quoted 33 lines · Denis V. Lunev
This patch makes
in_flightfield '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 <[email protected]>CC John Snow <[email protected]>CC Vladimir Sementsov-Ogievskiy <[email protected]>CC Kevin Wolf <[email protected]>CC Hanna Reitz <[email protected]>CC Eric Blake <[email protected]>--- block/mirror.c | 2 +- block/nbd.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-)block/mirror.c +1
-1@@ -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;block/nbd.c +0
-0
block/nbd.c typedef struct BDRVNBDState { · line 83
Quoted 8 lines
block/nbd.c +1
-1@@ -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
Quoted 33 lines · Denis V. Lunev
This patch makes
in_flightfield '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 <[email protected]>CC John Snow <[email protected]>CC Vladimir Sementsov-Ogievskiy <[email protected]>CC Kevin Wolf <[email protected]>CC Hanna Reitz <[email protected]>CC Eric Blake <[email protected]>--- block/mirror.c | 2 +- block/nbd.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-)block/mirror.c +1
-1@@ -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;block/nbd.c +0
-0
block/nbd.c typedef struct BDRVNBDState { · line 83
Quoted 8 lines
block/nbd.c +1
-1@@ -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
AppliedQuoted 10 lines · Denis V. Lunev
This patch makes
in_flightfield '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<[email protected]>CC John Snow<[email protected]>CC Vladimir Sementsov-Ogievskiy<[email protected]>CC Kevin Wolf<[email protected]>CC Hanna Reitz<[email protected]>CC Eric Blake<[email protected]>
Thanks, applied to my block branch at https://gitlab.com/vsementsov/qemu/-/commits/block
Signature · 2 lines
Best regards, Vladimir