Re: [PATCH v4 2/2] file-posix: add sg_get_max_segments that actually works with sg

2020-09-06 Thread Tom Yan
; Sent: Sunday, September 6, 2020 1:06 PM > > To: Tom Yan ; ebl...@redhat.com; > > pbonz...@redhat.com; f...@euphon.net; anie...@linux.vnet.ibm.com; > > kw...@redhat.com; mre...@redhat.com > > Cc: qemu-devel@nongnu.org; qemu-bl...@nongnu.org > > Subject: Re: [PATCH v4

RE: [PATCH v4 2/2] file-posix: add sg_get_max_segments that actually works with sg

2020-09-06 Thread Dmitry Fomichev
t; kw...@redhat.com; mre...@redhat.com > Cc: qemu-devel@nongnu.org; qemu-bl...@nongnu.org > Subject: Re: [PATCH v4 2/2] file-posix: add sg_get_max_segments that > actually works with sg > > On Sun, 2020-09-06 at 23:26 +0800, Tom Yan wrote: > > I don't disagree with your propo

Re: [PATCH v4 2/2] file-posix: add sg_get_max_segments that actually works with sg

2020-09-06 Thread Maxim Levitsky
On Sun, 2020-09-06 at 23:26 +0800, Tom Yan wrote: > I don't disagree with your proposal, but the thing is, do we even need > another field/limit for case 1? For example, do we *really* need to > clamp sizes[2] (NBD_INFO_BLOCK_SIZE) in nbd/server.c and > max_io_sectors (SCSIBlockLimits) in hw/scsi/s

Re: [PATCH v4 2/2] file-posix: add sg_get_max_segments that actually works with sg

2020-09-06 Thread Tom Yan
I don't disagree with your proposal, but the thing is, do we even need another field/limit for case 1? For example, do we *really* need to clamp sizes[2] (NBD_INFO_BLOCK_SIZE) in nbd/server.c and max_io_sectors (SCSIBlockLimits) in hw/scsi/scsi-disk.c to to any kind of "dynamic" limit? Either way

Re: [PATCH v4 2/2] file-posix: add sg_get_max_segments that actually works with sg

2020-09-06 Thread Maxim Levitsky
On Sun, 2020-09-06 at 19:04 +0800, Tom Yan wrote: > Maybe you want to add some condition for this: > https://github.com/qemu/qemu/blob/v5.1.0/nbd/server.c#L659 > Or not clamp it at all. > > On Sun, 6 Sep 2020 at 18:58, Tom Yan wrote: > > In commit 867eccfed84f96b54f4a432c510a02c2ce03b430, Levitsk

Re: [PATCH v4 2/2] file-posix: add sg_get_max_segments that actually works with sg

2020-09-06 Thread Tom Yan
Maybe you want to add some condition for this: https://github.com/qemu/qemu/blob/v5.1.0/nbd/server.c#L659 Or not clamp it at all. On Sun, 6 Sep 2020 at 18:58, Tom Yan wrote: > > In commit 867eccfed84f96b54f4a432c510a02c2ce03b430, Levitsky appears > to have assumed that the only "SCSI Passthrough"

Re: [PATCH v4 2/2] file-posix: add sg_get_max_segments that actually works with sg

2020-09-06 Thread Tom Yan
In commit 867eccfed84f96b54f4a432c510a02c2ce03b430, Levitsky appears to have assumed that the only "SCSI Passthrough" is `-device scsi-generic`, while the fact is there's also `-device scsi-block` (passthrough without the sg driver). Unlike `-device scsi-hd`, getting max_sectors is necessary to it

[PATCH v4 2/2] file-posix: add sg_get_max_segments that actually works with sg

2020-09-03 Thread Tom Yan
sg devices have different major/minor than their corresponding block devices. Using sysfs to get max segments never really worked for them. Fortunately the sg driver provides an ioctl to get sg_tablesize, which is apparently equivalent to max segments. Signed-off-by: Tom Yan --- block/file-posi