Re: [PATCH v5 00/13] scsi: core: fix uninit-value access of variable sshdr

2019-10-18 Thread Damien Le Moal
_ioctl.c | 6 ++ > drivers/scsi/ufs/ufshcd.c | 3 ++- > 13 files changed, 37 insertions(+), 15 deletions(-) > > -- > 2.7.4 > > -- Damien Le Moal Western Digital Research

[PATCH V3] scsi: save/restore command resid for error handling

2019-10-01 Thread Damien Le Moal
original command value in struct scsi_eh_save. Cc: sta...@vger.kernel.org Signed-off-by: Damien Le Moal --- Changes from V2: * Open code resid save/restore to keep the functions style * rename struct scsi_eh_save resid field to resid_len to match struct scsi_request field name Changes from V1

Re: [PATCH V2] scsi: save/restore command resid for error handling

2019-09-30 Thread Damien Le Moal
On 2019/09/30 17:42, Finn Thain wrote: > On Sat, 28 Sep 2019, Damien Le Moal wrote: > >> When a non-passthrough command is terminated with CHECK CONDITION, >> request sense is executed by hijacking the command descriptor. Since >> scsi_eh_prep_cmnd() and scsi_eh_restore_cm

[PATCH V2] scsi: save/restore command resid for error handling

2019-09-27 Thread Damien Le Moal
original command resid value in struct scsi_eh_save. Cc: sta...@vger.kernel.org Signed-off-by: Damien Le Moal --- Changes from V1: * Dropped patch 2 * Add resid reset in scsi_eh_prep_cmnd() drivers/scsi/scsi_error.c | 3 +++ include/scsi/scsi_eh.h| 1 + 2 files changed, 4 insertions(+) diff

Re: [PATCH 0/2] Fix SCSI & USB Storage CHECK CONDITION handling

2019-09-27 Thread Damien Le Moal
On 2019/09/27 9:34, Alan Stern wrote: > On Fri, 27 Sep 2019, Damien Le Moal wrote: > >> On 2019/09/26 16:57, Alan Stern wrote: >>> On Fri, 27 Sep 2019, Damien Le Moal wrote: >>> >>>> If a non-passthrough command is terminated with a CHECK CONDITION, th

Re: [PATCH 0/2] Fix SCSI & USB Storage CHECK CONDITION handling

2019-09-26 Thread Damien Le Moal
On 2019/09/26 16:57, Alan Stern wrote: > On Fri, 27 Sep 2019, Damien Le Moal wrote: > >> If a non-passthrough command is terminated with a CHECK CONDITION, the >> scsi error recovery code reuses the failed command scsi_cmnd structure >> to process error recovery re

[PATCH 2/2] usb: Clear scsi command resid when residue is 0

2019-09-26 Thread Damien Le Moal
: Damien Le Moal --- drivers/usb/storage/transport.c | 9 + 1 file changed, 9 insertions(+) diff --git a/drivers/usb/storage/transport.c b/drivers/usb/storage/transport.c index 96cb0409dd89..c69fcbe467ef 100644 --- a/drivers/usb/storage/transport.c +++ b/drivers/usb/storage/transport.c

[PATCH 1/2] scsi: save/restore command resid for error handling

2019-09-26 Thread Damien Le Moal
: Damien Le Moal --- drivers/scsi/scsi_error.c | 2 ++ include/scsi/scsi_eh.h| 1 + 2 files changed, 3 insertions(+) diff --git a/drivers/scsi/scsi_error.c b/drivers/scsi/scsi_error.c index 1c470e31ae81..d4ac13979189 100644 --- a/drivers/scsi/scsi_error.c +++ b/drivers/scsi/scsi_error.c

[PATCH 0/2] Fix SCSI & USB Storage CHECK CONDITION handling

2019-09-26 Thread Damien Le Moal
usb_stor_Bulk_transport(). Note that usb_stor_CB_transport() does not need changes since usb_stor_bulk_srb() always sets the resid for a completed command, regardless of the residual value. Damien Le Moal (2): scsi: save/restore command resid for error handling usb: Clear scsi command resid when residue is 0

Re: Slow I/O on USB media after commit f664a3cc17b7d0a2bc3b3ab96181e1029b0ec0e6

2019-09-19 Thread Damien Le Moal
On 2019/09/19 16:01, Alan Stern wrote: > On Thu, 19 Sep 2019, Damien Le Moal wrote: > >>> This is exactly the sort of difference one might expect to see from >>> the commit f664a3cc17b7 ("scsi: kill off the legacy IO path") you >>> identified as the

Re: Slow I/O on USB media after commit f664a3cc17b7d0a2bc3b3ab96181e1029b0ec0e6

2019-09-19 Thread Damien Le Moal
On 2019/09/19 10:56, Ming Lei wrote: > On Thu, Sep 19, 2019 at 08:26:32AM +0000, Damien Le Moal wrote: >> On 2019/09/18 18:30, Alan Stern wrote: >>> On Wed, 18 Sep 2019, Andrea Vai wrote: >>> >>>>> Also, I wonder if the changing the size of the data transf

Re: Slow I/O on USB media after commit f664a3cc17b7d0a2bc3b3ab96181e1029b0ec0e6

2019-09-19 Thread Damien Le Moal
nditions. One of these is sync requests on a multiqueue device. We hit this problem on Zoned disks which can easily return an error for write requests without the elevator throttling writes per zones (zone write locking). This problem was discovered by Hans (on CC). I discussed this with Hannes yesterday and we think we have a fix, but we'll need to do a lot of testing as all block devices are potentially impacted by the change, including stacked drivers (DM). Performance regression is scary with any change in that area (see blk_mq_make_request() and use of blk_mq_try_issue_directly() vs blk_mq_sched_insert_request()). -- Damien Le Moal Western Digital Research

