qemu-block
[Top][All Lists]
Advanced

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

Re: [PATCH 06/11] file-posix: try BLKSECTGET on block devices too, do no


From: Max Reitz
Subject: Re: [PATCH 06/11] file-posix: try BLKSECTGET on block devices too, do not round to power of 2
Date: Fri, 25 Jun 2021 10:19:50 +0200
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.10.1

On 24.06.21 20:04, Paolo Bonzini wrote:
bs->sg is only true for character devices, but block devices can also
be used with scsi-block and scsi-generic.  Unfortunately BLKSECTGET
returns bytes in an int for /dev/sgN devices, and sectors in a short
for block devices, so account for that in the code.

The maximum transfer also need not be a power of 2 (for example I have
seen disks with 1280 KiB maximum transfer) so there's no need to pass
the result through pow2floor.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
  block/file-posix.c | 67 ++++++++++++++++++++++++++--------------------
  1 file changed, 38 insertions(+), 29 deletions(-)

Reviewed-by: Max Reitz <mreitz@redhat.com>




reply via email to

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