qemu-patch-raspberry4/tests/unit
Vladimir Sementsov-Ogievskiy 0c8022876f block: use int64_t instead of int in driver discard handlers
We are generally moving to int64_t for both offset and bytes parameters
on all io paths.

Main motivation is realization of 64-bit write_zeroes operation for
fast zeroing large disk chunks, up to the whole disk.

We chose signed type, to be consistent with off_t (which is signed) and
with possibility for signed return type (where negative value means
error).

So, convert driver discard handlers bytes parameter to int64_t.

The only caller of all updated function is bdrv_co_pdiscard in
block/io.c. It is already prepared to work with 64bit requests, but
pass at most max(bs->bl.max_pdiscard, INT_MAX) to the driver.

Let's look at all updated functions:

blkdebug: all calculations are still OK, thanks to
  bdrv_check_qiov_request().
  both rule_check and bdrv_co_pdiscard are 64bit

blklogwrites: pass to blk_loc_writes_co_log which is 64bit

blkreplay, copy-on-read, filter-compress: pass to bdrv_co_pdiscard, OK

copy-before-write: pass to bdrv_co_pdiscard which is 64bit and to
  cbw_do_copy_before_write which is 64bit

file-posix: one handler calls raw_account_discard() is 64bit and both
  handlers calls raw_do_pdiscard(). Update raw_do_pdiscard, which pass
  to RawPosixAIOData::aio_nbytes, which is 64bit (and calls
  raw_account_discard())

gluster: somehow, third argument of glfs_discard_async is size_t.
  Let's set max_pdiscard accordingly.

iscsi: iscsi_allocmap_set_invalid is 64bit,
  !is_byte_request_lun_aligned is 64bit.
  list.num is uint32_t. Let's clarify max_pdiscard and
  pdiscard_alignment.

mirror_top: pass to bdrv_mirror_top_do_write() which is
  64bit

nbd: protocol limitation. max_pdiscard is alredy set strict enough,
  keep it as is for now.

nvme: buf.nlb is uint32_t and we do shift. So, add corresponding limits
  to nvme_refresh_limits().

preallocate: pass to bdrv_co_pdiscard() which is 64bit.

rbd: pass to qemu_rbd_start_co() which is 64bit.

qcow2: calculations are still OK, thanks to bdrv_check_qiov_request(),
  qcow2_cluster_discard() is 64bit.

raw-format: raw_adjust_offset() is 64bit, bdrv_co_pdiscard too.

throttle: pass to bdrv_co_pdiscard() which is 64bit and to
  throttle_group_co_io_limits_intercept() which is 64bit as well.

test-block-iothread: bytes argument is unused

Great! Now all drivers are prepared to handle 64bit discard requests,
or else have explicit max_pdiscard limits.

