Re: [PATCH v2 2/2] libata-core: do not set dev->max_sectors for LBA48 devices

2016-08-11 Thread Tom Yan
On 12 August 2016 at 10:01, Martin K. Petersen wrote: > > Again, the point of max_hw_sectors and max_dev_sectors is to enforce the > hard limits of controller and device respectively. Nothing else. > Sounds like libata-scsi is doing something wrong then. It should not set max_hw_sectors to dev->m

Re: [RFC] libata-scsi: make sure Maximum Write Same Length is not too large

2016-08-11 Thread Tom Yan
On 12 August 2016 at 09:34, Martin K. Petersen wrote: >> "Tom," == tom ty89 writes: > > Tom, > > + put_unaligned_be64(65535 * ATA_MAX_TRIM_RNUM / > + (sector_size / 512), &rbuf[36]); > > MAXIMUM WRITE SAME LENGTH is in units of the device's logic

Re: [RFC] sd: dynamically adjust SD_MAX_WS16_BLOCKS as per the actual logical block size

2016-08-11 Thread Tom Yan
On 12 August 2016 at 11:10, Martin K. Petersen wrote: > > However, the CDB transfer length limit is really not the main issue > here, it's bi_size that we need to enforce. > > After contemplating a bit I think it would be cleanest to add > BLK_MAX_BIO_SECTORS and clamp on that in blk_queue_max_foo

Re: [RFC] sd: dynamically adjust SD_MAX_WS16_BLOCKS as per the actual logical block size

2016-08-11 Thread Martin K. Petersen
> "Tom" == tom ty89 writes: Tom, Tom> However, SD_MAX_WS16_BLOCKS is used to check values that are, for Tom> example, orignated from Maximum Write Same Length field on the Tom> Block Limit VPD. Such field expresses the number of blocks in terms Tom> of the actual logical sector size of the s

Re: [PATCH v2 2/2] libata-core: do not set dev->max_sectors for LBA48 devices

2016-08-11 Thread Martin K. Petersen
> "Tom" == Tom Yan writes: Hey Tom, Tom> Shouldn't we use Maximum Transfer Length to derive max_sectors (and Tom> get rid of the almost useless max_dev_sectors)? MAXIMUM TRANSFER LENGTH could be gigabytes. Some disks report it as the full capacity of the device. Again, the point of max_hw_

Re: [RFC] libata-scsi: make sure Maximum Write Same Length is not too large

2016-08-11 Thread Martin K. Petersen
> "Tom," == tom ty89 writes: Tom, + put_unaligned_be64(65535 * ATA_MAX_TRIM_RNUM / + (sector_size / 512), &rbuf[36]); MAXIMUM WRITE SAME LENGTH is in units of the device's logical block size. -- Martin K. Petersen Oracle Linux Engineerin

[RFC] sd: dynamically adjust SD_MAX_WS16_BLOCKS as per the actual logical block size

2016-08-11 Thread tom . ty89
From: Tom Yan WRITE SAME (16) command can technically handle up to 32-bit number of blocks. However, since 32-bit is also the limitation of the maximum number of bytes that can be represented in the block layer, the current SD_MAX_WS16_BLOCKS was hence derived from the technical limit devided by

Re: [RFC] libata-scsi: make sure Maximum Write Same Length is not too large

2016-08-11 Thread Tom Yan
The patch isn't about how the request from the block layer will be processed (to form the SCSI commands). What it addresses is blk_queue_max_write_same_sectors() and blk_queue_max_discard_sectors() that are called in the SCSI disk driver. You can see that they are called with an input of the Maxim

Re: [RFC] libata-scsi: make sure Maximum Write Same Length is not too large

2016-08-11 Thread Shaun Tancheff
On Thu, Aug 11, 2016 at 3:26 AM, wrote: > From: Tom Yan > > Currently we advertise Maximum Write Same Length based on the > maximum number of sectors that one-block TRIM payload can cover. > The field are used to derived discard_max_bytes and > write_same_max_bytes limits in the block layer, whi

Re: [PATCH] bvec: avoid variable shadowing warning

2016-08-11 Thread Jens Axboe
On 08/11/2016 02:15 AM, Johannes Berg wrote: From: Johannes Berg Due to the (indirect) nesting of min(..., min(...)), sparse will show a variable shadowing warning whenever bvec.h is included. Avoid that by assigning the inner min() to a temporary variable first. Grumble, reluctantly applied

Re: [PATCH v2] block: make sure big bio is splitted into at most 256 bvecs

2016-08-11 Thread Christoph Hellwig
Please just fix bcache to not submit bios larger than BIO_MAX_PAGES for now, until we can support such callers in general and enable common used code to do so. -- To unsubscribe from this list: send the line "unsubscribe linux-block" in the body of a message to majord...@vger.kernel.org More majord

Re: [PATCH v2 2/2] libata-core: do not set dev->max_sectors for LBA48 devices

2016-08-11 Thread Tom Yan
On 11 August 2016 at 11:37, Martin K. Petersen wrote: >> "Tom" == Tom Yan writes: > > I don't agree with conflating the optimal transfer size and the maximum > supported ditto. Submitting the largest possible I/O to a device does > not guarantee that you get the best overall performance. > >

[RFC] libata-scsi: make sure Maximum Write Same Length is not too large

2016-08-11 Thread tom . ty89
From: Tom Yan Currently we advertise Maximum Write Same Length based on the maximum number of sectors that one-block TRIM payload can cover. The field are used to derived discard_max_bytes and write_same_max_bytes limits in the block layer, which currently can at max be 0x (32-bit). Howe

[PATCH] bvec: avoid variable shadowing warning

2016-08-11 Thread Johannes Berg
From: Johannes Berg Due to the (indirect) nesting of min(..., min(...)), sparse will show a variable shadowing warning whenever bvec.h is included. Avoid that by assigning the inner min() to a temporary variable first. Signed-off-by: Johannes Berg --- include/linux/bvec.h | 3 ++- 1 file chan