Thread (14 messages) 14 messages, 3 authors, 2016-08-25

Re: [PATCH] ata: do not hard code limit in ata_set_lba_range_entries()

From: Tom Yan <hidden>
Date: 2016-08-23 09:37:22
Also in: linux-scsi

On 23 August 2016 at 09:18, Shaun Tancheff [off-list ref] wrote:
On Tue, Aug 23, 2016 at 3:37 AM, Tom Yan [off-list ref] wrote:
quoted
On 23 August 2016 at 07:30, Shaun Tancheff [off-list ref] wrote:
quoted
If we really want/need to avoid hitting some real buffer limit (e.g.
maximum length of scatter/gather list?), then we should in some way
check n_block against that. If it is too large we then return
used_bytes = 0 (optionally with some follow-up to add a response to
such return value or so).
Yes there is a real buffer limit, I can think of these two options:
1- Assume the setups from sd_setup_discard_cmnd() and/
   or sd_setup_write_same_cmnd() are providing an sglist of
   sdp->sector_size via scsi_init_io()
That sounds completely wrong. The scatter/gather list we are talking
about here has nothing to do with the SCSI or block layer anymore. The
SATL has _already_ parsed the SCSI Write Same (16) command and is
packing ranges/payload according to that in this stage. If there is
any limit it would probably the max_segment allowed by the host driver
(e.g. ahci).

It doesn't seem to make sense to me either that we would need to
prevent sglist overflow in such level. Doesn't that mean we would need
to do the same checking (specifically, as in hard coding checks in all
kinds of procedures) in every use of scatter/gather list? That doesn't
sound right at all.
2- Find (or write) a suitable sg_get_size(sgl, nents) to walk the
    sglist and calculate the available buffer size.

#2 sounds like more fun but I'm not sure it's what people would prefer to see.
No idea if such thing exists / makes sense at all.
--
Shaun
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help