[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH v4 4/7] file-posix: try BLKSECTGET on block devices too, do n
From: |
Eric Blake |
Subject: |
Re: [PATCH v4 4/7] file-posix: try BLKSECTGET on block devices too, do not round to power of 2 |
Date: |
Tue, 8 Jun 2021 12:53:44 -0500 |
User-agent: |
NeoMutt/20210205 |
On Tue, Jun 08, 2021 at 03:16:31PM +0200, 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.
Gotta love inconsistent and poorly-documented kernel interfaces! (on my
system, 'man -k BLKSECTGET' had no hits)
>
> 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 | 44 ++++++++++++++++++++++++--------------------
> 1 file changed, 24 insertions(+), 20 deletions(-)
>
Reviewed-by: Eric Blake <eblake@redhat.com>
--
Eric Blake, Principal Software Engineer
Red Hat, Inc. +1-919-301-3266
Virtualization: qemu.org | libvirt.org
- Re: [PATCH v4 1/7] file-posix: fix max_iov for /dev/sg devices, (continued)
[PATCH v4 2/7] scsi-generic: pass max_segments via max_iov field in BlockLimits, Paolo Bonzini, 2021/06/08
[PATCH v4 3/7] block: add max_hw_transfer to BlockLimits, Paolo Bonzini, 2021/06/08
[PATCH v4 6/7] block: check for sys/disk.h, Paolo Bonzini, 2021/06/08
[PATCH v4 4/7] file-posix: try BLKSECTGET on block devices too, do not round to power of 2, Paolo Bonzini, 2021/06/08
[PATCH v4 5/7] block: feature detection for host block support, Paolo Bonzini, 2021/06/08
[PATCH v4 7/7] block: detect DKIOCGETBLOCKCOUNT/SIZE before use, Paolo Bonzini, 2021/06/08