1. 06 11月, 2018 5 次提交
    • Y
      scsi: hisi_sas: Remove set but not used variable 'dq_list' · e34ff8ed
      YueHaibing 提交于
      Fixes gcc '-Wunused-but-set-variable' warning:
      
      drivers/scsi/hisi_sas/hisi_sas_v1_hw.c: In function 'start_delivery_v1_hw':
      drivers/scsi/hisi_sas/hisi_sas_v1_hw.c:907:20: warning:
       variable 'dq_list' set but not used [-Wunused-but-set-variable]
      
      drivers/scsi/hisi_sas/hisi_sas_v2_hw.c: In function 'start_delivery_v2_hw':
      drivers/scsi/hisi_sas/hisi_sas_v2_hw.c:1671:20: warning:
       variable 'dq_list' set but not used [-Wunused-but-set-variable]
      
      drivers/scsi/hisi_sas/hisi_sas_v3_hw.c: In function 'start_delivery_v3_hw':
      drivers/scsi/hisi_sas/hisi_sas_v3_hw.c:889:20: warning:
       variable 'dq_list' set but not used [-Wunused-but-set-variable]
      
      It never used since introduction in commit
      fa222db0 ("scsi: hisi_sas: Don't lock DQ for complete task sending")
      Signed-off-by: NYueHaibing <yuehaibing@huawei.com>
      Acked-by: NJohn Garry <john.garry@huawei.com>
      Signed-off-by: NMartin K. Petersen <martin.petersen@oracle.com>
      e34ff8ed
    • A
      scsi: myrs: only build on little-endian platforms · a3ecf482
      Arnd Bergmann 提交于
      Reading throught the new driver, I noticed that this cannot work on
      big-endian CPUs, and the old DAC960 had exactly the same behavior.
      
      To document this for the future, add a Kconfig dependency that prevents it
      from being included in big-endian kernels.  Since the hardware is really
      old and we never had a working driver on it for big-endian platforms,
      it's unlikely to make a difference to users.
      Signed-off-by: NArnd Bergmann <arnd@arndb.de>
      Reviewed-by: NHannes Reinecke <hare@suse.com>
      Signed-off-by: NMartin K. Petersen <martin.petersen@oracle.com>
      a3ecf482
    • A
      scsi: myrs: avoid stack overflow warning · 77409c4c
      Arnd Bergmann 提交于
      Putting a 1024 byte data structure on the stack is generally a bad idea.
      On 32-bit systems, it also triggers a compile-time warning when building
      with -Og:
      
      drivers/scsi/myrs.c: In function 'myrs_get_ctlr_info':
      drivers/scsi/myrs.c:212:1: error: the frame size of 1028 bytes is larger than 1024 bytes [-Werror=frame-larger-than=]
      
      We only really need three members of the structure, so just read them
      manually here instead of copying the entire structure.
      
      Fixes: 77266186 ("scsi: myrs: Add Mylex RAID controller (SCSI interface)")
      Signed-off-by: NArnd Bergmann <arnd@arndb.de>
      Reviewed-by: NHannes Reinecke <hare@suse.com>
      Signed-off-by: NMartin K. Petersen <martin.petersen@oracle.com>
      77409c4c
    • A
      scsi: lpfc: fix remoteport access · f8d29432
      Arnd Bergmann 提交于
      The addition of a spinlock in lpfc_debugfs_nodelist_data() introduced
      a bug that lets us not skip NULL pointers correctly, as noticed by
      gcc-8:
      
      drivers/scsi/lpfc/lpfc_debugfs.c: In function 'lpfc_debugfs_nodelist_data.constprop':
      drivers/scsi/lpfc/lpfc_debugfs.c:728:13: error: 'nrport' may be used uninitialized in this function [-Werror=maybe-uninitialized]
         if (nrport->port_role & FC_PORT_ROLE_NVME_INITIATOR)
      
      This changes the logic back to what it was, while keeping the added
      spinlock.
      
      Fixes: 9e210178 ("scsi: lpfc: Synchronize access to remoteport via rport")
      Signed-off-by: NArnd Bergmann <arnd@arndb.de>
      Reviewed-by: NJohannes Thumshirn <jthumshirn@suse.de>
      Signed-off-by: NMartin K. Petersen <martin.petersen@oracle.com>
      f8d29432
    • A
      scsi: myrb: fix sprintf buffer overflow warning · f8f4adc1
      Arnd Bergmann 提交于
      gcc warns that the 12 byte fw_version field might not be long enough to
      contain the generated firmware name string:
      
      drivers/scsi/myrb.c: In function 'myrb_get_hba_config':
      drivers/scsi/myrb.c:1052:38: error: '%02d' directive writing between 2 and 3 bytes into a region of size between 2 and 5 [-Werror=format-overflow=]
        sprintf(cb->fw_version, "%d.%02d-%c-%02d",
                                            ^~~~
      drivers/scsi/myrb.c:1052:26: note: directive argument in the range [0, 255]
        sprintf(cb->fw_version, "%d.%02d-%c-%02d",
                                ^~~~~~~~~~~~~~~~~
      drivers/scsi/myrb.c:1052:2: note: 'sprintf' output between 10 and 14 bytes into a destination of size 12
        sprintf(cb->fw_version, "%d.%02d-%c-%02d",
        ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
         enquiry2->fw.major_version,
         ~~~~~~~~~~~~~~~~~~~~~~~~~~~
         enquiry2->fw.minor_version,
         ~~~~~~~~~~~~~~~~~~~~~~~~~~~
         enquiry2->fw.firmware_type,
         ~~~~~~~~~~~~~~~~~~~~~~~~~~~
         enquiry2->fw.turn_id);
         ~~~~~~~~~~~~~~~~~~~~~
      
      I have not checked whether there are appropriate range checks before the
      sprintf, but there is a range check after it that will bail out in case
      of out of range version numbers. This means we can simply use snprintf()
      instead of sprintf() to limit the output buffer size, and it will work
      correctly.
      
      Fixes: 081ff398 ("scsi: myrb: Add Mylex RAID controller (block interface)")
      Signed-off-by: NArnd Bergmann <arnd@arndb.de>
      Reviewed-by: NHannes Reinecke <hare@suse.com>
      Signed-off-by: NMartin K. Petersen <martin.petersen@oracle.com>
      f8f4adc1
  2. 01 11月, 2018 2 次提交
  3. 26 10月, 2018 5 次提交
    • D
      block: Introduce blk_revalidate_disk_zones() · bf505456
      Damien Le Moal 提交于
      Drivers exposing zoned block devices have to initialize and maintain
      correctness (i.e. revalidate) of the device zone bitmaps attached to
      the device request queue (seq_zones_bitmap and seq_zones_wlock).
      
      To simplify coding this, introduce a generic helper function
      blk_revalidate_disk_zones() suitable for most (and likely all) cases.
      This new function always update the seq_zones_bitmap and seq_zones_wlock
      bitmaps as well as the queue nr_zones field when called for a disk
      using a request based queue. For a disk using a BIO based queue, only
      the number of zones is updated since these queues do not have
      schedulers and so do not need the zone bitmaps.
      
      With this change, the zone bitmap initialization code in sd_zbc.c can be
      replaced with a call to this function in sd_zbc_read_zones(), which is
      called from the disk revalidate block operation method.
      
      A call to blk_revalidate_disk_zones() is also added to the null_blk
      driver for devices created with the zoned mode enabled.
      
      Finally, to ensure that zoned devices created with dm-linear or
      dm-flakey expose the correct number of zones through sysfs, a call to
      blk_revalidate_disk_zones() is added to dm_table_set_restrictions().
      
      The zone 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().
      Reviewed-by: NHannes Reinecke <hare@suse.com>
      Reviewed-by: NChristoph Hellwig <hch@lst.de>
      Reviewed-by: NMartin K. Petersen <martin.petersen@oracle.com>
      Reviewed-by: NMike Snitzer <snitzer@redhat.com>
      Signed-off-by: NDamien Le Moal <damien.lemoal@wdc.com>
      Signed-off-by: NJens Axboe <axboe@kernel.dk>
      bf505456
    • C
      block: add a report_zones method · e76239a3
      Christoph Hellwig 提交于
      Dispatching a report zones command through the request queue is a major
      pain due to the command reply payload rewriting necessary. Given that
      blkdev_report_zones() is executing everything synchronously, implement
      report zones as a block device file operation instead, allowing major
      simplification of the code in many places.
      
      sd, null-blk, dm-linear and dm-flakey being the only block device
      drivers supporting exposing zoned block devices, these drivers are
      modified to provide the device side implementation of the
      report_zones() block device file operation.
      
      For device mappers, a new report_zones() target type operation is
      defined so that the upper block layer calls blkdev_report_zones() can
      be propagated down to the underlying devices of the dm targets.
      Implementation for this new operation is added to the dm-linear and
      dm-flakey targets.
      Reviewed-by: NHannes Reinecke <hare@suse.com>
      Signed-off-by: NChristoph Hellwig <hch@lst.de>
      [Damien]
      * Changed method block_device argument to gendisk
      * Various bug fixes and improvements
      * Added support for null_blk, dm-linear and dm-flakey.
      Reviewed-by: NMartin K. Petersen <martin.petersen@oracle.com>
      Reviewed-by: NMike Snitzer <snitzer@redhat.com>
      Signed-off-by: NDamien Le Moal <damien.lemoal@wdc.com>
      Signed-off-by: NJens Axboe <axboe@kernel.dk>
      e76239a3
    • D
      scsi: sd_zbc: Fix sd_zbc_check_zones() error checks · 5f832a39
      Damien Le Moal 提交于
      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->device, zone_blocks) > UINT_MAX) {
      
      so there is no need to check again for an out of range value in
      sd_zbc_read_zones(). Simplify the code and fix sd_zbc_check_zones()
      error return to -EFBIG instead of -ENODEV if the zone size is too large.
      Change the return type of sd_zbc_check_zones() to an int for the error
      code and return the zone size (zone_blocks) through a u32 pointer to
      avoid overflowing the signed 32 return value.
      Reviewed-by: NHannes Reinecke <hare@suse.com>
      Acked-by: NMartin K. Petersen <martin.petersen@oracle.com>
      Reviewed-by: NChristoph Hellwig <hch@lst.de>
      Signed-off-by: NDamien Le Moal <damien.lemoal@wdc.com>
      Signed-off-by: NJens Axboe <axboe@kernel.dk>
      5f832a39
    • D
      scsi: sd_zbc: Reduce boot device scan and revalidate time · d2e428e4
      Damien Le Moal 提交于
      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 reply used to check the "same"
      field.
      
      Avoid executing a report zones command solely to check the disk capacity
      by merging sd_zbc_check_capacity() into sd_zbc_check_zone_size() and
      renaming that function to sd_zbc_check_zones(). This removes a costly
      execution of a full report zones command and so reduces device scan
      duration at boot time as well as the duration of disk revalidate calls.
      
      Furthermore, setting the partial report bit in the REPORT ZONES command
      cdb can significantly reduce this command execution time as the device
      does not have to count and report the total number of zones that could
      be reported assuming a large enough reply buffer. A non-partial zone
      report is necessary only for the first execution of report zones used to
      check the same field value (to ensure that this value applies to all
      zones of the disk). All other calls to sd_zbc_report_zones() can use a
      partial report to reduce execution time.
      
      Using a 14 TB ZBC disk, these simple changes reduce device scan time at
      boot from about 3.5s down to about 900ms. Disk revalidate times are also
      reduced from about 450ms down to 230ms.
      Reviewed-by: NChristoph Hellwig <hch@lst.de>
      Reviewed-by: NHannes Reinecke <hare@suse.com>
      Acked-by: NMartin K. Petersen <martin.petersen@oracle.com>
      Signed-off-by: NDamien Le Moal <damien.lemoal@wdc.com>
      Signed-off-by: NJens Axboe <axboe@kernel.dk>
      d2e428e4
    • D
      scsi: sd_zbc: Rearrange code · 7f9d35d2
      Damien Le Moal 提交于
      Move the urswrz check out of sd_zbc_read_zones() and into
      sd_zbc_read_zoned_characteristics() where that value is obtained (read
      from the disk zoned characteristics VPD page). Since this function now
      does more than simply reading the VPD page, rename it to
      sd_zbc_check_zoned_characteristics().
      Also fix the error message displayed when reading that VPD page fails.
      Reviewed-by: NChristoph Hellwig <hch@lst.de>
      Reviewed-by: NHannes Reinecke <hare@suse.com>
      Acked-by: NMartin K. Petersen <martin.petersen@oracle.com>
      Signed-off-by: NDamien Le Moal <damien.lemoal@wdc.com>
      Signed-off-by: NJens Axboe <axboe@kernel.dk>
      7f9d35d2
  4. 24 10月, 2018 10 次提交
  5. 20 10月, 2018 4 次提交
  6. 18 10月, 2018 14 次提交