[PATCH] scsi: sd: Improve unaligned completion resid message

2019-08-27 Thread Damien Le Moal
For commands completing with a resid not aligned on the device logical sector size, also print the command CDB in addition to the current message to help debug hardware generating such incorrect command completion information. Signed-off-by: Damien Le Moal --- drivers/scsi/sd.c | 1 + 1 file

Re: [PATCH v2] tcmu: avoid use-after-free after command timeout

2019-08-12 Thread Damien Le Moal
if (!test_bit(TCMU_CMD_BIT_EXPIRED, &cmd->flags)) { > + WARN_ON(!cmd->se_cmd); May be WARN_ON_ONCE() similarly to the previous one ? No strong opinion about it though. > list_del_init(&cmd->queue_entry); > if (err_level == 1) { > /* > Apart from the optional nit above: Reviewed-by: Damien Le Moal -- Damien Le Moal Western Digital Research

Re: [PATCH V6 0/4] Fix zone revalidation memory allocation failures

2019-07-12 Thread Damien Le Moal
On 2019/07/13 0:13, Jens Axboe wrote: > On 7/11/19 8:05 PM, Jens Axboe wrote: >> On 7/7/19 8:02 PM, Damien Le Moal wrote: >>> On 2019/07/01 14:09, Damien Le Moal wrote: >>>> This series addresses a recuring problem with zone revalidation >>>> failures obs

Re: [PATCH V6 3/4] sd_zbc: Fix report zones buffer allocation

2019-07-11 Thread Damien Le Moal
problems disappeared and with no side effects detected. Thank you. > Acked-by: Martin K. Petersen Thanks ! -- Damien Le Moal Western Digital Research

Re: [PATCH] sd_zbc: Fix report zones buffer allocation

2019-06-22 Thread Damien Le Moal
On 2019/06/21 0:25, Bart Van Assche wrote: > On 6/19/19 8:48 PM, Damien Le Moal wrote: >> +/* >> + * Limit the command buffer size to the arbitrary SD_ZBC_REPORT_SIZE >> + * size (1MB), allowing up to 16383 zone descriptors being reported with >> + * a si

Re: [PATCH] sd_zbc: Fix report zones buffer allocation

2019-06-21 Thread Damien Le Moal
Bart, On 2019/06/21 12:46, Bart Van Assche wrote: > On 6/20/19 5:58 PM, Damien Le Moal wrote: >> The REPORT_ZONES command is executed using scsi_execute_req(). Can we pass a >> vmalloc-ed buffer to that function ? It does look like it since >> scsi_execute_rq >> ca

Re: [PATCH] sd_zbc: Fix report zones buffer allocation

2019-06-20 Thread Damien Le Moal
Bart, On 2019/06/21 0:25, Bart Van Assche wrote: > On 6/19/19 8:48 PM, Damien Le Moal wrote: >> +/* >> + * Limit the command buffer size to the arbitrary SD_ZBC_REPORT_SIZE >> + * size (1MB), allowing up to 16383 zone descriptors being reported with >> +

[PATCH] sd_zbc: Fix report zones buffer allocation

2019-06-19 Thread Damien Le Moal
("scsi: sd_zbc: Fix sd_zbc_report_zones() buffer allocation") Fixes: e76239a3748c ("block: add a report_zones method") Cc: sta...@vger.kernel.org Signed-off-by: Damien Le Moal --- drivers/scsi/sd_zbc.c | 54 +++ 1 file changed,

[PATCH v2] scsi: sd_zbc: Fix sd_zbc_report_zones() buffer allocation

2019-02-13 Thread Damien Le Moal
xpected reply format rather than the size of the array of generic sturct blkzone passed by blk_report_zones() makes more sense. Fixes: e76239a3748c ("block: add a report_zones method") Cc: sta...@vger.kernel.org Signed-off-by: Masato Suzuki Signed-off-by: Damien Le Moal --- Changes from

Re: [PATCH] scsi: sd_zbc: Fix sd_zbc_report_zones() buffer allocation

2019-02-13 Thread Damien Le Moal
is, BLK_DEF_MAX_SECTORS and max_hw_sectors_kb is several megabytes (16 for SAS and 32 for SATA), which is plenty for even very large blkdev_report_zones() requests. But the value given with smartpqi is too small for even the report zones calls from blk_revalidate_zones(). Updating and resending. Thanks ! -- Damien Le Moal Western Digital Research

[PATCH] scsi: sd_zbc: Fix sd_zbc_report_zones() buffer allocation

2019-02-12 Thread Damien Le Moal
rmat rather than the generic struct blkzone size expected by blk_report_zones() makes more sense. Fixes: e76239a3748c ("block: add a report_zones method") Cc: sta...@vger.kernel.org Signed-off-by: Damien Le Moal Signed-off-by: Masato Suzuki --- drivers/scsi/sd_zbc.c | 8 +--- 1 fi

Re: [LSF/MM TOPIC] : blktests: status, an expansion plan for the storage stack test framework

2019-02-06 Thread Damien Le Moal
. > > We're also lacking tests for things like ioprio, persistent reservation, > bcache and so on. +1 for ioprio discussion. I mentioned my interest in discussing this in my invite request. Having it as a topic would be great. Since we are in the middle of blktest improvements for zoned devices, I can try to put together a proposal as a discussion base. > > Adding support for collecting gcov information after running a test case > would also be awesome (this is missing in xfstests as well). > > So I think a session on blktests can help us get the gap closed. > > Byte, > Johannes > -- Damien Le Moal Western Digital Research

Re: [PATCH] scsi: sd_zbc: Fix zone information messages

2019-02-03 Thread Damien Le Moal
Martin, Any comment on this patch ? On 2019/01/30 7:55, Damien Le Moal wrote: > Commit bf5054569653 ("block: Introduce blk_revalidate_disk_zones()") > inadvertently broke the message output of sd_zbc_print_zones() because > the zone information initialization of the scsi

[PATCH] scsi: sd: Improve sd_print_capacity()

2019-01-29 Thread Damien Le Moal
There is no need to call twice string_get_size() when the capacity messages are not going to be printed. Reverse the message output condition to return early and avoid executing string_get_size() when it is not necessary. Signed-off-by: Damien Le Moal --- drivers/scsi/sd.c | 26

[PATCH] scsi: sd_zbc: Fix zone information messages

2019-01-29 Thread Damien Le Moal
blk_revalidate_zones(). This functions is still called only once the block device capacity is set on the second revalidate run on boot, or if the disk zone configuration changed (i.e. the disk changed). Fixes: bf5054569653 ("block: Introduce blk_revalidate_disk_zones()") Cc: sta...@vger.kerne

Re: [PATCH v4 00/11] Zoned block device support improvements

2018-10-24 Thread Damien Le Moal
Jens, On 2018/10/23 16:59, Jens Axboe wrote: > On 10/12/18 4:08 AM, Damien Le Moal wrote: >> This series improves zoned block device support (reduce overhead) and >> introduces many simplifications to the code (overall, there are more >> deletions >> than inserti

Re: [PATCH v4 00/11] Zoned block device support improvements

2018-10-18 Thread Damien Le Moal
On 2018/10/16 11:34, Jens Axboe wrote: > On 10/14/18 6:45 PM, Damien Le Moal wrote: >> Jens, >> >> On 2018/10/14 7:43, Jens Axboe wrote: >>> On 10/12/18 4:08 AM, Damien Le Moal wrote: >>>> This series improves zoned block device support (reduce overhead) a

Re: [PATCH v4 00/11] Zoned block device support improvements

2018-10-15 Thread Damien Le Moal
Martin, Mike, On 2018/10/16 11:34, Jens Axboe wrote: > On 10/14/18 6:45 PM, Damien Le Moal wrote: >> Jens, >> >> On 2018/10/14 7:43, Jens Axboe wrote: >>> On 10/12/18 4:08 AM, Damien Le Moal wrote: >>>> This series improves zoned block device support

Re: [PATCH v4 00/11] Zoned block device support improvements

2018-10-14 Thread Damien Le Moal
Jens, On 2018/10/14 7:43, Jens Axboe wrote: > On 10/12/18 4:08 AM, Damien Le Moal wrote: >> This series improves zoned block device support (reduce overhead) and >> introduces many simplifications to the code (overall, there are more >> deletions >> than inserti

Re: [PATCH v4 03/11] scsi: sd_zbc: Fix sd_zbc_check_zones() error checks

2018-10-12 Thread Damien Le Moal
On 2018/10/12 19:23, Hannes Reinecke wrote: > On 10/12/18 12:08 PM, Damien Le Moal wrote: >> The unsigned 32 bits overflow check for the zone size value is already >> done within sd_zbc_check_zones() with the test: >> >> } else if (logical_to_sectors(sdkp->d

[PATCH v4 09/11] block: Expose queue nr_zones in sysfs

2018-10-12 Thread Damien Le Moal
. Signed-off-by: Damien Le Moal Reviewed-by: Christoph Hellwig Reviewed-by: Hannes Reinecke --- block/blk-sysfs.c | 11 +++ include/linux/blkdev.h | 10 ++ 2 files changed, 21 insertions(+) diff --git a/block/blk-sysfs.c b/block/blk-sysfs.c index 3772671cf2bc..92be8092ca4f

[PATCH v4 11/11] block: Introduce blk_revalidate_disk_zones()

2018-10-12 Thread Damien Le Moal
bitmaps allocated and initialized with blk_revalidate_disk_zones() are freed automatically from __blk_release_queue() using the block internal function blk_queue_free_zone_bitmaps(). Signed-off-by: Damien Le Moal Reviewed-by: Hannes Reinecke Reviewed-by: Christoph Hellwig --- block/blk-sysfs.c

[PATCH v4 07/11] block: Introduce BLKGETNRZONES ioctl

2018-10-12 Thread Damien Le Moal
Get a zoned block device total number of zones. The device can be a partition of the whole device. The number of zones is always 0 for regular block devices. Signed-off-by: Damien Le Moal Reviewed-by: Hannes Reinecke Reviewed-by: Christoph Hellwig --- block/ioctl.c | 2

[PATCH v4 08/11] block: Improve zone reset execution

2018-10-12 Thread Damien Le Moal
blkdev_reset_zones() to operate similarly to blkdev_issue_discard() using the next_bio() helper for chaining BIOs. To avoid code duplication of that function in blk_zoned.c, rename next_bio() into blk_next_bio() and declare it as a block internal function in blk.h. Signed-off-by: Damien Le Moal

[PATCH v4 10/11] block: add a report_zones method

2018-10-12 Thread Damien Le Moal
: Christoph Hellwig [Damien] * Changed method block_device argument to gendisk * Various bug fixes and improvements * Added support for null_blk, dm-linear and dm-flakey. Signed-off-by: Damien Le Moal Reviewed-by: Hannes Reinecke --- block/blk-core.c | 1 - block/blk-mq-debugfs.c

[PATCH v4 04/11] block: Introduce blkdev_nr_zones() helper

2018-10-12 Thread Damien Le Moal
his helper. Signed-off-by: Damien Le Moal Reviewed-by: Christoph Hellwig Reviewed-by: Hannes Reinecke --- block/blk-zoned.c| 27 +++ drivers/md/dm-zoned-target.c | 3 +-- include/linux/blkdev.h | 5 + 3 files changed, 33 insertions(+), 2 deletions(-) d

[PATCH v4 05/11] block: Limit allocation of zone descriptors for report zones

2018-10-12 Thread Damien Le Moal
There is no point in allocating more zone descriptors than the number of zones a block device has for doing a zone report. Avoid doing that in blkdev_report_zones_ioctl() by limiting the number of zone decriptors allocated internally to process the user request. Signed-off-by: Damien Le Moal

[PATCH v4 06/11] block: Introduce BLKGETZONESZ ioctl

2018-10-12 Thread Damien Le Moal
Get a zoned block device zone size in number of 512 B sectors. The zone size is always 0 for regular block devices. Signed-off-by: Damien Le Moal Reviewed-by: Hannes Reinecke Reviewed-by: Christoph Hellwig --- block/ioctl.c | 2 ++ include/uapi/linux/blkzoned.h | 2 ++ 2 files

[PATCH v4 03/11] scsi: sd_zbc: Fix sd_zbc_check_zones() error checks

2018-10-12 Thread Damien Le Moal
off-by: Damien Le Moal --- drivers/scsi/sd_zbc.c | 19 --- 1 file changed, 8 insertions(+), 11 deletions(-) diff --git a/drivers/scsi/sd_zbc.c b/drivers/scsi/sd_zbc.c index ca73c46931c0..0678e1e108b0 100644 --- a/drivers/scsi/sd_zbc.c +++ b/drivers/scsi/sd_zbc.c @@ -373,7

[PATCH v4 00/11] Zoned block device support improvements

2018-10-12 Thread Damien Le Moal
with zoned block device support disabled * Rebased on latest rc including the most recent dm patches Christoph Hellwig (1): block: add a report_zones method Damien Le Moal (10): scsi: sd_zbc: Rearrange code scsi: sd_zbc: Reduce boot device scan and revalidate time scsi: s

[PATCH v4 02/11] scsi: sd_zbc: Reduce boot device scan and revalidate time

2018-10-12 Thread Damien Le Moal
about 3.5s down to about 900ms. Disk revalidate times are also reduced from about 450ms down to 230ms. Signed-off-by: Damien Le Moal Reviewed-by: Christoph Hellwig Reviewed-by: Hannes Reinecke --- drivers/scsi/sd_zbc.c | 94 ++- 1 file changed, 40 inserti

[PATCH v4 01/11] scsi: sd_zbc: Rearrange code

2018-10-12 Thread Damien Le Moal
(). Also fix the error message displayed when reading that VPD page fails. Signed-off-by: Damien Le Moal Reviewed-by: Christoph Hellwig Reviewed-by: Hannes Reinecke --- drivers/scsi/sd_zbc.c | 39 +++ 1 file changed, 19 insertions(+), 20 deletions(-) diff --git a

Re: [PATCH v3 09/11] block: Expose queue nr_zones in sysfs

2018-10-12 Thread Damien Le Moal
On 2018/10/12 16:41, Hannes Reinecke wrote: > On 10/12/18 4:30 AM, Damien Le Moal wrote: >> Expose through sysfs the nr_zones field of struct request_queue. >> Exposing this value helps in debugging disk issues as well as >> facilitating scripts based use of the disk (e.g.

Re: [PATCH v3 03/11] scsi: sd_zbc: Fix sd_zbc_check_zones() error checks

2018-10-12 Thread Damien Le Moal
On 2018/10/12 16:35, Hannes Reinecke wrote: > On 10/12/18 4:30 AM, Damien Le Moal wrote: >> The 32 bits overflow check for the zone size value is already done >> within sd_zbc_check_zones() with the test: >> >> } else if (logical_to_sectors(sdkp->device, zone_blocks

Re: [PATCH v3 02/11] scsi: sd_zbc: Reduce boot device scan and revalidate time

2018-10-12 Thread Damien Le Moal
On 2018/10/12 16:33, Hannes Reinecke wrote: > On 10/12/18 4:30 AM, Damien Le Moal wrote: >> Handling checks of ZBC device capacity using the max_lba field of the >> REPORT ZONES command reply for disks with rc_basis == 0 can be done >> using the same report zones command re

[PATCH v3 10/11] block: add a report_zones method

2018-10-11 Thread Damien Le Moal
: Christoph Hellwig [Damien] * Changed method block_device argument to gendisk * Various bug fixes and improvements * Added support for null_blk, dm-linear and dm-flakey. Signed-off-by: Damien Le Moal --- block/blk-core.c | 1 - block/blk-mq-debugfs.c | 1 - block/blk-zoned.c

[PATCH v3 11/11] block: Introduce blk_revalidate_disk_zones()

2018-10-11 Thread Damien Le Moal
bitmaps allocated and initialized with blk_revalidate_disk_zones() are freed automatically from __blk_release_queue() using the block internal function blk_queue_free_zone_bitmaps(). Signed-off-by: Damien Le Moal --- block/blk-sysfs.c | 2 + block/blk-zoned.c | 136

[PATCH v3 08/11] block: Improve zone reset execution

2018-10-11 Thread Damien Le Moal
blkdev_reset_zones() to operate similarly to blkdev_issue_discard() using the next_bio() helper for chaining BIOs. To avoid code duplication of that function in blk_zoned.c, rename next_bio() into blk_next_bio() and declare it as a block internal function in blk.h. Signed-off-by: Damien Le Moal

[PATCH v3 09/11] block: Expose queue nr_zones in sysfs

2018-10-11 Thread Damien Le Moal
. Signed-off-by: Damien Le Moal --- block/blk-sysfs.c | 11 +++ include/linux/blkdev.h | 10 ++ 2 files changed, 21 insertions(+) diff --git a/block/blk-sysfs.c b/block/blk-sysfs.c index 3772671cf2bc..92be8092ca4f 100644 --- a/block/blk-sysfs.c +++ b/block/blk-sysfs.c @@ -300,6

[PATCH v3 04/11] block: Introduce blkdev_nr_zones() helper

2018-10-11 Thread Damien Le Moal
his helper. Signed-off-by: Damien Le Moal Reviewed-by: Christoph Hellwig --- block/blk-zoned.c| 27 +++ drivers/md/dm-zoned-target.c | 3 +-- include/linux/blkdev.h | 5 + 3 files changed, 33 insertions(+), 2 deletions(-) diff --git a/block/blk-zoned.

[PATCH v3 00/11] Zoned block device support improvements

2018-10-11 Thread Damien Le Moal
v1: * Addressed Christoph's and Bart's comments * Fixed several compilation errors with zoned block device support disabled * Rebased on latest rc including the most recent dm patches Christoph Hellwig (1): block: add a report_zones method Damien Le Moal (10): scsi: sd_zbc: Rear

[PATCH v3 03/11] scsi: sd_zbc: Fix sd_zbc_check_zones() error checks

2018-10-11 Thread Damien Le Moal
nd fix sd_zbc_check_zones() error return to -EFBIG instead of -ENODEV if the zone size is too large. Signed-off-by: Damien Le Moal Reviewed-by: Christoph Hellwig --- drivers/scsi/sd_zbc.c | 15 ++- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/drivers/scsi/sd_zbc.c b/d

[PATCH v3 01/11] scsi: sd_zbc: Rearrange code

2018-10-11 Thread Damien Le Moal
(). Also fix the error message displayed when reading that VPD page fails. Signed-off-by: Damien Le Moal Reviewed-by: Christoph Hellwig --- drivers/scsi/sd_zbc.c | 39 +++ 1 file changed, 19 insertions(+), 20 deletions(-) diff --git a/drivers/scsi/sd_zbc.c b/drivers

[PATCH v3 06/11] block: Introduce BLKGETZONESZ ioctl

2018-10-11 Thread Damien Le Moal
Get a zoned block device zone size in number of 512 B sectors. The zone size is always 0 for regular block devices. Signed-off-by: Damien Le Moal --- block/ioctl.c | 2 ++ include/uapi/linux/blkzoned.h | 2 ++ 2 files changed, 4 insertions(+) diff --git a/block/ioctl.c b/block

[PATCH v3 02/11] scsi: sd_zbc: Reduce boot device scan and revalidate time

2018-10-11 Thread Damien Le Moal
about 3.5s down to about 900ms. Disk revalidate times are also reduced from about 450ms down to 230ms. Signed-off-by: Damien Le Moal Reviewed-by: Christoph Hellwig --- drivers/scsi/sd_zbc.c | 94 ++- 1 file changed, 40 insertions(+), 54 deletions(-) di

[PATCH v3 07/11] block: Introduce BLKGETNRZONES ioctl

2018-10-11 Thread Damien Le Moal
Get a zoned block device total number of zones. The device can be a partition of the whole device. The number of zones is always 0 for regular block devices. Signed-off-by: Damien Le Moal --- block/ioctl.c | 2 ++ include/uapi/linux/blkzoned.h | 1 + 2 files changed, 3

[PATCH v3 05/11] block: Limit allocation of zone descriptors for report zones

2018-10-11 Thread Damien Le Moal
There is no point in allocating more zone descriptors than the number of zones a block device has for doing a zone report. Avoid doing that in blkdev_report_zones_ioctl() by limiting the number of zone decriptors allocated internally to process the user request. Signed-off-by: Damien Le Moal

Re: [PATCH v2 09/11] block: Expose queue nr_zones in sysfs

2018-10-11 Thread Damien Le Moal
ere conditional on CONFIG_BLK_DEV_ZONED? > Yes, I guess it would. #ifdef in c code is normally not welcome, so I was a little heavy handed with this v2 change to avoid adding any to blk-sysfs.c :) I will rework this and send a v3. Thanks for the review. -- Damien Le Moal Western Digital Research

[PATCH v2 10/11] block: add a report_zones method

2018-10-11 Thread Damien Le Moal
: Christoph Hellwig [Damien] * Changed method block_device argument to gendisk * Various bug fixes and improvements * Added support for null_blk, dm-linear and dm-flakey. Signed-off-by: Damien Le Moal --- block/blk-core.c | 1 - block/blk-mq-debugfs.c | 1 - block/blk-zoned.c

[PATCH v2 09/11] block: Expose queue nr_zones in sysfs

2018-10-11 Thread Damien Le Moal
(e.g. blktests). Signed-off-by: Damien Le Moal --- block/blk-sysfs.c | 11 +++ include/linux/blkdev.h | 2 +- 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/block/blk-sysfs.c b/block/blk-sysfs.c index 3772671cf2bc..f7060a938bf9 100644 --- a/block/blk-sysfs.c +++ b

[PATCH v2 11/11] block: Introduce blk_revalidate_disk_zones()

2018-10-11 Thread Damien Le Moal
bitmaps allocated and initialized with blk_revalidate_disk_zones() are freed automatically from __blk_release_queue() using the block internal function blk_queue_free_zone_bitmaps(). Signed-off-by: Damien Le Moal --- block/blk-sysfs.c | 2 + block/blk-zoned.c | 136

[PATCH v2 08/11] block: Improve zone reset execution

2018-10-11 Thread Damien Le Moal
blkdev_reset_zones() to operate similarly to blkdev_issue_discard() using the next_bio() helper for chaining BIOs. To avoid code duplication of that function in blk_zoned.c, rename next_bio() into blk_next_bio() and declare it as a block internal function in blk.h. Signed-off-by: Damien Le Moal

[PATCH v2 02/11] scsi: sd_zbc: Reduce boot device scan and revalidate time

2018-10-11 Thread Damien Le Moal
about 3.5s down to about 900ms. Disk revalidate times are also reduced from about 450ms down to 230ms. Signed-off-by: Damien Le Moal Reviewed-by: Christoph Hellwig --- drivers/scsi/sd_zbc.c | 94 ++- 1 file changed, 40 insertions(+), 54 deletions(-) di

[PATCH v2 06/11] block: Introduce BLKGETZONESZ ioctl

2018-10-11 Thread Damien Le Moal
Get a zoned block device zone size in number of 512 B sectors. The zone size is always 0 for regular block devices. Signed-off-by: Damien Le Moal --- block/ioctl.c | 2 ++ include/uapi/linux/blkzoned.h | 2 ++ 2 files changed, 4 insertions(+) diff --git a/block/ioctl.c b/block

[PATCH v2 03/11] scsi: sd_zbc: Fix sd_zbc_check_zones() error checks

2018-10-11 Thread Damien Le Moal
nd fix sd_zbc_check_zones() error return to -EFBIG instead of -ENODEV if the zone size is too large. Signed-off-by: Damien Le Moal Reviewed-by: Christoph Hellwig --- drivers/scsi/sd_zbc.c | 15 ++- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/drivers/scsi/sd_zbc.c b/d

[PATCH v2 00/11] Zoned block device support improvements

2018-10-11 Thread Damien Le Moal
latest rc including the most recent dm patches Christoph Hellwig (1): block: add a report_zones method Damien Le Moal (10): scsi: sd_zbc: Rearrange code scsi: sd_zbc: Reduce boot device scan and revalidate time scsi: sd_zbc: Fix sd_zbc_check_zones() error checks block: Introduce blkde

[PATCH v2 05/11] block: Limit allocation of zone descriptors for report zones

2018-10-11 Thread Damien Le Moal
There is no point in allocating more zone descriptors than the number of zones a block device has for doing a zone report. Avoid doing that in blkdev_report_zones_ioctl() by limiting the number of zone decriptors allocated internally to process the user request. Signed-off-by: Damien Le Moal

[PATCH v2 01/11] scsi: sd_zbc: Rearrange code

2018-10-11 Thread Damien Le Moal
(). Also fix the error message displayed when reading that VPD page fails. Signed-off-by: Damien Le Moal Reviewed-by: Christoph Hellwig --- drivers/scsi/sd_zbc.c | 39 +++ 1 file changed, 19 insertions(+), 20 deletions(-) diff --git a/drivers/scsi/sd_zbc.c b/drivers

[PATCH v2 07/11] block: Introduce BLKGETNRZONES ioctl

2018-10-11 Thread Damien Le Moal
Get a zoned block device total number of zones. The device can be a partition of the whole device. The number of zones is always 0 for regular block devices. Signed-off-by: Damien Le Moal --- block/ioctl.c | 2 ++ include/uapi/linux/blkzoned.h | 1 + 2 files changed, 3

[PATCH v2 04/11] block: Introduce blkdev_nr_zones() helper

2018-10-11 Thread Damien Le Moal
his helper. Signed-off-by: Damien Le Moal Reviewed-by: Christoph Hellwig --- block/blk-zoned.c| 27 +++ drivers/md/dm-zoned-target.c | 3 +-- include/linux/blkdev.h | 5 + 3 files changed, 33 insertions(+), 2 deletions(-) diff --git a/block/blk-zoned.

[PATCH 10/11] block: add a report_zones method

2018-10-09 Thread Damien Le Moal
improvements * Added support for null_blk, dm-linear and dm-flakey. Signed-off-by: Damien Le Moal --- block/blk-core.c | 1 - block/blk-mq-debugfs.c | 1 - block/blk-zoned.c | 164 ++--- drivers/block/null_blk.h | 11 ++- drivers

[PATCH 06/11] block: Introduce BLKGETZONESZ ioctl

2018-10-09 Thread Damien Le Moal
Get a zoned block device zone size in number of 512 B sectors. The zone size is always 0 for regular block devices. Signed-off-by: Damien Le Moal --- block/ioctl.c | 2 ++ include/uapi/linux/blkzoned.h | 2 ++ 2 files changed, 4 insertions(+) diff --git a/block/ioctl.c b/block

[PATCH 11/11] block: Introduce revalidate_disk_zones()

2018-10-09 Thread Damien Le Moal
initialized by revalidate_disk_zones() are freed automatically from __blk_release_queue() using the block internal function blk_queue_free_zone_bitmaps(). Signed-off-by: Damien Le Moal --- block/blk-sysfs.c | 2 + block/blk-zoned.c | 137 + block/blk.h

[PATCH 04/11] block: Introduce blkdev_nr_zones() helper

2018-10-09 Thread Damien Le Moal
his helper. Signed-off-by: Damien Le Moal --- block/blk-zoned.c| 27 +++ drivers/md/dm-zoned-target.c | 3 +-- include/linux/blkdev.h | 5 + 3 files changed, 33 insertions(+), 2 deletions(-) diff --git a/block/blk-zoned.c b/block/blk-zoned.c in

[PATCH 05/11] block: Limit allocation of zone descriptors for report zones

2018-10-09 Thread Damien Le Moal
There is no point in allocating more zone descriptors than the number of zones a block device has for doing a zone report. Avoid doing that in blkdev_report_zones_ioctl() by limiting the number of zone decriptors allocated internally to process the user request. Signed-off-by: Damien Le Moal

[PATCH 07/11] block: Introduce BLKGETNRZONES ioctl

2018-10-09 Thread Damien Le Moal
Get a zoned block device total number of zones. The device can be a partition of the whole device. The number of zones is always 0 for regular block devices. Signed-off-by: Damien Le Moal --- block/ioctl.c | 2 ++ include/uapi/linux/blkzoned.h | 1 + 2 files changed, 3

[PATCH 08/11] block: Improve zone reset execution

2018-10-09 Thread Damien Le Moal
blkdev_reset_zones() to operate similarly to blkdev_issue_discard() using the next_bio() helper for chaining BIOs. To avoid code duplication of that function in blk_zoned.c, rename next_bio() into blk_next_bio() and declare it as a block internal function in blk.h. Signed-off-by: Damien Le Moal

[PATCH 01/11] scsi: sd_zbc: Rearrange code

2018-10-09 Thread Damien Le Moal
(). Also fix the error message displayed when reading that VPD page fails. Signed-off-by: Damien Le Moal --- drivers/scsi/sd_zbc.c | 39 +++ 1 file changed, 19 insertions(+), 20 deletions(-) diff --git a/drivers/scsi/sd_zbc.c b/drivers/scsi/sd_zbc.c index

[PATCH 02/11] scsi: sd_zbc: Reduce boot device scan and revalidate time

2018-10-09 Thread Damien Le Moal
about 3.5s down to about 900ms. Disk revalidate times are also reduced from about 450ms down to 230ms. Signed-off-by: Damien Le Moal --- drivers/scsi/sd_zbc.c | 94 ++- 1 file changed, 40 insertions(+), 54 deletions(-) diff --git a/drivers/scsi/sd_zbc.c b/dr

[PATCH 00/11] Zoned block device support improvements

2018-10-09 Thread Damien Le Moal
Christoph Hellwig (1): block: add a report_zones method Damien Le Moal (10): scsi: sd_zbc: Rearrange code scsi: sd_zbc: Reduce boot device scan and revalidate time scsi: sd_zbc: Fix sd_zbc_check_zones() error checks block: Introduce blkdev_nr_zones() helper block: Limit allocati

[PATCH 09/11] block: Expose queue nr_zones in sysfs

2018-10-09 Thread Damien Le Moal
(e.g. blktests). Signed-off-by: Damien Le Moal --- block/blk-sysfs.c | 11 +++ 1 file changed, 11 insertions(+) diff --git a/block/blk-sysfs.c b/block/blk-sysfs.c index 3772671cf2bc..f7060a938bf9 100644 --- a/block/blk-sysfs.c +++ b/block/blk-sysfs.c @@ -300,6 +300,11 @@ static ssize_t

[PATCH 03/11] scsi: sd_zbc: Fix sd_zbc_check_zones() error checks

2018-10-09 Thread Damien Le Moal
nd fix sd_zbc_check_zones() error return to -EFBIG instead of -ENODEV if the zone size is too large. Signed-off-by: Damien Le Moal --- drivers/scsi/sd_zbc.c | 15 ++- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/drivers/scsi/sd_zbc.c b/drivers/scsi/sd_zbc.c index ca73c4

Re: [RFC PATCH 1/5] add tweakable bounds_check flag, now off by default

2018-08-21 Thread Damien Le Moal
ommand(): one for protect, one for ZBC/ZAC and one for the > rest (the most common case, I assume). That leaves open the question can a ZBC > disk also have protection information :-) I do not know of any such drive on the market. The standards certainly do not prevent it, so that is something that we should have as a possibility. Best regards. -- Damien Le Moal Western Digital Research

Re: [RFC PATCH 2/5] break sd_done sense processing out to own function

2018-08-05 Thread Damien Le Moal
1; > - sd_config_write_same(sdkp); > - req->__data_len = blk_rq_bytes(req); > - req->rq_flags |= RQF_QUIET; > - } > - break; > - } > - } > - break; > - default: > - break; > - } > - > - out: > if (sd_is_zoned(sdkp)) > sd_zbc_complete(SCpnt, good_bytes, &sshdr); > > -- Damien Le Moal Western Digital Research

Re: [RFC PATCH 1/5] add tweakable bounds_check flag, now off by default

2018-08-05 Thread Damien Le Moal
k_rq_sectors(rq) & mask))) { > + scmd_printk(KERN_ERR, cmd, > + "request not aligned to logical block size\n"); > + ret = BLKPREP_KILL; > + goto out; > + } > } > > /* > diff --git a/drivers/scsi/sd.h b/drivers/scsi/sd.h > index 392c7d078ae3..6f58d130fb75 100644 > --- a/drivers/scsi/sd.h > +++ b/drivers/scsi/sd.h > @@ -117,6 +117,7 @@ struct scsi_disk { > unsignedurswrz : 1; > unsignedsecurity : 1; > unsignedignore_medium_access_errors : 1; > + unsignedbounds_check : 1; > }; > #define to_scsi_disk(obj) container_of(obj,struct scsi_disk,dev) > > -- Damien Le Moal Western Digital Research

Re: [RFC PATCH 3/5] streamline REQ_OP_READ-WRITE access

2018-08-05 Thread Damien Le Moal
m constants. Place check here because only need to check > + * early and once. > + */ > + if (REQ_OP_READ + REQ_OP_WRITE > 1) > + pr_err("%s: REQ_OP_READ=%d REQ_OP_WRITE=%d %s.\n", __func__, > +REQ_OP_READ, REQ_OP_WRITE, > +"expected 0 and 1. Logic ERROR"); > > for (i = 0; i < SD_MAJORS; i++) { > if (register_blkdev(sd_major(i), "sd") != 0) > -- Damien Le Moal Western Digital Research

Re: [RFC PATCH 4/5] streamline some logical operations

2018-08-05 Thread Damien Le Moal
ver_byte(result) == DRIVER_SENSE || > + (sense_valid && (!scsi_sense_is_deferred(&sshdr > + good_bytes = sd_done_sense(SCpnt, good_bytes, &sshdr); > } > - sdkp->medium_access_timed_out = 0; > > - if (unlikely(driver_byte(result) == DRIVER_SENSE || > - (sense_valid && !sense_deferred))) > - good_bytes = sd_done_sense(SCpnt, good_bytes, &sshdr); > + sdkp->medium_access_timed_out = 0; > > if (sd_is_zoned(sdkp)) > sd_zbc_complete(SCpnt, good_bytes, &sshdr); > -- Damien Le Moal Western Digital Research

[PATCH] scsi: sd_zbc: Fix variable type and bogus comment

2018-07-02 Thread Damien Le Moal
ot;ret" type to s64. Fixes: ccce20fc79 ("sd_zbc: Avoid that resetting a zone fails sporadically") Signed-off-by: Damien Le Moal Cc: Bart Van Assche Cc: sta...@kernel.org --- drivers/scsi/sd_zbc.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/drivers/scsi/sd

[PATCH V2 2/2] ata: Fix ZBC_OUT all bit handling

2018-06-26 Thread Damien Le Moal
If the ALL bit is set in the ZBC_OUT command, the command zone ID field (block) should be ignored. Reported-by: David Butterfield Signed-off-by: Damien Le Moal Cc: sta...@vger.kernel.org --- drivers/ata/libata-scsi.c | 11 --- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git

[PATCH V2 1/2] ata: Fix ZBC_OUT command block check

2018-06-26 Thread Damien Le Moal
a zone start LBA should be ILLEGAL REQUEST, regardless if the bad LBA is out of range. Reported-by: David Butterfield Signed-off-by: Damien Le Moal Cc: sta...@vger.kernel.org --- drivers/ata/libata-scsi.c | 13 +++-- 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/drivers/ata

[PATCH V2 0/2] ZBC_OUT command translation fixes

2018-06-26 Thread Damien Le Moal
incorrect) LBA OUT OF RANGE. The second patch disables the ZBC_OUT command block address check if the ALL bit is set, as defined by the ZBC specifications. Thank you for considering these patches for inclusion in 4.18 fixes (and CC stable). Damien Le Moal (2): ata: Fix ZBC_OUT command block check

[PATCH V2 0/2] ZBC_OUT command translation fixes

2018-06-26 Thread Damien Le Moal
incorrect) LBA OUT OF RANGE. The second patch disables the ZBC_OUT command block address check if the ALL bit is set, as defined by the ZBC specifications. Thank you for considering these patches for inclusion in 4.18 fixes (and CC stable). Damien Le Moal (2): ata: Fix ZBC_OUT command block check

[PATCH 1/2] ata: Fix ZBC_OUT command block check

2018-06-26 Thread Damien Le Moal
a zone start LBA should be ILLEGAL REQUEST, regardless if the bad LBA is out of range. Reported-by: David Butterfield Signed-off-by: Damien Le Moal --- drivers/ata/libata-scsi.c | 13 +++-- 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/drivers/ata/libata-scsi.c b/drivers/a

[PATCH 0/2] ZBC_OUT command translation fixes

2018-06-26 Thread Damien Le Moal
incorrect) LBA OUT OF RANGE. The second patch disables the ZBC_OUT command block address check if the ALL bit is set, as defined by the ZBC specifications. Thank you for considering these patches for inclusion in 4.18 fixes (and CC stable). Damien Le Moal (2): ata: Fix ZBC_OUT command block check

[PATCH 2/2] ata: Fix ZBC_OUT all bit handling

2018-06-26 Thread Damien Le Moal
If the ALL bit is set in the ZBC_OUT command, the command zone ID field (block) should be ignored. Reported-by: David Butterfield Signed-off-by: Damien Le Moal --- drivers/ata/libata-scsi.c | 11 --- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/drivers/ata/libata

[PATCH v2 0/2] 4.14 long term stable ZBC fixes

2018-06-04 Thread Damien Le Moal
setting a zone fails sporadically Damien Le Moal (1): scsi: sd_zbc: Fix potential memory leak drivers/scsi/sd_zbc.c | 128 +- 1 file changed, 76 insertions(+), 52 deletions(-) Changes from v1: * Fixed upstream commit reference in the first patch commit message -- 2.17.0

[PATCH v2 1/2] scsi: sd_zbc: Fix potential memory leak

2018-06-04 Thread Damien Le Moal
[Backport of upstream commit 4b433924b2755a94f99258c178684a0e05c344de] Rework sd_zbc_check_zone_size() to avoid a memory leak due to an early return if sd_zbc_report_zones() fails. Signed-off-by: Damien Le Moal Cc: sta...@vger.kernel.org # 4.14 --- drivers/scsi/sd_zbc.c | 34

[PATCH v2 2/2] scsi: sd_zbc: Avoid that resetting a zone fails sporadically

2018-06-04 Thread Damien Le Moal
t;) Signed-off-by: Bart Van Assche [Damien] * Backport for 4.14-stable * Updated this commit message Signed-off-by: Damien Le Moal Cc: sta...@vger.kernel.org # 4.14 --- drivers/scsi/sd_zbc.c | 98 +++ 1 file changed, 63 insertions(+), 35 deletions(-) di

  1   2   3   4   5   >