qemu-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Qemu-commits] [qemu/qemu] e7e588: qcow2: Silence clang -m32 compiler wa


From: Richard Henderson
Subject: [Qemu-commits] [qemu/qemu] e7e588: qcow2: Silence clang -m32 compiler warning
Date: Fri, 15 Oct 2021 14:18:26 -0700

  Branch: refs/heads/staging
  Home:   https://github.com/qemu/qemu
  Commit: e7e588d432d31ecebc26358e47201dd108db964c
      
https://github.com/qemu/qemu/commit/e7e588d432d31ecebc26358e47201dd108db964c
  Author: Hanna Reitz <hreitz@redhat.com>
  Date:   2021-10-15 (Fri, 15 Oct 2021)

  Changed paths:
    M block/qcow2-cluster.c

  Log Message:
  -----------
  qcow2: Silence clang -m32 compiler warning

With -m32, size_t is generally only a uint32_t.  That makes clang
complain that in the assertion

  assert(qiov->size <= INT64_MAX);

the range of the type of qiov->size (size_t) is too small for any of its
values to ever exceed INT64_MAX.

Cast qiov->size to uint64_t to silence clang.

Fixes: f7ef38dd1310d7d9db76d0aa16899cbc5744f36d
       ("block: use int64_t instead of uint64_t in driver read
       handlers")
Signed-off-by: Hanna Reitz <hreitz@redhat.com>
Message-Id: <20211011155031.149158-1-hreitz@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Signed-off-by: Eric Blake <eblake@redhat.com>


  Commit: 7242db6389261cb936bd2240351b137843d49807
      
https://github.com/qemu/qemu/commit/7242db6389261cb936bd2240351b137843d49807
  Author: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
  Date:   2021-10-15 (Fri, 15 Oct 2021)

  Changed paths:
    M block/block-backend.c

  Log Message:
  -----------
  block-backend: blk_check_byte_request(): int64_t bytes

Rename size and make it int64_t to correspond to modern block layer,
which always uses int64_t for offset and bytes (not in blk layer yet,
which is a task for following commits).

All callers pass int or unsigned int.

So, for bytes in [0, INT_MAX] nothing is changed, for negative bytes we
now fail on "bytes < 0" check instead of "bytes > INT_MAX" check.

Note, that blk_check_byte_request() still doesn't allow requests
exceeding INT_MAX.

Signed-off-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
Message-Id: <20211006131718.214235-2-vsementsov@virtuozzo.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Signed-off-by: Eric Blake <eblake@redhat.com>


  Commit: 9547907705c94fa0415427ce12be418f8b68b56d
      
https://github.com/qemu/qemu/commit/9547907705c94fa0415427ce12be418f8b68b56d
  Author: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
  Date:   2021-10-15 (Fri, 15 Oct 2021)

  Changed paths:
    M block/block-backend.c
    M block/trace-events
    M include/sysemu/block-backend.h

  Log Message:
  -----------
  block-backend: make blk_co_preadv() 64bit

For both updated functions, the type of bytes becomes wider, so all callers
should be OK with it.

blk_co_preadv() only passes its arguments to blk_do_preadv().

blk_do_preadv() passes bytes to:

 - trace_blk_co_preadv, which is updated too
 - blk_check_byte_request, throttle_group_co_io_limits_intercept,
   bdrv_co_preadv, which are already int64_t.

Note that requests exceeding INT_MAX are still restricted by
blk_check_byte_request().

Signed-off-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
Message-Id: <20211006131718.214235-3-vsementsov@virtuozzo.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
[eblake: grammar tweaks]
Signed-off-by: Eric Blake <eblake@redhat.com>


  Commit: 34460feb63230daad12b0e0f31754f7ef5bc2be9
      
https://github.com/qemu/qemu/commit/34460feb63230daad12b0e0f31754f7ef5bc2be9
  Author: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
  Date:   2021-10-15 (Fri, 15 Oct 2021)

  Changed paths:
    M block/block-backend.c
    M block/trace-events
    M include/sysemu/block-backend.h

  Log Message:
  -----------
  block-backend: convert blk_co_pwritev_part to int64_t bytes

We convert blk_do_pwritev_part() and some wrappers:
blk_co_pwritev_part(), blk_co_pwritev(), blk_co_pwrite_zeroes().

All functions are converted so that the parameter type becomes wider, so
all callers should be OK with it.

Look at blk_do_pwritev_part() body:
bytes is passed to:

 - trace_blk_co_pwritev (we update it here)
 - blk_check_byte_request, throttle_group_co_io_limits_intercept,
   bdrv_co_pwritev_part - all already have int64_t argument.

Note that requests exceeding INT_MAX are still restricted by
blk_check_byte_request().

Signed-off-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
Message-Id: <20211006131718.214235-4-vsementsov@virtuozzo.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
[eblake: grammar tweaks]
Signed-off-by: Eric Blake <eblake@redhat.com>


  Commit: 2800637a33b0ff68c40c94a1d3d13f92feaadbc6
      
https://github.com/qemu/qemu/commit/2800637a33b0ff68c40c94a1d3d13f92feaadbc6
  Author: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
  Date:   2021-10-15 (Fri, 15 Oct 2021)

  Changed paths:
    M block/block-backend.c
    M include/sysemu/block-backend.h

  Log Message:
  -----------
  block-backend: convert blk_co_pdiscard to int64_t bytes

We updated blk_do_pdiscard() and its wrapper blk_co_pdiscard(). Both
functions are updated so that the parameter type becomes wider, so all
callers should be OK with it.

Look at blk_do_pdiscard(): bytes is passed only to
blk_check_byte_request() and bdrv_co_pdiscard(), which already have
int64_t bytes parameter, so we are OK.

Note that requests exceeding INT_MAX are still restricted by
blk_check_byte_request().

Signed-off-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
Message-Id: <20211006131718.214235-5-vsementsov@virtuozzo.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
[eblake: grammar tweaks]
Signed-off-by: Eric Blake <eblake@redhat.com>


  Commit: 70e8775ed9e46cb4fab8013627df4dd835a1c24c
      
https://github.com/qemu/qemu/commit/70e8775ed9e46cb4fab8013627df4dd835a1c24c
  Author: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
  Date:   2021-10-15 (Fri, 15 Oct 2021)

  Changed paths:
    M block/block-backend.c

  Log Message:
  -----------
  block-backend: rename _do_ helper functions to _co_do_

This is a preparation to the following commit, to use automatic
coroutine wrapper generation.

Signed-off-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
Message-Id: <20211006131718.214235-6-vsementsov@virtuozzo.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Signed-off-by: Eric Blake <eblake@redhat.com>


  Commit: 7d55a3bbadc0b00ff6c2a4f37116db887caec7ab
      
https://github.com/qemu/qemu/commit/7d55a3bbadc0b00ff6c2a4f37116db887caec7ab
  Author: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
  Date:   2021-10-15 (Fri, 15 Oct 2021)

  Changed paths:
    M block/coroutines.h
    M scripts/block-coroutine-wrapper.py

  Log Message:
  -----------
  block-coroutine-wrapper.py: support BlockBackend first argument

Signed-off-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
Message-Id: <20211006131718.214235-7-vsementsov@virtuozzo.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Signed-off-by: Eric Blake <eblake@redhat.com>


  Commit: 16d36e299669145f3021f2912aefbc32d7f0593c
      
https://github.com/qemu/qemu/commit/16d36e299669145f3021f2912aefbc32d7f0593c
  Author: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
  Date:   2021-10-15 (Fri, 15 Oct 2021)

  Changed paths:
    M block/block-backend.c
    M block/coroutines.h

  Log Message:
  -----------
  block-backend: drop blk_prw, use block-coroutine-wrapper

Let's drop hand-made coroutine wrappers and use coroutine wrapper
generation like in block/io.c.

Now, blk_foo() functions are written in same way as blk_co_foo() ones,
but wrap blk_do_foo() instead of blk_co_do_foo().

Signed-off-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
Message-Id: <20211006131718.214235-8-vsementsov@virtuozzo.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
[eblake: spelling fix]
Signed-off-by: Eric Blake <eblake@redhat.com>


  Commit: 06f0325c5b62f80bab1c9eb50edc814158d6005e
      
https://github.com/qemu/qemu/commit/06f0325c5b62f80bab1c9eb50edc814158d6005e
  Author: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
  Date:   2021-10-15 (Fri, 15 Oct 2021)

  Changed paths:
    M block/block-backend.c
    M include/sysemu/block-backend.h

  Log Message:
  -----------
  block-backend: convert blk_foo wrappers to use int64_t bytes parameter

Convert blk_pdiscard, blk_pwrite_compressed, blk_pwrite_zeroes.
These are just wrappers for functions with int64_t argument, so allow
passing int64_t as well. Parameter type becomes wider so all callers
should be OK with it.

Note that requests exceeding INT_MAX are still restricted by
blk_check_byte_request().

Note also that we don't (and are not going to) convert blk_pwrite and
blk_pread: these functions return number of bytes on success, so to
update them, we should change return type to int64_t as well, which
will lead to investigating and updating all callers which is too much.

So, blk_pread and blk_pwrite remain unchanged.

Signed-off-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
Message-Id: <20211006131718.214235-9-vsementsov@virtuozzo.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
[eblake: grammar tweaks]
Signed-off-by: Eric Blake <eblake@redhat.com>


  Commit: e192179bb2c080f0130a7ff427c2572909fc31ed
      
https://github.com/qemu/qemu/commit/e192179bb2c080f0130a7ff427c2572909fc31ed
  Author: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
  Date:   2021-10-15 (Fri, 15 Oct 2021)

  Changed paths:
    M block/block-backend.c
    M include/sysemu/block-backend.h

  Log Message:
  -----------
  block-backend: convert blk_co_copy_range to int64_t bytes

Function is updated so that parameter type becomes wider, so all
callers should be OK with it.

Look at blk_co_copy_range() itself: bytes is passed only to
blk_check_byte_request() and bdrv_co_copy_range(), which already have
int64_t bytes parameter, so we are OK.

Note that requests exceeding INT_MAX are still restricted by
blk_check_byte_request().

Signed-off-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
Message-Id: <20211006131718.214235-10-vsementsov@virtuozzo.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
[eblake: grammar tweaks]
Signed-off-by: Eric Blake <eblake@redhat.com>


  Commit: a93d81c84afa717b0a1a6947524d8d1fbfd6bbf5
      
https://github.com/qemu/qemu/commit/a93d81c84afa717b0a1a6947524d8d1fbfd6bbf5
  Author: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
  Date:   2021-10-15 (Fri, 15 Oct 2021)

  Changed paths:
    M block/block-backend.c
    M include/sysemu/block-backend.h

  Log Message:
  -----------
  block-backend: convert blk_aio_ functions to int64_t bytes paramter

1. Convert bytes in BlkAioEmAIOCB:
  aio->bytes is only passed to already int64_t interfaces, and set in
  blk_aio_prwv, which is updated here.

2. For all updated functions the parameter type becomes wider so callers
   are safe.

3. In blk_aio_prwv we only store bytes to BlkAioEmAIOCB, which is
   updated here.

4. Other updated functions are wrappers on blk_aio_prwv.

Note that blk_aio_preadv and blk_aio_pwritev become safer: before this
commit, it's theoretically possible to pass qiov with size exceeding
INT_MAX, which than converted to int argument of blk_aio_prwv. Now it's
converted to int64_t which is a lot better. Still add assertions.

Signed-off-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
Message-Id: <20211006131718.214235-11-vsementsov@virtuozzo.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
[eblake: tweak assertion and grammar]
Signed-off-by: Eric Blake <eblake@redhat.com>


  Commit: 14149710f98fcf7af13eeb6cf6040b33c01b9792
      
https://github.com/qemu/qemu/commit/14149710f98fcf7af13eeb6cf6040b33c01b9792
  Author: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
  Date:   2021-10-15 (Fri, 15 Oct 2021)

  Changed paths:
    M block/block-backend.c

  Log Message:
  -----------
  block-backend: blk_pread, blk_pwrite: rename count parameter to bytes

To be consistent with declarations in include/sysemu/block-backend.h.

Signed-off-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
Message-Id: <20211006131718.214235-12-vsementsov@virtuozzo.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Signed-off-by: Eric Blake <eblake@redhat.com>


  Commit: aa78b825162163d2c51903490d67c10a689eac6b
      
https://github.com/qemu/qemu/commit/aa78b825162163d2c51903490d67c10a689eac6b
  Author: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
  Date:   2021-10-15 (Fri, 15 Oct 2021)

  Changed paths:
    M block/block-backend.c

  Log Message:
  -----------
  block-backend: drop INT_MAX restriction from blk_check_byte_request()

blk_check_bytes_request is called from blk_co_do_preadv,
blk_co_do_pwritev_part, blk_co_do_pdiscard and blk_co_copy_range
before (maybe) calling throttle_group_co_io_limits_intercept() (which
has int64_t argument) and then calling corresponding bdrv_co_ function.
bdrv_co_ functions are OK with int64_t bytes as well.

So dropping the check for INT_MAX we just get same restrictions as in
bdrv_ layer: discard and write-zeroes goes through
bdrv_check_qiov_request() and are allowed to be 64bit. Other requests
go through bdrv_check_request32() and still restricted by INT_MAX
boundary.

Signed-off-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
Message-Id: <20211006131718.214235-13-vsementsov@virtuozzo.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Signed-off-by: Eric Blake <eblake@redhat.com>


  Commit: 57768ec166493260494b76a2fa9fea980ca30e18
      
https://github.com/qemu/qemu/commit/57768ec166493260494b76a2fa9fea980ca30e18
  Author: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
  Date:   2021-10-15 (Fri, 15 Oct 2021)

  Changed paths:
    M include/sysemu/block-backend.h

  Log Message:
  -----------
  block-backend: fix blk_co_flush prototype to mention coroutine_fn

We already have this marker for the blk_co_flush function declaration in
block/block-backend.c. Add it in the header too.

Signed-off-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
Message-Id: <20211007175243.642516-1-vsementsov@virtuozzo.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
[eblake: wording tweak]
Signed-off-by: Eric Blake <eblake@redhat.com>


  Commit: bec4042baefc1bfeae05b161aa17d2f57d526b60
      
https://github.com/qemu/qemu/commit/bec4042baefc1bfeae05b161aa17d2f57d526b60
  Author: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
  Date:   2021-10-15 (Fri, 15 Oct 2021)

  Changed paths:
    M include/sysemu/block-backend.h

  Log Message:
  -----------
  block-backend: update blk_co_pwrite() and blk_co_pread() wrappers

Make bytes argument int64_t to be consistent with modern block-layer.
Callers should be OK with it as type becomes wider.

What is inside functions?

- Conversion from int64_t to size_t. Still, we
can't have a buffer larger than SIZE_MAX, therefore bytes should not be
larger than SIZE_MAX as well. Add an assertion.

- Passing to blk_co_pwritev() / blk_co_preadv() which already has
  int64_t bytes argument.

Signed-off-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
Message-Id: <20211007175243.642516-2-vsementsov@virtuozzo.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
[eblake: spelling fix]
Signed-off-by: Eric Blake <eblake@redhat.com>


  Commit: 6587b0c1331d427b0939c37e763842550ed581db
      
https://github.com/qemu/qemu/commit/6587b0c1331d427b0939c37e763842550ed581db
  Author: Richard Henderson <richard.henderson@linaro.org>
  Date:   2021-10-15 (Fri, 15 Oct 2021)

  Changed paths:
    M block/block-backend.c
    M block/coroutines.h
    M block/qcow2-cluster.c
    M block/trace-events
    M include/sysemu/block-backend.h
    M scripts/block-coroutine-wrapper.py

  Log Message:
  -----------
  Merge remote-tracking branch 'remotes/ericb/tags/pull-nbd-2021-10-15' into 
staging

nbd patches for 2021-10-15

- Vladimir Sementsov-Ogievskiy: Consistent use of 64-bit parameters in
  block operations
- Hanna Reitz: Silence 32-bit compiler warning

# gpg: Signature made Fri 15 Oct 2021 02:08:10 PM PDT
# gpg:                using RSA key 71C2CC22B1C4602927D2F3AAA7A16B4A2527436A
# gpg: Good signature from "Eric Blake <eblake@redhat.com>" [full]
# gpg:                 aka "Eric Blake (Free Software Programmer) 
<ebb9@byu.net>" [full]
# gpg:                 aka "[jpeg image of size 6874]" [full]

* remotes/ericb/tags/pull-nbd-2021-10-15:
  block-backend: update blk_co_pwrite() and blk_co_pread() wrappers
  block-backend: fix blk_co_flush prototype to mention coroutine_fn
  block-backend: drop INT_MAX restriction from blk_check_byte_request()
  block-backend: blk_pread, blk_pwrite: rename count parameter to bytes
  block-backend: convert blk_aio_ functions to int64_t bytes paramter
  block-backend: convert blk_co_copy_range to int64_t bytes
  block-backend: convert blk_foo wrappers to use int64_t bytes parameter
  block-backend: drop blk_prw, use block-coroutine-wrapper
  block-coroutine-wrapper.py: support BlockBackend first argument
  block-backend: rename _do_ helper functions to _co_do_
  block-backend: convert blk_co_pdiscard to int64_t bytes
  block-backend: convert blk_co_pwritev_part to int64_t bytes
  block-backend: make blk_co_preadv() 64bit
  block-backend: blk_check_byte_request(): int64_t bytes
  qcow2: Silence clang -m32 compiler warning

Signed-off-by: Richard Henderson <richard.henderson@linaro.org>


Compare: https://github.com/qemu/qemu/compare/253e399bab7c...6587b0c1331d



reply via email to

[Prev in Thread] Current Thread [Next in Thread]