Signed-off-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
Message-Id: <20210903102807.27127-11-vsementsov@virtuozzo.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Signed-off-by: Eric Blake <eblake@redhat.com>
2021-09-29 13:46:32 -05:00
..
check-block-qdict.c tests: Move unit tests into a separate directory 2021-03-12 15:46:30 +01:00
check-qdict.c tests: Move unit tests into a separate directory 2021-03-12 15:46:30 +01:00
check-qjson.c tests: Move unit tests into a separate directory 2021-03-12 15:46:30 +01:00
check-qlist.c tests: Move unit tests into a separate directory 2021-03-12 15:46:30 +01:00
check-qlit.c tests: Move unit tests into a separate directory 2021-03-12 15:46:30 +01:00
check-qnull.c tests: Move unit tests into a separate directory 2021-03-12 15:46:30 +01:00
check-qnum.c tests: Move unit tests into a separate directory 2021-03-12 15:46:30 +01:00
check-qobject.c tests: Move unit tests into a separate directory 2021-03-12 15:46:30 +01:00
check-qom-interface.c tests: Move unit tests into a separate directory 2021-03-12 15:46:30 +01:00
check-qom-proplist.c tests: convert check-qom-proplist to keyval 2021-03-19 10:18:17 +01:00
check-qstring.c tests: Move unit tests into a separate directory 2021-03-12 15:46:30 +01:00
crypto-tls-psk-helpers.c tests: remove QCRYPTO_HAVE_TLS_TEST_SUPPORT 2021-06-25 10:53:46 +02:00
crypto-tls-psk-helpers.h tests: remove QCRYPTO_HAVE_TLS_TEST_SUPPORT 2021-06-25 10:53:46 +02:00
crypto-tls-x509-helpers.c tests: remove QCRYPTO_HAVE_TLS_TEST_SUPPORT 2021-06-25 10:53:46 +02:00
crypto-tls-x509-helpers.h tests: remove QCRYPTO_HAVE_TLS_TEST_SUPPORT 2021-06-25 10:53:46 +02:00
io-channel-helpers.c tests: Move unit tests into a separate directory 2021-03-12 15:46:30 +01:00
io-channel-helpers.h tests: Move unit tests into a separate directory 2021-03-12 15:46:30 +01:00
iothread.c async: the main AioContext is only "current" if under the BQL 2021-06-18 10:59:52 -05:00
iothread.h tests: Move unit tests into a separate directory 2021-03-12 15:46:30 +01:00
meson.build qapi: introduce forwarding visitor 2021-07-23 18:17:17 +02:00
pkix_asn1_tab.c tests: remove QCRYPTO_HAVE_TLS_TEST_SUPPORT 2021-06-25 10:53:46 +02:00
ptimer-test-stubs.c util/async: add a human-readable name to BHs for debugging 2021-07-05 11:40:32 +01:00
ptimer-test.c tests: Move unit tests into a separate directory 2021-03-12 15:46:30 +01:00
ptimer-test.h tests: Move unit tests into a separate directory 2021-03-12 15:46:30 +01:00
rcutorture.c tests: Move unit tests into a separate directory 2021-03-12 15:46:30 +01:00
socket-helpers.c tests: Move unit tests into a separate directory 2021-03-12 15:46:30 +01:00
socket-helpers.h tests: Move unit tests into a separate directory 2021-03-12 15:46:30 +01:00
test-aio-multithread.c tests: Move unit tests into a separate directory 2021-03-12 15:46:30 +01:00
test-aio.c tests: cover aio_co_enter from a worker thread without BQL taken 2021-06-18 10:59:52 -05:00
test-authz-list.c tests: Move unit tests into a separate directory 2021-03-12 15:46:30 +01:00
test-authz-listfile.c tests: Move unit tests into a separate directory 2021-03-12 15:46:30 +01:00
test-authz-pam.c tests: Move unit tests into a separate directory 2021-03-12 15:46:30 +01:00
test-authz-simple.c tests: Move unit tests into a separate directory 2021-03-12 15:46:30 +01:00
test-base64.c tests: Move unit tests into a separate directory 2021-03-12 15:46:30 +01:00
test-bdrv-drain.c block: use int64_t instead of uint64_t in driver read handlers 2021-09-29 13:46:31 -05:00
test-bdrv-graph-mod.c block: move supports_backing check to bdrv_set_file_or_backing_noperm() 2021-06-29 16:51:00 +02:00
test-bitcnt.c tests: Move unit tests into a separate directory 2021-03-12 15:46:30 +01:00
test-bitmap.c tests: Move unit tests into a separate directory 2021-03-12 15:46:30 +01:00
test-bitops.c tests: Move unit tests into a separate directory 2021-03-12 15:46:30 +01:00
test-block-backend.c tests: Move unit tests into a separate directory 2021-03-12 15:46:30 +01:00
test-block-iothread.c block: use int64_t instead of int in driver discard handlers 2021-09-29 13:46:32 -05:00
test-blockjob-txn.c tests: Move unit tests into a separate directory 2021-03-12 15:46:30 +01:00
test-blockjob.c test-blockjob: Test job_wait_unpaused() 2021-04-09 18:00:29 +02:00
test-bufferiszero.c tests: Move unit tests into a separate directory 2021-03-12 15:46:30 +01:00
test-char.c char: Deprecate backend aliases 'tty' and 'parport' 2021-03-19 10:18:06 +01:00
test-clone-visitor.c test-clone-visitor: Correct an accidental rename 2021-09-27 08:23:25 +02:00
test-coroutine.c test-coroutine: Add rwlock downgrade test 2021-03-31 10:44:21 +01:00
test-crypto-afsplit.c tests: Move unit tests into a separate directory 2021-03-12 15:46:30 +01:00
test-crypto-block.c tests: Move unit tests into a separate directory 2021-03-12 15:46:30 +01:00
test-crypto-cipher.c crypto: replace 'des-rfb' cipher with 'des' 2021-07-14 14:15:52 +01:00
test-crypto-hash.c crypto: use &error_fatal in crypto tests 2021-07-14 14:15:52 +01:00
test-crypto-hmac.c crypto: use &error_fatal in crypto tests 2021-07-14 14:15:52 +01:00
test-crypto-ivgen.c crypto: skip essiv ivgen tests if AES+ECB isn't available 2021-07-14 14:15:52 +01:00
test-crypto-pbkdf.c crypto: remove obsolete crypto test condition 2021-07-14 14:15:52 +01:00
test-crypto-secret.c tests: Move unit tests into a separate directory 2021-03-12 15:46:30 +01:00
test-crypto-tlscredsx509.c tests: remove QCRYPTO_HAVE_TLS_TEST_SUPPORT 2021-06-25 10:53:46 +02:00
test-crypto-tlssession.c tests: remove QCRYPTO_HAVE_TLS_TEST_SUPPORT 2021-06-25 10:53:46 +02:00
test-crypto-xts.c tests: Move unit tests into a separate directory 2021-03-12 15:46:30 +01:00
test-cutils.c utils: Work around mingw strto*l bug with 0x 2021-03-24 14:25:41 +00:00
test-fdmon-epoll.c tests: Move unit tests into a separate directory 2021-03-12 15:46:30 +01:00
test-forward-visitor.c qapi: introduce forwarding visitor 2021-07-23 18:17:17 +02:00
test-hbitmap.c tests: Move unit tests into a separate directory 2021-03-12 15:46:30 +01:00
test-image-locking.c tests: Move unit tests into a separate directory 2021-03-12 15:46:30 +01:00
test-int128.c tests: Move unit tests into a separate directory 2021-03-12 15:46:30 +01:00
test-io-channel-buffer.c tests: Move unit tests into a separate directory 2021-03-12 15:46:30 +01:00
test-io-channel-command.c tests: Move unit tests into a separate directory 2021-03-12 15:46:30 +01:00
test-io-channel-file.c tests: Move unit tests into a separate directory 2021-03-12 15:46:30 +01:00
test-io-channel-socket.c tests: Move unit tests into a separate directory 2021-03-12 15:46:30 +01:00
test-io-channel-tls.c tests: remove QCRYPTO_HAVE_TLS_TEST_SUPPORT 2021-06-25 10:53:46 +02:00
test-io-task.c tests: Move unit tests into a separate directory 2021-03-12 15:46:30 +01:00
test-iov.c tests/unit: Remove unused variable from test_io 2021-07-26 07:07:28 -10:00
test-keyval.c keyval: introduce keyval_merge 2021-07-06 08:33:51 +02:00
test-logging.c tests: Move unit tests into a separate directory 2021-03-12 15:46:30 +01:00
test-mul64.c tests: Move unit tests into a separate directory 2021-03-12 15:46:30 +01:00
test-opts-visitor.c tests: Move unit tests into a separate directory 2021-03-12 15:46:30 +01:00
test-qapi-util.c tests: Move unit tests into a separate directory 2021-03-12 15:46:30 +01:00
test-qdev-global-props.c tests: Move unit tests into a separate directory 2021-03-12 15:46:30 +01:00
test-qdist.c tests: Move unit tests into a separate directory 2021-03-12 15:46:30 +01:00
test-qemu-opts.c qemu-option: remove now-dead code 2021-07-06 08:33:51 +02:00
test-qga.c tests: Move unit tests into a separate directory 2021-03-12 15:46:30 +01:00
test-qgraph.c tests: Remove uses of deprecated raspi2/raspi3 machine names 2021-09-01 11:08:15 +01:00
test-qht.c tests: Move unit tests into a separate directory 2021-03-12 15:46:30 +01:00
test-qmp-cmds.c tests/qapi-schema: Drop simple union __org.qemu_x-Union1 2021-09-27 08:23:25 +02:00
test-qmp-event.c qapi: Enforce event naming rules 2021-03-23 22:31:05 +01:00
test-qobject-input-visitor.c test-qobject-input-visitor: Wean off UserDefListUnion 2021-09-27 08:23:25 +02:00
test-qobject-output-visitor.c test-qobject-output-visitor: Wean off UserDefListUnion 2021-09-27 08:23:25 +02:00
test-rcu-list.c tests: Move unit tests into a separate directory 2021-03-12 15:46:30 +01:00
test-rcu-simpleq.c tests: Move unit tests into a separate directory 2021-03-12 15:46:30 +01:00
test-rcu-slist.c tests: Move unit tests into a separate directory 2021-03-12 15:46:30 +01:00
test-rcu-tailq.c tests: Move unit tests into a separate directory 2021-03-12 15:46:30 +01:00
test-replication.c replication: move include out of root directory 2021-05-26 14:49:46 +02:00
test-shift128.c tests: Move unit tests into a separate directory 2021-03-12 15:46:30 +01:00
test-string-input-visitor.c tests: Move unit tests into a separate directory 2021-03-12 15:46:30 +01:00
test-string-output-visitor.c tests: Move unit tests into a separate directory 2021-03-12 15:46:30 +01:00
test-thread-pool.c tests: Move unit tests into a separate directory 2021-03-12 15:46:30 +01:00
test-throttle.c tests: Move unit tests into a separate directory 2021-03-12 15:46:30 +01:00
test-timed-average.c tests: Move unit tests into a separate directory 2021-03-12 15:46:30 +01:00
test-util-filemonitor.c tests: Move unit tests into a separate directory 2021-03-12 15:46:30 +01:00
test-util-sockets.c test-util-sockets: Add stub for monitor_set_cur() 2021-03-19 16:05:11 +01:00
test-uuid.c tests: Move unit tests into a separate directory 2021-03-12 15:46:30 +01:00
test-visitor-serialization.c tests: Move unit tests into a separate directory 2021-03-12 15:46:30 +01:00
test-vmstate.c tests/unit/test-vmstate: Assert that dup() and mkstemp() succeed 2021-06-03 16:43:27 +01:00
test-write-threshold.c write-threshold: deal with includes 2021-05-14 16:14:10 +02:00
test-x86-cpuid.c tests: Move unit tests into a separate directory 2021-03-12 15:46:30 +01:00
test-xbzrle.c tests: Move unit tests into a separate directory 2021-03-12 15:46:30 +01:00
test-yank.c qapi: Convert simple union SocketAddressLegacy to flat one 2021-09-27 08:23:25 +02:00