Merge tag 'for-5.8/drivers-2020-06-01' of git://git.kernel.dk/linux-block
authorLinus Torvalds <torvalds@linux-foundation.org>
Tue, 2 Jun 2020 22:37:03 +0000 (15:37 -0700)
committerLinus Torvalds <torvalds@linux-foundation.org>
Tue, 2 Jun 2020 22:37:03 +0000 (15:37 -0700)
Pull block driver updates from Jens Axboe:
 "On top of the core changes, here are the block driver changes for this
  merge window:

   - NVMe changes:
        - NVMe over Fibre Channel protocol updates, which also reach
          over to drivers/scsi/lpfc (James Smart)
        - namespace revalidation support on the target (Anthony
          Iliopoulos)
        - gcc zero length array fix (Arnd Bergmann)
        - nvmet cleanups (Chaitanya Kulkarni)
        - misc cleanups and fixes (me, Keith Busch, Sagi Grimberg)
        - use a SRQ per completion vector (Max Gurtovoy)
        - fix handling of runtime changes to the queue count (Weiping
          Zhang)
        - t10 protection information support for nvme-rdma and
          nvmet-rdma (Israel Rukshin and Max Gurtovoy)
        - target side AEN improvements (Chaitanya Kulkarni)
        - various fixes and minor improvements all over, icluding the
          nvme part of the lpfc driver"

   - Floppy code cleanup series (Willy, Denis)

   - Floppy contention fix (Jiri)

   - Loop CONFIGURE support (Martijn)

   - bcache fixes/improvements (Coly, Joe, Colin)

   - q->queuedata cleanups (Christoph)

   - Get rid of ioctl_by_bdev (Christoph, Stefan)

   - md/raid5 allocation fixes (Coly)

   - zero length array fixes (Gustavo)

   - swim3 task state fix (Xu)"

* tag 'for-5.8/drivers-2020-06-01' of git://git.kernel.dk/linux-block: (166 commits)
  bcache: configure the asynchronous registertion to be experimental
  bcache: asynchronous devices registration
  bcache: fix refcount underflow in bcache_device_free()
  bcache: Convert pr_<level> uses to a more typical style
  bcache: remove redundant variables i and n
  lpfc: Fix return value in __lpfc_nvme_ls_abort
  lpfc: fix axchg pointer reference after free and double frees
  lpfc: Fix pointer checks and comments in LS receive refactoring
  nvme: set dma alignment to qword
  nvmet: cleanups the loop in nvmet_async_events_process
  nvmet: fix memory leak when removing namespaces and controllers concurrently
  nvmet-rdma: add metadata/T10-PI support
  nvmet: add metadata support for block devices
  nvmet: add metadata/T10-PI support
  nvme: add Metadata Capabilities enumerations
  nvmet: rename nvmet_check_data_len to nvmet_check_transfer_len
  nvmet: rename nvmet_rw_len to nvmet_rw_data_len
  nvmet: add metadata characteristics for a namespace
  nvme-rdma: add metadata/T10-PI support
  nvme-rdma: introduce nvme_rdma_sgl structure
  ...

1  2 
MAINTAINERS
drivers/block/loop.c
drivers/md/bcache/request.c
drivers/nvme/host/core.c
drivers/nvme/host/pci.c
drivers/nvme/target/io-cmd-bdev.c
drivers/scsi/lpfc/lpfc_debugfs.c
fs/block_dev.c
include/linux/fs.h
include/linux/genhd.h

diff --combined MAINTAINERS
@@@ -189,7 -189,7 +189,7 @@@ F: drivers/net/hamradio/6pack.
  M:    Johannes Berg <johannes@sipsolutions.net>
  L:    linux-wireless@vger.kernel.org
  S:    Maintained
 -W:    http://wireless.kernel.org/
 +W:    https://wireless.wiki.kernel.org/
  T:    git git://git.kernel.org/pub/scm/linux/kernel/git/jberg/mac80211.git
  T:    git git://git.kernel.org/pub/scm/linux/kernel/git/jberg/mac80211-next.git
  F:    Documentation/driver-api/80211/cfg80211.rst
@@@ -505,7 -505,7 +505,7 @@@ F: drivers/hwmon/adm1029.
  ADM8211 WIRELESS DRIVER
  L:    linux-wireless@vger.kernel.org
  S:    Orphan
 -W:    http://wireless.kernel.org/
 +W:    https://wireless.wiki.kernel.org/
  F:    drivers/net/wireless/admtek/adm8211.*
  
  ADP1653 FLASH CONTROLLER DRIVER
@@@ -570,7 -570,7 +570,7 @@@ F: Documentation/devicetree/bindings/ii
  F:    drivers/input/misc/adxl34x.c
  
  ADXL372 THREE-AXIS DIGITAL ACCELEROMETER DRIVER
 -M:    Stefan Popa <stefan.popa@analog.com>
 +M:    Michael Hennerich <michael.hennerich@analog.com>
  S:    Supported
  W:    http://ez.analog.com/community/linux-device-drivers
  F:    Documentation/devicetree/bindings/iio/accel/adi,adxl372.yaml
@@@ -842,13 -842,6 +842,13 @@@ S:       Supporte
  T:    git git://people.freedesktop.org/~agd5f/linux
  F:    drivers/gpu/drm/amd/display/
  
 +AMD ENERGY DRIVER
 +M:    Naveen Krishna Chatradhi <nchatrad@amd.com>
 +L:    linux-hwmon@vger.kernel.org
 +S:    Maintained
 +F:    Documentation/hwmon/amd_energy.rst
 +F:    drivers/hwmon/amd_energy.c
 +
  AMD FAM15H PROCESSOR POWER MONITORING DRIVER
  M:    Huang Rui <ray.huang@amd.com>
  L:    linux-hwmon@vger.kernel.org
@@@ -899,11 -892,6 +899,11 @@@ F:       drivers/gpu/drm/amd/include/v9_struc
  F:    drivers/gpu/drm/amd/include/vi_structs.h
  F:    include/uapi/linux/kfd_ioctl.h
  
 +AMD SPI DRIVER
 +M:    Sanjay R Mehta <sanju.mehta@amd.com>
 +S:    Maintained
 +F:    drivers/spi/spi-amd.c
 +
  AMD MP2 I2C DRIVER
  M:    Elie Morisse <syniurge@gmail.com>
  M:    Nehal Shah <nehal-bakulchandra.shah@amd.com>
@@@ -934,7 -922,7 +934,7 @@@ F: arch/arm64/boot/dts/amd/amd-seattle-
  F:    drivers/net/ethernet/amd/xgbe/
  
  ANALOG DEVICES INC AD5686 DRIVER
 -M:    Stefan Popa <stefan.popa@analog.com>
 +M:    Michael Hennerich <Michael.Hennerich@analog.com>
  L:    linux-pm@vger.kernel.org
  S:    Supported
  W:    http://ez.analog.com/community/linux-device-drivers
@@@ -942,7 -930,7 +942,7 @@@ F: drivers/iio/dac/ad5686
  F:    drivers/iio/dac/ad5696*
  
  ANALOG DEVICES INC AD5758 DRIVER
 -M:    Stefan Popa <stefan.popa@analog.com>
 +M:    Michael Hennerich <Michael.Hennerich@analog.com>
  L:    linux-iio@vger.kernel.org
  S:    Supported
  W:    http://ez.analog.com/community/linux-device-drivers
@@@ -958,7 -946,7 +958,7 @@@ F: Documentation/devicetree/bindings/ii
  F:    drivers/iio/adc/ad7091r5.c
  
  ANALOG DEVICES INC AD7124 DRIVER
 -M:    Stefan Popa <stefan.popa@analog.com>
 +M:    Michael Hennerich <Michael.Hennerich@analog.com>
  L:    linux-iio@vger.kernel.org
  S:    Supported
  W:    http://ez.analog.com/community/linux-device-drivers
@@@ -982,7 -970,7 +982,7 @@@ F: Documentation/devicetree/bindings/ii
  F:    drivers/iio/adc/ad7292.c
  
  ANALOG DEVICES INC AD7606 DRIVER
 -M:    Stefan Popa <stefan.popa@analog.com>
 +M:    Michael Hennerich <Michael.Hennerich@analog.com>
  M:    Beniamin Bia <beniamin.bia@analog.com>
  L:    linux-iio@vger.kernel.org
  S:    Supported
@@@ -991,7 -979,7 +991,7 @@@ F: Documentation/devicetree/bindings/ii
  F:    drivers/iio/adc/ad7606.c
  
  ANALOG DEVICES INC AD7768-1 DRIVER
 -M:    Stefan Popa <stefan.popa@analog.com>
 +M:    Michael Hennerich <Michael.Hennerich@analog.com>
  L:    linux-iio@vger.kernel.org
  S:    Supported
  W:    http://ez.analog.com/community/linux-device-drivers
@@@ -1052,7 -1040,7 +1052,7 @@@ F:      Documentation/devicetree/bindings/hw
  F:    drivers/hwmon/adm1177.c
  
  ANALOG DEVICES INC ADP5061 DRIVER
 -M:    Stefan Popa <stefan.popa@analog.com>
 +M:    Michael Hennerich <Michael.Hennerich@analog.com>
  L:    linux-pm@vger.kernel.org
  S:    Supported
  W:    http://ez.analog.com/community/linux-device-drivers
@@@ -1121,6 -1109,7 +1121,6 @@@ F:      drivers/iio/amplifiers/hmc425a.
  ANALOG DEVICES INC IIO DRIVERS
  M:    Lars-Peter Clausen <lars@metafoo.de>
  M:    Michael Hennerich <Michael.Hennerich@analog.com>
 -M:    Stefan Popa <stefan.popa@analog.com>
  S:    Supported
  W:    http://wiki.analog.com/
  W:    http://ez.analog.com/community/linux-device-drivers
@@@ -2237,7 -2226,6 +2237,7 @@@ F:      drivers/*/qcom
  F:    drivers/*/qcom/
  F:    drivers/bluetooth/btqcomsmd.c
  F:    drivers/clocksource/timer-qcom.c
 +F:    drivers/cpuidle/cpuidle-qcom-spm.c
  F:    drivers/extcon/extcon-qcom*
  F:    drivers/i2c/busses/i2c-qcom-geni.c
  F:    drivers/i2c/busses/i2c-qup.c
@@@ -2862,14 -2850,14 +2862,14 @@@ M:   Nick Kossifidis <mickflemm@gmail.com
  M:    Luis Chamberlain <mcgrof@kernel.org>
  L:    linux-wireless@vger.kernel.org
  S:    Maintained
 -W:    http://wireless.kernel.org/en/users/Drivers/ath5k
 +W:    https://wireless.wiki.kernel.org/en/users/Drivers/ath5k
  F:    drivers/net/wireless/ath/ath5k/
  
  ATHEROS ATH6KL WIRELESS DRIVER
  M:    Kalle Valo <kvalo@codeaurora.org>
  L:    linux-wireless@vger.kernel.org
  S:    Supported
 -W:    http://wireless.kernel.org/en/users/Drivers/ath6kl
 +W:    https://wireless.wiki.kernel.org/en/users/Drivers/ath6kl
  T:    git git://git.kernel.org/pub/scm/linux/kernel/git/kvalo/ath.git
  F:    drivers/net/wireless/ath/ath6kl/
  
@@@ -3032,7 -3020,7 +3032,7 @@@ B43 WIRELESS DRIVE
  L:    linux-wireless@vger.kernel.org
  L:    b43-dev@lists.infradead.org
  S:    Odd Fixes
 -W:    http://wireless.kernel.org/en/users/Drivers/b43
 +W:    https://wireless.wiki.kernel.org/en/users/Drivers/b43
  F:    drivers/net/wireless/broadcom/b43/
  
  B43LEGACY WIRELESS DRIVER
@@@ -3040,7 -3028,7 +3040,7 @@@ M:      Larry Finger <Larry.Finger@lwfinger.
  L:    linux-wireless@vger.kernel.org
  L:    b43-dev@lists.infradead.org
  S:    Maintained
 -W:    http://wireless.kernel.org/en/users/Drivers/b43
 +W:    https://wireless.wiki.kernel.org/en/users/Drivers/b43
  F:    drivers/net/wireless/broadcom/b43legacy/
  
  BACKLIGHT CLASS/SUBSYSTEM
@@@ -3670,7 -3658,7 +3670,7 @@@ L:      linux-btrfs@vger.kernel.or
  S:    Maintained
  W:    http://btrfs.wiki.kernel.org/
  Q:    http://patchwork.kernel.org/project/linux-btrfs/list/
 -T:    git git://git.kernel.org/pub/scm/linux/kernel/git/mason/linux-btrfs.git
 +T:    git git://git.kernel.org/pub/scm/linux/kernel/git/kdave/linux.git
  F:    Documentation/filesystems/btrfs.rst
  F:    fs/btrfs/
  F:    include/linux/btrfs*
@@@ -3743,7 -3731,7 +3743,7 @@@ CACHEFILES: FS-CACHE BACKEND FOR CACHIN
  M:    David Howells <dhowells@redhat.com>
  L:    linux-cachefs@redhat.com (moderated for non-subscribers)
  S:    Supported
 -F:    Documentation/filesystems/caching/cachefiles.txt
 +F:    Documentation/filesystems/caching/cachefiles.rst
  F:    fs/cachefiles/
  
  CADENCE MIPI-CSI2 BRIDGES
@@@ -3855,7 -3843,7 +3855,7 @@@ CARL9170 LINUX COMMUNITY WIRELESS DRIVE
  M:    Christian Lamparter <chunkeey@googlemail.com>
  L:    linux-wireless@vger.kernel.org
  S:    Maintained
 -W:    http://wireless.kernel.org/en/users/Drivers/carl9170
 +W:    https://wireless.wiki.kernel.org/en/users/Drivers/carl9170
  F:    drivers/net/wireless/ath/carl9170/
  
  CAVIUM I2C DRIVER
@@@ -3909,15 -3897,6 +3909,15 @@@ S:    Supporte
  W:    https://developer.arm.com/products/system-ip/trustzone-cryptocell/cryptocell-700-family
  F:    drivers/crypto/ccree/
  
 +CCTRNG ARM TRUSTZONE CRYPTOCELL TRUE RANDOM NUMBER GENERATOR (TRNG) DRIVER
 +M:    Hadar Gat <hadar.gat@arm.com>
 +L:    linux-crypto@vger.kernel.org
 +S:    Supported
 +F:    drivers/char/hw_random/cctrng.c
 +F:    drivers/char/hw_random/cctrng.h
 +F:    Documentation/devicetree/bindings/rng/arm-cctrng.txt
 +W:    https://developer.arm.com/products/system-ip/trustzone-cryptocell/cryptocell-700-family
 +
  CEC FRAMEWORK
  M:    Hans Verkuil <hverkuil-cisco@xs4all.nl>
  L:    linux-media@vger.kernel.org
@@@ -3958,9 -3937,11 +3958,9 @@@ F:     arch/powerpc/platforms/cell
  CEPH COMMON CODE (LIBCEPH)
  M:    Ilya Dryomov <idryomov@gmail.com>
  M:    Jeff Layton <jlayton@kernel.org>
 -M:    Sage Weil <sage@redhat.com>
  L:    ceph-devel@vger.kernel.org
  S:    Supported
  W:    http://ceph.com/
 -T:    git git://git.kernel.org/pub/scm/linux/kernel/git/sage/ceph-client.git
  T:    git git://github.com/ceph/ceph-client.git
  F:    include/linux/ceph/
  F:    include/linux/crush/
@@@ -3968,10 -3949,12 +3968,10 @@@ F:   net/ceph
  
  CEPH DISTRIBUTED FILE SYSTEM CLIENT (CEPH)
  M:    Jeff Layton <jlayton@kernel.org>
 -M:    Sage Weil <sage@redhat.com>
  M:    Ilya Dryomov <idryomov@gmail.com>
  L:    ceph-devel@vger.kernel.org
  S:    Supported
  W:    http://ceph.com/
 -T:    git git://git.kernel.org/pub/scm/linux/kernel/git/sage/ceph-client.git
  T:    git git://github.com/ceph/ceph-client.git
  F:    Documentation/filesystems/ceph.rst
  F:    fs/ceph/
@@@ -4220,7 -4203,7 +4220,7 @@@ M:      coda@cs.cmu.ed
  L:    codalist@coda.cs.cmu.edu
  S:    Maintained
  W:    http://www.coda.cs.cmu.edu/
 -F:    Documentation/filesystems/coda.txt
 +F:    Documentation/filesystems/coda.rst
  F:    fs/coda/
  F:    include/linux/coda*.h
  F:    include/uapi/linux/coda*.h
@@@ -5013,7 -4996,7 +5013,7 @@@ M:      Jan Kara <jack@suse.cz
  R:    Amir Goldstein <amir73il@gmail.com>
  L:    linux-fsdevel@vger.kernel.org
  S:    Maintained
 -F:    Documentation/filesystems/dnotify.txt
 +F:    Documentation/filesystems/dnotify.rst
  F:    fs/notify/dnotify/
  F:    include/linux/dnotify.h
  
@@@ -5027,7 -5010,7 +5027,7 @@@ W:      http://www.win.tue.nl/~aeb/partition
  DISKQUOTA
  M:    Jan Kara <jack@suse.com>
  S:    Maintained
 -F:    Documentation/filesystems/quota.txt
 +F:    Documentation/filesystems/quota.rst
  F:    fs/quota/
  F:    include/linux/quota*.h
  F:    include/uapi/linux/quota*.h
@@@ -5062,7 -5045,7 +5062,7 @@@ F:      drivers/dma-buf
  F:    include/linux/*fence.h
  F:    include/linux/dma-buf*
  F:    include/linux/dma-resv.h
 -K:    dma_(buf|fence|resv)
 +K:    \bdma_(?:buf|fence|resv)\b
  
  DMA GENERIC OFFLOAD ENGINE SUBSYSTEM
  M:    Vinod Koul <vkoul@kernel.org>
@@@ -5193,7 -5176,6 +5193,7 @@@ S:      Maintaine
  F:    drivers/soc/fsl/dpio
  
  DPAA2 ETHERNET DRIVER
 +M:    Ioana Ciornei <ioana.ciornei@nxp.com>
  M:    Ioana Radulescu <ruxandra.radulescu@nxp.com>
  L:    netdev@vger.kernel.org
  S:    Maintained
@@@ -5274,7 -5256,7 +5274,7 @@@ DRM DRIVER FOR ARM VERSATILE TFT PANEL
  M:    Linus Walleij <linus.walleij@linaro.org>
  S:    Maintained
  T:    git git://anongit.freedesktop.org/drm/drm-misc
 -F:    Documentation/devicetree/bindings/display/panel/arm,versatile-tft-panel.txt
 +F:    Documentation/devicetree/bindings/display/panel/arm,versatile-tft-panel.yaml
  F:    drivers/gpu/drm/panel/panel-arm-versatile.c
  
  DRM DRIVER FOR ASPEED BMC GFX
@@@ -5300,7 -5282,7 +5300,7 @@@ F:      drivers/gpu/drm/bochs
  DRM DRIVER FOR BOE HIMAX8279D PANELS
  M:    Jerry Han <hanxu5@huaqin.corp-partner.google.com>
  S:    Maintained
 -F:    Documentation/devicetree/bindings/display/panel/boe,himax8279d.txt
 +F:    Documentation/devicetree/bindings/display/panel/boe,himax8279d.yaml
  F:    drivers/gpu/drm/panel/panel-boe-himax8279d.c
  
  DRM DRIVER FOR FARADAY TVE200 TV ENCODER
@@@ -5318,7 -5300,7 +5318,7 @@@ F:      drivers/gpu/drm/panel/panel-feixin-k
  DRM DRIVER FOR FEIYANG FY07024DI26A30-D MIPI-DSI LCD PANELS
  M:    Jagan Teki <jagan@amarulasolutions.com>
  S:    Maintained
 -F:    Documentation/devicetree/bindings/display/panel/feiyang,fy07024di26a30d.txt
 +F:    Documentation/devicetree/bindings/display/panel/feiyang,fy07024di26a30d.yaml
  F:    drivers/gpu/drm/panel/panel-feiyang-fy07024di26a30d.c
  
  DRM DRIVER FOR GRAIN MEDIA GM12U320 PROJECTORS
@@@ -5353,14 -5335,6 +5353,14 @@@ S:    Orphan / Obsolet
  F:    drivers/gpu/drm/i810/
  F:    include/uapi/drm/i810_drm.h
  
 +DRM DRIVER FOR LVDS PANELS
 +M:    Laurent Pinchart <laurent.pinchart@ideasonboard.com>
 +L:    dri-devel@lists.freedesktop.org
 +T:    git git://anongit.freedesktop.org/drm/drm-misc
 +S:    Maintained
 +F:    drivers/gpu/drm/panel/panel-lvds.c
 +F:    Documentation/devicetree/bindings/display/panel/lvds.yaml
 +
  DRM DRIVER FOR MATROX G200/G400 GRAPHICS CARDS
  S:    Orphan / Obsolete
  F:    drivers/gpu/drm/mga/
@@@ -5409,7 -5383,7 +5409,7 @@@ F:      include/uapi/drm/nouveau_drm.
  DRM DRIVER FOR OLIMEX LCD-OLINUXINO PANELS
  M:    Stefan Mavrodiev <stefan@olimex.com>
  S:    Maintained
 -F:    Documentation/devicetree/bindings/display/panel/olimex,lcd-olinuxino.txt
 +F:    Documentation/devicetree/bindings/display/panel/olimex,lcd-olinuxino.yaml
  F:    drivers/gpu/drm/panel/panel-olimex-lcd-olinuxino.c
  
  DRM DRIVER FOR PERVASIVE DISPLAYS REPAPER PANELS
@@@ -5426,7 -5400,7 +5426,7 @@@ L:      virtualization@lists.linux-foundatio
  S:    Obsolete
  W:    https://www.kraxel.org/blog/2014/10/qemu-using-cirrus-considered-harmful/
  T:    git git://anongit.freedesktop.org/drm/drm-misc
 -F:    drivers/gpu/drm/cirrus/
 +F:    drivers/gpu/drm/tiny/cirrus.c
  
  DRM DRIVER FOR QXL VIRTUAL GPU
  M:    Dave Airlie <airlied@redhat.com>
@@@ -5476,7 -5450,7 +5476,7 @@@ F:      drivers/gpu/drm/tiny/st7586.
  DRM DRIVER FOR SITRONIX ST7701 PANELS
  M:    Jagan Teki <jagan@amarulasolutions.com>
  S:    Maintained
 -F:    Documentation/devicetree/bindings/display/panel/sitronix,st7701.txt
 +F:    Documentation/devicetree/bindings/display/panel/sitronix,st7701.yaml
  F:    drivers/gpu/drm/panel/panel-sitronix-st7701.c
  
  DRM DRIVER FOR SITRONIX ST7735R PANELS
@@@ -5537,10 -5511,10 +5537,10 @@@ F:   drivers/gpu/drm/vboxvideo
  
  DRM DRIVER FOR VMWARE VIRTUAL GPU
  M:    "VMware Graphics" <linux-graphics-maintainer@vmware.com>
 -M:    Thomas Hellstrom <thellstrom@vmware.com>
 +M:    Roland Scheidegger <sroland@vmware.com>
  L:    dri-devel@lists.freedesktop.org
  S:    Supported
 -T:    git git://people.freedesktop.org/~thomash/linux
 +T:    git git://people.freedesktop.org/~sroland/linux
  F:    drivers/gpu/drm/vmwgfx/
  F:    include/uapi/drm/vmwgfx_drm.h
  
@@@ -5961,9 -5935,9 +5961,9 @@@ F:      lib/dynamic_debug.
  DYNAMIC INTERRUPT MODERATION
  M:    Tal Gilboa <talgi@mellanox.com>
  S:    Maintained
 +F:    Documentation/networking/net_dim.rst
  F:    include/linux/dim.h
  F:    lib/dim/
 -F:    Documentation/networking/net_dim.rst
  
  DZ DECSTATION DZ11 SERIAL DRIVER
  M:    "Maciej W. Rozycki" <macro@linux-mips.org>
@@@ -6202,6 -6176,7 +6202,6 @@@ M:      Yash Shah <yash.shah@sifive.com
  L:    linux-edac@vger.kernel.org
  S:    Supported
  F:    drivers/edac/sifive_edac.c
 -F:    drivers/soc/sifive_l2_cache.c
  
  EDAC-SKYLAKE
  M:    Tony Luck <tony.luck@intel.com>
@@@ -6742,13 -6717,6 +6742,13 @@@ S:    Maintaine
  F:    Documentation/devicetree/bindings/crypto/fsl-sec4.txt
  F:    drivers/crypto/caam/
  
 +FREESCALE COLDFIRE M5441X MMC DRIVER
 +M:    Angelo Dureghello <angelo.dureghello@timesys.com>
 +L:    linux-mmc@vger.kernel.org
 +S:    Maintained
 +F:    drivers/mmc/host/sdhci-esdhc-mcf.c
 +F:    include/linux/platform_data/mmc-esdhc-mcf.h
 +
  FREESCALE DIU FRAMEBUFFER DRIVER
  M:    Timur Tabi <timur@kernel.org>
  L:    linux-fbdev@vger.kernel.org
@@@ -7056,24 -7024,13 +7056,24 @@@ R:   Darren Hart <dvhart@infradead.org
  L:    linux-kernel@vger.kernel.org
  S:    Maintained
  T:    git git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git locking/core
 -F:    Documentation/*futex*
 +F:    Documentation/locking/*futex*
  F:    include/asm-generic/futex.h
  F:    include/linux/futex.h
  F:    include/uapi/linux/futex.h
  F:    kernel/futex.c
  F:    tools/perf/bench/futex*
 -F:    tools/testing/selftests/futex/
 +F:    Documentation/locking/*futex*
 +
 +GATEWORKS SYSTEM CONTROLLER (GSC) DRIVER
 +M:    Tim Harvey <tharvey@gateworks.com>
 +M:    Robert Jones <rjones@gateworks.com>
 +S:    Maintained
 +F:    Documentation/devicetree/bindings/mfd/gateworks-gsc.yaml
 +F:    drivers/mfd/gateworks-gsc.c
 +F:    include/linux/mfd/gsc.h
 +F:    Documentation/hwmon/gsc-hwmon.rst
 +F:    drivers/hwmon/gsc-hwmon.c
 +F:    include/linux/platform_data/gsc_hwmon.h
  
  GASKET DRIVER FRAMEWORK
  M:    Rob Springer <rspringer@google.com>
@@@ -7162,10 -7119,9 +7162,10 @@@ F:    include/uapi/asm-generic
  
  GENERIC PHY FRAMEWORK
  M:    Kishon Vijay Abraham I <kishon@ti.com>
 +M:    Vinod Koul <vkoul@kernel.org>
  L:    linux-kernel@vger.kernel.org
  S:    Supported
 -T:    git git://git.kernel.org/pub/scm/linux/kernel/git/kishon/linux-phy.git
 +T:    git git://git.kernel.org/pub/scm/linux/kernel/git/phy/linux-phy.git
  F:    Documentation/devicetree/bindings/phy/
  F:    drivers/phy/
  F:    include/linux/phy/
@@@ -7543,7 -7499,7 +7543,7 @@@ L:      linux-remoteproc@vger.kernel.or
  S:    Maintained
  T:    git git://git.kernel.org/pub/scm/linux/kernel/git/andersson/remoteproc.git hwspinlock-next
  F:    Documentation/devicetree/bindings/hwlock/
 -F:    Documentation/hwspinlock.txt
 +F:    Documentation/locking/hwspinlock.rst
  F:    drivers/hwspinlock/
  F:    include/linux/hwspinlock.h
  
@@@ -7776,9 -7732,7 +7776,9 @@@ L:      linux-mm@kvack.or
  S:    Maintained
  F:    Documentation/vm/hmm.rst
  F:    include/linux/hmm*
 +F:    lib/test_hmm*
  F:    mm/hmm*
 +F:    tools/testing/selftests/vm/*hmm*
  
  HOST AP DRIVER
  M:    Jouni Malinen <j@w1.fi>
@@@ -7792,6 -7746,11 +7792,6 @@@ L:     platform-driver-x86@vger.kernel.or
  S:    Orphan
  F:    drivers/platform/x86/tc1100-wmi.c
  
 -HP100:        Driver for HP 10/100 Mbit/s Voice Grade Network Adapter Series
 -M:    Jaroslav Kysela <perex@perex.cz>
 -S:    Obsolete
 -F:    drivers/staging/hp/hp100.*
 -
  HPET: High Precision Event Timers driver
  M:    Clemens Ladisch <clemens@ladisch.de>
  S:    Maintained
@@@ -7878,7 -7837,7 +7878,7 @@@ T:      git git://linuxtv.org/media_tree.gi
  F:    drivers/media/platform/sti/hva
  
  HWPOISON MEMORY FAILURE HANDLING
 -M:    Naoya Horiguchi <n-horiguchi@ah.jp.nec.com>
 +M:    Naoya Horiguchi <naoya.horiguchi@nec.com>
  L:    linux-mm@kvack.org
  S:    Maintained
  F:    mm/hwpoison-inject.c
@@@ -7990,7 -7949,7 +7990,7 @@@ F:      Documentation/i2c/busses/i2c-parport
  F:    drivers/i2c/busses/i2c-parport.c
  
  I2C SUBSYSTEM
 -M:    Wolfram Sang <wsa@the-dreams.de>
 +M:    Wolfram Sang <wsa@kernel.org>
  L:    linux-i2c@vger.kernel.org
  S:    Maintained
  W:    https://i2c.wiki.kernel.org/
@@@ -8540,13 -8499,6 +8540,13 @@@ L:    platform-driver-x86@vger.kernel.or
  S:    Maintained
  F:    drivers/platform/x86/intel_atomisp2_pm.c
  
 +INTEL BROXTON PMC DRIVER
 +M:    Mika Westerberg <mika.westerberg@linux.intel.com>
 +M:    Zha Qipeng <qipeng.zha@intel.com>
 +S:    Maintained
 +F:    drivers/mfd/intel_pmc_bxt.c
 +F:    include/linux/mfd/intel_pmc_bxt.h
 +
  INTEL C600 SERIES SAS CONTROLLER DRIVER
  M:    Intel SCU Linux support <intel-linux-scu@intel.com>
  M:    Artur Paszkiewicz <artur.paszkiewicz@intel.com>
@@@ -8754,13 -8706,6 +8754,13 @@@ F:    include/uapi/linux/mic_common.
  F:    include/uapi/linux/mic_ioctl.h
  F:    include/uapi/linux/scif_ioctl.h
  
 +INTEL P-Unit IPC DRIVER
 +M:    Zha Qipeng <qipeng.zha@intel.com>
 +L:    platform-driver-x86@vger.kernel.org
 +S:    Maintained
 +F:    arch/x86/include/asm/intel_punit_ipc.h
 +F:    drivers/platform/x86/intel_punit_ipc.c
 +
  INTEL PMC CORE DRIVER
  M:    Rajneesh Bhardwaj <rajneesh.bhardwaj@intel.com>
  M:    Vishwanath Somayaji <vishwanath.somayaji@intel.com>
@@@ -8768,6 -8713,15 +8768,6 @@@ L:     platform-driver-x86@vger.kernel.or
  S:    Maintained
  F:    drivers/platform/x86/intel_pmc_core*
  
 -INTEL PMC/P-Unit IPC DRIVER
 -M:    Zha Qipeng<qipeng.zha@intel.com>
 -L:    platform-driver-x86@vger.kernel.org
 -S:    Maintained
 -F:    arch/x86/include/asm/intel_pmc_ipc.h
 -F:    arch/x86/include/asm/intel_punit_ipc.h
 -F:    drivers/platform/x86/intel_pmc_ipc.c
 -F:    drivers/platform/x86/intel_punit_ipc.c
 -
  INTEL PMIC GPIO DRIVERS
  M:    Andy Shevchenko <andy@kernel.org>
  S:    Maintained
@@@ -8806,12 -8760,6 +8806,12 @@@ S:    Supporte
  F:    drivers/infiniband/hw/i40iw/
  F:    include/uapi/rdma/i40iw-abi.h
  
 +INTEL SCU DRIVERS
 +M:    Mika Westerberg <mika.westerberg@linux.intel.com>
 +S:    Maintained
 +F:    arch/x86/include/asm/intel_scu_ipc.h
 +F:    drivers/platform/x86/intel_scu_*
 +
  INTEL SPEED SELECT TECHNOLOGY
  M:    Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
  L:    platform-driver-x86@vger.kernel.org
@@@ -8878,13 -8826,6 +8878,13 @@@ F:    Documentation/admin-guide/wimax/i240
  F:    drivers/net/wimax/i2400m/
  F:    include/uapi/linux/wimax/i2400m.h
  
 +INTEL WMI SLIM BOOTLOADER (SBL) FIRMWARE UPDATE DRIVER
 +M:    Jithu Joseph <jithu.joseph@intel.com>
 +R:    Maurice Ma <maurice.ma@intel.com>
 +S:    Maintained
 +W:    https://slimbootloader.github.io/security/firmware-update.html
 +F:    drivers/platform/x86/intel-wmi-sbl-fw-update.c
 +
  INTEL WMI THUNDERBOLT FORCE POWER DRIVER
  M:    Mario Limonciello <mario.limonciello@dell.com>
  S:    Maintained
@@@ -8970,7 -8911,7 +8970,7 @@@ M:      Corey Minyard <minyard@acm.org
  L:    openipmi-developer@lists.sourceforge.net (moderated for non-subscribers)
  S:    Supported
  W:    http://openipmi.sourceforge.net/
 -F:    Documentation/IPMI.txt
 +F:    Documentation/driver-api/ipmi.rst
  F:    Documentation/devicetree/bindings/ipmi/
  F:    drivers/char/ipmi/
  F:    include/linux/ipmi*
@@@ -9012,7 -8953,7 +9012,7 @@@ IRQ DOMAINS (IRQ NUMBER MAPPING LIBRARY
  M:    Marc Zyngier <maz@kernel.org>
  S:    Maintained
  T:    git git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git irq/core
 -F:    Documentation/IRQ-domain.txt
 +F:    Documentation/core-api/irq/irq-domain.rst
  F:    include/linux/irqdomain.h
  F:    kernel/irq/irqdomain.c
  F:    kernel/irq/msi.c
@@@ -9252,11 -9193,6 +9252,11 @@@ L:    kexec@lists.infradead.or
  S:    Maintained
  W:    http://lse.sourceforge.net/kdump/
  F:    Documentation/admin-guide/kdump/
 +F:    fs/proc/vmcore.c
 +F:    include/linux/crash_core.h
 +F:    include/linux/crash_dump.h
 +F:    include/uapi/linux/vmcore.h
 +F:    kernel/crash_*.c
  
  KEENE FM RADIO TRANSMITTER DRIVER
  M:    Hans Verkuil <hverkuil@xs4all.nl>
@@@ -9393,7 -9329,6 +9393,7 @@@ M:      Christian Borntraeger <borntraeger@d
  M:    Janosch Frank <frankja@linux.ibm.com>
  R:    David Hildenbrand <david@redhat.com>
  R:    Cornelia Huck <cohuck@redhat.com>
 +R:    Claudio Imbrenda <imbrenda@linux.ibm.com>
  L:    kvm@vger.kernel.org
  S:    Supported
  W:    http://www.ibm.com/developerworks/linux/linux390/
@@@ -9481,13 -9416,6 +9481,13 @@@ F:    include/linux/keyctl.
  F:    include/uapi/linux/keyctl.h
  F:    security/keys/
  
 +KFIFO
 +M:    Stefani Seibold <stefani@seibold.net>
 +S:    Maintained
 +F:    include/linux/kfifo.h
 +F:    lib/kfifo.c
 +F:    samples/kfifo/
 +
  KGDB / KDB /debug_core
  M:    Jason Wessel <jason.wessel@windriver.com>
  M:    Daniel Thompson <daniel.thompson@linaro.org>
@@@ -9792,13 -9720,6 +9792,13 @@@ F:    drivers/lightnvm
  F:    include/linux/lightnvm.h
  F:    include/uapi/linux/lightnvm.h
  
 +LINEAR RANGES HELPERS
 +M:    Mark Brown <broonie@kernel.org>
 +R:    Matti Vaittinen <matti.vaittinen@fi.rohmeurope.com>
 +F:    lib/linear_ranges.c
 +F:    lib/test_linear_ranges.c
 +F:    include/linux/linear_range.h
 +
  LINUX FOR POWER MACINTOSH
  M:    Benjamin Herrenschmidt <benh@kernel.crashing.org>
  L:    linuxppc-dev@lists.ozlabs.org
@@@ -10146,7 -10067,7 +10146,7 @@@ MAC8021
  M:    Johannes Berg <johannes@sipsolutions.net>
  L:    linux-wireless@vger.kernel.org
  S:    Maintained
 -W:    http://wireless.kernel.org/
 +W:    https://wireless.wiki.kernel.org/
  T:    git git://git.kernel.org/pub/scm/linux/kernel/git/jberg/mac80211.git
  T:    git git://git.kernel.org/pub/scm/linux/kernel/git/jberg/mac80211-next.git
  F:    Documentation/networking/mac80211-injection.txt
@@@ -10741,13 -10662,6 +10741,13 @@@ L: netdev@vger.kernel.or
  S:    Maintained
  F:    drivers/net/ethernet/mediatek/
  
 +MEDIATEK I2C CONTROLLER DRIVER
 +M:    Qii Wang <qii.wang@mediatek.com>
 +L:    linux-i2c@vger.kernel.org
 +S:    Maintained
 +F:    Documentation/devicetree/bindings/i2c/i2c-mt65xx.txt
 +F:    drivers/i2c/busses/i2c-mt65xx.c
 +
  MEDIATEK JPEG DRIVER
  M:    Rick Chang <rick.chang@mediatek.com>
  M:    Bin Liu <bin.liu@mediatek.com>
@@@ -10783,6 -10697,7 +10783,6 @@@ MEDIATEK MT76 WIRELESS LAN DRIVE
  M:    Felix Fietkau <nbd@nbd.name>
  M:    Lorenzo Bianconi <lorenzo.bianconi83@gmail.com>
  R:    Ryder Lee <ryder.lee@mediatek.com>
 -R:    Roy Luo <royluo@google.com>
  L:    linux-wireless@vger.kernel.org
  S:    Maintained
  F:    drivers/net/wireless/mediatek/mt76/
@@@ -11796,9 -11711,8 +11796,9 @@@ F:   net/core/drop_monitor.
  
  NETWORKING DRIVERS
  M:    "David S. Miller" <davem@davemloft.net>
 +M:    Jakub Kicinski <kuba@kernel.org>
  L:    netdev@vger.kernel.org
 -S:    Odd Fixes
 +S:    Maintained
  W:    http://www.linuxfoundation.org/en/Net
  Q:    http://patchwork.ozlabs.org/project/netdev/list/
  T:    git git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net.git
@@@ -12734,7 -12648,7 +12734,7 @@@ F:   fs/orangefs
  ORINOCO DRIVER
  L:    linux-wireless@vger.kernel.org
  S:    Orphan
 -W:    http://wireless.kernel.org/en/users/Drivers/orinoco
 +W:    https://wireless.wiki.kernel.org/en/users/Drivers/orinoco
  W:    http://www.nongnu.org/orinoco/
  F:    drivers/net/wireless/intersil/orinoco/
  
@@@ -12760,7 -12674,7 +12760,7 @@@ P54 WIRELESS DRIVE
  M:    Christian Lamparter <chunkeey@googlemail.com>
  L:    linux-wireless@vger.kernel.org
  S:    Maintained
 -W:    http://wireless.kernel.org/en/users/Drivers/p54
 +W:    https://wireless.wiki.kernel.org/en/users/Drivers/p54
  F:    drivers/net/wireless/intersil/p54/
  
  PACKING
@@@ -13128,7 -13042,7 +13128,7 @@@ F:   drivers/pci/controller/pci-xgene-msi
  
  PCI NATIVE HOST BRIDGE AND ENDPOINT DRIVERS
  M:    Lorenzo Pieralisi <lorenzo.pieralisi@arm.com>
 -R:    Andrew Murray <amurray@thegoodpenguin.co.uk>
 +R:    Rob Herring <robh@kernel.org>
  L:    linux-pci@vger.kernel.org
  S:    Supported
  Q:    http://patchwork.ozlabs.org/project/linux-pci/list/
@@@ -13681,7 -13595,7 +13681,7 @@@ PRISM54 WIRELESS DRIVE
  M:    Luis Chamberlain <mcgrof@kernel.org>
  L:    linux-wireless@vger.kernel.org
  S:    Obsolete
 -W:    http://wireless.kernel.org/en/users/Drivers/p54
 +W:    https://wireless.wiki.kernel.org/en/users/Drivers/p54
  F:    drivers/net/wireless/intersil/prism54/
  
  PROC FILESYSTEM
@@@ -13750,7 -13664,6 +13750,7 @@@ M:   Tony Luck <tony.luck@intel.com
  S:    Maintained
  T:    git git://git.kernel.org/pub/scm/linux/kernel/git/kees/linux.git for-next/pstore
  F:    Documentation/admin-guide/ramoops.rst
 +F:    Documentation/admin-guide/pstore-blk.rst
  F:    Documentation/devicetree/bindings/reserved-memory/ramoops.txt
  F:    drivers/acpi/apei/erst.c
  F:    drivers/firmware/efi/efi-pstore.c
@@@ -14023,7 -13936,7 +14023,7 @@@ QUALCOMM ATHEROS ATH10K WIRELESS DRIVE
  M:    Kalle Valo <kvalo@codeaurora.org>
  L:    ath10k@lists.infradead.org
  S:    Supported
 -W:    http://wireless.kernel.org/en/users/Drivers/ath10k
 +W:    https://wireless.wiki.kernel.org/en/users/Drivers/ath10k
  T:    git git://git.kernel.org/pub/scm/linux/kernel/git/kvalo/ath.git
  F:    drivers/net/wireless/ath/ath10k/
  
@@@ -14038,7 -13951,7 +14038,7 @@@ QUALCOMM ATHEROS ATH9K WIRELESS DRIVE
  M:    QCA ath9k Development <ath9k-devel@qca.qualcomm.com>
  L:    linux-wireless@vger.kernel.org
  S:    Supported
 -W:    http://wireless.kernel.org/en/users/Drivers/ath9k
 +W:    https://wireless.wiki.kernel.org/en/users/Drivers/ath9k
  F:    drivers/net/wireless/ath/ath9k/
  
  QUALCOMM CAMERA SUBSYSTEM DRIVER
@@@ -14135,12 -14048,13 +14135,12 @@@ QUALCOMM WCN36XX WIRELESS DRIVE
  M:    Kalle Valo <kvalo@codeaurora.org>
  L:    wcn36xx@lists.infradead.org
  S:    Supported
 -W:    http://wireless.kernel.org/en/users/Drivers/wcn36xx
 +W:    https://wireless.wiki.kernel.org/en/users/Drivers/wcn36xx
  T:    git git://github.com/KrasnikovEugene/wcn36xx.git
  F:    drivers/net/wireless/ath/wcn36xx/
  
  QUANTENNA QTNFMAC WIRELESS DRIVER
  M:    Igor Mitsyanko <imitsyanko@quantenna.com>
 -M:    Avinash Patil <avinashp@quantenna.com>
  M:    Sergey Matyukevich <smatyukevich@quantenna.com>
  L:    linux-wireless@vger.kernel.org
  S:    Maintained
@@@ -14149,6 -14063,7 +14149,6 @@@ F:   drivers/net/wireless/quantenn
  RADEON and AMDGPU DRM DRIVERS
  M:    Alex Deucher <alexander.deucher@amd.com>
  M:    Christian König <christian.koenig@amd.com>
 -M:    David (ChunMing) Zhou <David1.Zhou@amd.com>
  L:    amd-gfx@lists.freedesktop.org
  S:    Supported
  T:    git git://people.freedesktop.org/~agd5f/linux
@@@ -14181,10 -14096,12 +14181,10 @@@ F:        drivers/media/radio/radio-tea5777.
  
  RADOS BLOCK DEVICE (RBD)
  M:    Ilya Dryomov <idryomov@gmail.com>
 -M:    Sage Weil <sage@redhat.com>
  R:    Dongsheng Yang <dongsheng.yang@easystack.cn>
  L:    ceph-devel@vger.kernel.org
  S:    Supported
  W:    http://ceph.com/
 -T:    git git://git.kernel.org/pub/scm/linux/kernel/git/sage/ceph-client.git
  T:    git git://github.com/ceph/ceph-client.git
  F:    Documentation/ABI/testing/sysfs-bus-rbd
  F:    drivers/block/rbd.c
@@@ -14304,7 -14221,7 +14304,7 @@@ M:   Reinette Chatre <reinette.chatre@int
  L:    linux-kernel@vger.kernel.org
  S:    Supported
  F:    Documentation/x86/resctrl*
 -F:    arch/x86/include/asm/resctrl_sched.h
 +F:    arch/x86/include/asm/resctrl.h
  F:    arch/x86/kernel/cpu/resctrl/
  F:    tools/testing/selftests/resctrl/
  
@@@ -14359,7 -14276,7 +14359,7 @@@ REALTEK WIRELESS DRIVER (rtlwifi family
  M:    Ping-Ke Shih <pkshih@realtek.com>
  L:    linux-wireless@vger.kernel.org
  S:    Maintained
 -W:    http://wireless.kernel.org/
 +W:    https://wireless.wiki.kernel.org/
  T:    git git://git.kernel.org/pub/scm/linux/kernel/git/linville/wireless-testing.git
  F:    drivers/net/wireless/realtek/rtlwifi/
  
@@@ -14494,7 -14411,7 +14494,7 @@@ RFKIL
  M:    Johannes Berg <johannes@sipsolutions.net>
  L:    linux-wireless@vger.kernel.org
  S:    Maintained
 -W:    http://wireless.kernel.org/
 +W:    https://wireless.wiki.kernel.org/
  T:    git git://git.kernel.org/pub/scm/linux/kernel/git/jberg/mac80211.git
  T:    git git://git.kernel.org/pub/scm/linux/kernel/git/jberg/mac80211-next.git
  F:    Documentation/ABI/stable/sysfs-class-rfkill
@@@ -14643,7 -14560,7 +14643,7 @@@ F:   drivers/media/dvb-frontends/rtl2832_
  RTL8180 WIRELESS DRIVER
  L:    linux-wireless@vger.kernel.org
  S:    Orphan
 -W:    http://wireless.kernel.org/
 +W:    https://wireless.wiki.kernel.org/
  T:    git git://git.kernel.org/pub/scm/linux/kernel/git/linville/wireless-testing.git
  F:    drivers/net/wireless/realtek/rtl818x/rtl8180/
  
@@@ -14653,7 -14570,7 +14653,7 @@@ M:   Hin-Tak Leung <htl10@users.sourcefor
  M:    Larry Finger <Larry.Finger@lwfinger.net>
  L:    linux-wireless@vger.kernel.org
  S:    Maintained
 -W:    http://wireless.kernel.org/
 +W:    https://wireless.wiki.kernel.org/
  T:    git git://git.kernel.org/pub/scm/linux/kernel/git/linville/wireless-testing.git
  F:    drivers/net/wireless/realtek/rtl818x/rtl8187/
  
@@@ -14711,6 -14628,7 +14711,7 @@@ S:   Supporte
  W:    http://www.ibm.com/developerworks/linux/linux390/
  F:    block/partitions/ibm.c
  F:    drivers/s390/block/dasd*
+ F:    include/linux/dasd_mod.h
  
  S390 IOMMU (PCI)
  M:    Gerald Schaefer <gerald.schaefer@de.ibm.com>
@@@ -14721,7 -14639,6 +14722,7 @@@ F:   drivers/iommu/s390-iommu.
  
  S390 IUCV NETWORK LAYER
  M:    Julian Wiedmann <jwi@linux.ibm.com>
 +M:    Karsten Graul <kgraul@linux.ibm.com>
  M:    Ursula Braun <ubraun@linux.ibm.com>
  L:    linux-s390@vger.kernel.org
  S:    Supported
@@@ -14732,7 -14649,6 +14733,7 @@@ F:   net/iucv
  
  S390 NETWORK DRIVERS
  M:    Julian Wiedmann <jwi@linux.ibm.com>
 +M:    Karsten Graul <kgraul@linux.ibm.com>
  M:    Ursula Braun <ubraun@linux.ibm.com>
  L:    linux-s390@vger.kernel.org
  S:    Supported
@@@ -15553,15 -15469,6 +15554,15 @@@ M: Nicolas Pitre <nico@fluxnic.net
  S:    Odd Fixes
  F:    drivers/net/ethernet/smsc/smc91x.*
  
 +SECURE MONITOR CALL(SMC) CALLING CONVENTION (SMCCC)
 +M:    Mark Rutland <mark.rutland@arm.com>
 +M:    Lorenzo Pieralisi <lorenzo.pieralisi@arm.com>
 +M:    Sudeep Holla <sudeep.holla@arm.com>
 +L:    linux-arm-kernel@lists.infradead.org
 +S:    Maintained
 +F:    drivers/firmware/smccc/
 +F:    include/linux/arm-smccc.h
 +
  SMIA AND SMIA++ IMAGE SENSOR DRIVER
  M:    Sakari Ailus <sakari.ailus@linux.intel.com>
  L:    linux-media@vger.kernel.org
@@@ -15738,7 -15645,7 +15739,7 @@@ F:   drivers/ssb
  F:    include/linux/ssb/
  
  SONY IMX214 SENSOR DRIVER
 -M:    Ricardo Ribalda <ricardo.ribalda@gmail.com>
 +M:    Ricardo Ribalda <ribalda@kernel.org>
  L:    linux-media@vger.kernel.org
  S:    Maintained
  T:    git git://linuxtv.org/media_tree.git
@@@ -15978,7 -15885,7 +15979,7 @@@ M:   Jeremy Kerr <jk@ozlabs.org
  L:    linuxppc-dev@lists.ozlabs.org
  S:    Supported
  W:    http://www.ibm.com/developerworks/power/cell/
 -F:    Documentation/filesystems/spufs.txt
 +F:    Documentation/filesystems/spufs/spufs.rst
  F:    arch/powerpc/platforms/cell/spufs/
  
  SQUASHFS FILE SYSTEM
@@@ -16725,7 -16632,7 +16726,7 @@@ S:   Maintaine
  F:    sound/soc/ti/
  
  TEXAS INSTRUMENTS' DAC7612 DAC DRIVER
 -M:    Ricardo Ribalda <ricardo@ribalda.com>
 +M:    Ricardo Ribalda <ribalda@kernel.org>
  L:    linux-iio@vger.kernel.org
  S:    Supported
  F:    Documentation/devicetree/bindings/iio/dac/ti,dac7612.txt
@@@ -17019,8 -16926,8 +17020,8 @@@ F:   drivers/media/platform/ti-vpe
  TI WILINK WIRELESS DRIVERS
  L:    linux-wireless@vger.kernel.org
  S:    Orphan
 -W:    http://wireless.kernel.org/en/users/Drivers/wl12xx
 -W:    http://wireless.kernel.org/en/users/Drivers/wl1251
 +W:    https://wireless.wiki.kernel.org/en/users/Drivers/wl12xx
 +W:    https://wireless.wiki.kernel.org/en/users/Drivers/wl1251
  T:    git git://git.kernel.org/pub/scm/linux/kernel/git/luca/wl12xx.git
  F:    drivers/net/wireless/ti/
  F:    include/linux/wl12xx.h
@@@ -18302,7 -18209,7 +18303,7 @@@ M:   Maya Erez <merez@codeaurora.org
  L:    linux-wireless@vger.kernel.org
  L:    wil6210@qti.qualcomm.com
  S:    Supported
 -W:    http://wireless.kernel.org/en/users/Drivers/wil6210
 +W:    https://wireless.wiki.kernel.org/en/users/Drivers/wil6210
  F:    drivers/net/wireless/ath/wil6210/
  
  WIMAX STACK
@@@ -18629,8 -18536,8 +18630,8 @@@ W:   http://xfs.org
  T:    git git://git.kernel.org/pub/scm/fs/xfs/xfs-linux.git
  F:    Documentation/ABI/testing/sysfs-fs-xfs
  F:    Documentation/admin-guide/xfs.rst
 -F:    Documentation/filesystems/xfs-delayed-logging-design.txt
 -F:    Documentation/filesystems/xfs-self-describing-metadata.txt
 +F:    Documentation/filesystems/xfs-delayed-logging-design.rst
 +F:    Documentation/filesystems/xfs-self-describing-metadata.rst
  F:    fs/xfs/
  F:    include/uapi/linux/dqblk_xfs.h
  F:    include/uapi/linux/fsmap.h
diff --combined drivers/block/loop.c
@@@ -228,26 -228,36 +228,36 @@@ static void __loop_update_dio(struct lo
                blk_mq_unfreeze_queue(lo->lo_queue);
  }
  
+ /**
+  * loop_validate_block_size() - validates the passed in block size
+  * @bsize: size to validate
+  */
  static int
figure_loop_size(struct loop_device *lo, loff_t offset, loff_t sizelimit)
loop_validate_block_size(unsigned short bsize)
  {
-       loff_t size = get_size(offset, sizelimit, lo->lo_backing_file);
-       sector_t x = (sector_t)size;
-       struct block_device *bdev = lo->lo_device;
+       if (bsize < 512 || bsize > PAGE_SIZE || !is_power_of_2(bsize))
+               return -EINVAL;
  
-       if (unlikely((loff_t)x != size))
-               return -EFBIG;
-       if (lo->lo_offset != offset)
-               lo->lo_offset = offset;
-       if (lo->lo_sizelimit != sizelimit)
-               lo->lo_sizelimit = sizelimit;
-       set_capacity(lo->lo_disk, x);
-       bd_set_size(bdev, (loff_t)get_capacity(bdev->bd_disk) << 9);
-       /* let user-space know about the new size */
-       kobject_uevent(&disk_to_dev(bdev->bd_disk)->kobj, KOBJ_CHANGE);
        return 0;
  }
  
+ /**
+  * loop_set_size() - sets device size and notifies userspace
+  * @lo: struct loop_device to set the size for
+  * @size: new size of the loop device
+  *
+  * Callers must validate that the size passed into this function fits into
+  * a sector_t, eg using loop_validate_size()
+  */
+ static void loop_set_size(struct loop_device *lo, loff_t size)
+ {
+       struct block_device *bdev = lo->lo_device;
+       bd_set_size(bdev, size << SECTOR_SHIFT);
+       set_capacity_revalidate_and_notify(lo->lo_disk, size, false);
+ }
  static inline int
  lo_do_transfer(struct loop_device *lo, int cmd,
               struct page *rpage, unsigned roffs,
@@@ -919,7 -929,7 +929,7 @@@ static void loop_unprepare_queue(struc
  
  static int loop_kthread_worker_fn(void *worker_ptr)
  {
 -      current->flags |= PF_LESS_THROTTLE | PF_MEMALLOC_NOIO;
 +      current->flags |= PF_LOCAL_THROTTLE | PF_MEMALLOC_NOIO;
        return kthread_worker_fn(worker_ptr);
  }
  
@@@ -952,23 -962,125 +962,125 @@@ static void loop_update_rotational(stru
                blk_queue_flag_clear(QUEUE_FLAG_NONROT, q);
  }
  
- static int loop_set_fd(struct loop_device *lo, fmode_t mode,
-                      struct block_device *bdev, unsigned int arg)
+ static int
+ loop_release_xfer(struct loop_device *lo)
+ {
+       int err = 0;
+       struct loop_func_table *xfer = lo->lo_encryption;
+       if (xfer) {
+               if (xfer->release)
+                       err = xfer->release(lo);
+               lo->transfer = NULL;
+               lo->lo_encryption = NULL;
+               module_put(xfer->owner);
+       }
+       return err;
+ }
+ static int
+ loop_init_xfer(struct loop_device *lo, struct loop_func_table *xfer,
+              const struct loop_info64 *i)
+ {
+       int err = 0;
+       if (xfer) {
+               struct module *owner = xfer->owner;
+               if (!try_module_get(owner))
+                       return -EINVAL;
+               if (xfer->init)
+                       err = xfer->init(lo, i);
+               if (err)
+                       module_put(owner);
+               else
+                       lo->lo_encryption = xfer;
+       }
+       return err;
+ }
+ /**
+  * loop_set_status_from_info - configure device from loop_info
+  * @lo: struct loop_device to configure
+  * @info: struct loop_info64 to configure the device with
+  *
+  * Configures the loop device parameters according to the passed
+  * in loop_info64 configuration.
+  */
+ static int
+ loop_set_status_from_info(struct loop_device *lo,
+                         const struct loop_info64 *info)
+ {
+       int err;
+       struct loop_func_table *xfer;
+       kuid_t uid = current_uid();
+       if ((unsigned int) info->lo_encrypt_key_size > LO_KEY_SIZE)
+               return -EINVAL;
+       err = loop_release_xfer(lo);
+       if (err)
+               return err;
+       if (info->lo_encrypt_type) {
+               unsigned int type = info->lo_encrypt_type;
+               if (type >= MAX_LO_CRYPT)
+                       return -EINVAL;
+               xfer = xfer_funcs[type];
+               if (xfer == NULL)
+                       return -EINVAL;
+       } else
+               xfer = NULL;
+       err = loop_init_xfer(lo, xfer, info);
+       if (err)
+               return err;
+       lo->lo_offset = info->lo_offset;
+       lo->lo_sizelimit = info->lo_sizelimit;
+       memcpy(lo->lo_file_name, info->lo_file_name, LO_NAME_SIZE);
+       memcpy(lo->lo_crypt_name, info->lo_crypt_name, LO_NAME_SIZE);
+       lo->lo_file_name[LO_NAME_SIZE-1] = 0;
+       lo->lo_crypt_name[LO_NAME_SIZE-1] = 0;
+       if (!xfer)
+               xfer = &none_funcs;
+       lo->transfer = xfer->transfer;
+       lo->ioctl = xfer->ioctl;
+       lo->lo_flags = info->lo_flags;
+       lo->lo_encrypt_key_size = info->lo_encrypt_key_size;
+       lo->lo_init[0] = info->lo_init[0];
+       lo->lo_init[1] = info->lo_init[1];
+       if (info->lo_encrypt_key_size) {
+               memcpy(lo->lo_encrypt_key, info->lo_encrypt_key,
+                      info->lo_encrypt_key_size);
+               lo->lo_key_owner = uid;
+       }
+       return 0;
+ }
+ static int loop_configure(struct loop_device *lo, fmode_t mode,
+                         struct block_device *bdev,
+                         const struct loop_config *config)
  {
        struct file     *file;
        struct inode    *inode;
        struct address_space *mapping;
        struct block_device *claimed_bdev = NULL;
-       int             lo_flags = 0;
        int             error;
        loff_t          size;
        bool            partscan;
+       unsigned short  bsize;
  
        /* This is safe, since we have a reference from open(). */
        __module_get(THIS_MODULE);
  
        error = -EBADF;
-       file = fget(arg);
+       file = fget(config->fd);
        if (!file)
                goto out;
  
         * here to avoid changing device under exclusive owner.
         */
        if (!(mode & FMODE_EXCL)) {
-               claimed_bdev = bd_start_claiming(bdev, loop_set_fd);
+               claimed_bdev = bd_start_claiming(bdev, loop_configure);
                if (IS_ERR(claimed_bdev)) {
                        error = PTR_ERR(claimed_bdev);
                        goto out_putf;
        mapping = file->f_mapping;
        inode = mapping->host;
  
+       size = get_loop_size(lo, file);
+       if ((config->info.lo_flags & ~LOOP_CONFIGURE_SETTABLE_FLAGS) != 0) {
+               error = -EINVAL;
+               goto out_unlock;
+       }
+       if (config->block_size) {
+               error = loop_validate_block_size(config->block_size);
+               if (error)
+                       goto out_unlock;
+       }
+       error = loop_set_status_from_info(lo, &config->info);
+       if (error)
+               goto out_unlock;
        if (!(file->f_mode & FMODE_WRITE) || !(mode & FMODE_WRITE) ||
            !file->f_op->write_iter)
-               lo_flags |= LO_FLAGS_READ_ONLY;
+               lo->lo_flags |= LO_FLAGS_READ_ONLY;
  
-       error = -EFBIG;
-       size = get_loop_size(lo, file);
-       if ((loff_t)(sector_t)size != size)
-               goto out_unlock;
        error = loop_prepare_queue(lo);
        if (error)
                goto out_unlock;
  
-       error = 0;
-       set_device_ro(bdev, (lo_flags & LO_FLAGS_READ_ONLY) != 0);
+       set_device_ro(bdev, (lo->lo_flags & LO_FLAGS_READ_ONLY) != 0);
  
-       lo->use_dio = false;
+       lo->use_dio = lo->lo_flags & LO_FLAGS_DIRECT_IO;
        lo->lo_device = bdev;
-       lo->lo_flags = lo_flags;
        lo->lo_backing_file = file;
-       lo->transfer = NULL;
-       lo->ioctl = NULL;
-       lo->lo_sizelimit = 0;
        lo->old_gfp_mask = mapping_gfp_mask(mapping);
        mapping_set_gfp_mask(mapping, lo->old_gfp_mask & ~(__GFP_IO|__GFP_FS));
  
-       if (!(lo_flags & LO_FLAGS_READ_ONLY) && file->f_op->fsync)
+       if (!(lo->lo_flags & LO_FLAGS_READ_ONLY) && file->f_op->fsync)
                blk_queue_write_cache(lo->lo_queue, true, false);
  
-       if (io_is_direct(lo->lo_backing_file) && inode->i_sb->s_bdev) {
+       if (config->block_size)
+               bsize = config->block_size;
+       else if (io_is_direct(lo->lo_backing_file) && inode->i_sb->s_bdev)
                /* In case of direct I/O, match underlying block size */
-               unsigned short bsize = bdev_logical_block_size(
-                       inode->i_sb->s_bdev);
+               bsize = bdev_logical_block_size(inode->i_sb->s_bdev);
+       else
+               bsize = 512;
  
-               blk_queue_logical_block_size(lo->lo_queue, bsize);
-               blk_queue_physical_block_size(lo->lo_queue, bsize);
-               blk_queue_io_min(lo->lo_queue, bsize);
-       }
+       blk_queue_logical_block_size(lo->lo_queue, bsize);
+       blk_queue_physical_block_size(lo->lo_queue, bsize);
+       blk_queue_io_min(lo->lo_queue, bsize);
  
        loop_update_rotational(lo);
        loop_update_dio(lo);
-       set_capacity(lo->lo_disk, size);
-       bd_set_size(bdev, size << 9);
        loop_sysfs_init(lo);
-       /* let user-space know about the new size */
-       kobject_uevent(&disk_to_dev(bdev->bd_disk)->kobj, KOBJ_CHANGE);
+       loop_set_size(lo, size);
  
        set_blocksize(bdev, S_ISBLK(inode->i_mode) ?
                      block_size(inode->i_bdev) : PAGE_SIZE);
        if (partscan)
                loop_reread_partitions(lo, bdev);
        if (claimed_bdev)
-               bd_abort_claiming(bdev, claimed_bdev, loop_set_fd);
+               bd_abort_claiming(bdev, claimed_bdev, loop_configure);
        return 0;
  
  out_unlock:
        mutex_unlock(&loop_ctl_mutex);
  out_bdev:
        if (claimed_bdev)
-               bd_abort_claiming(bdev, claimed_bdev, loop_set_fd);
+               bd_abort_claiming(bdev, claimed_bdev, loop_configure);
  out_putf:
        fput(file);
  out:
        return error;
  }
  
- static int
- loop_release_xfer(struct loop_device *lo)
- {
-       int err = 0;
-       struct loop_func_table *xfer = lo->lo_encryption;
-       if (xfer) {
-               if (xfer->release)
-                       err = xfer->release(lo);
-               lo->transfer = NULL;
-               lo->lo_encryption = NULL;
-               module_put(xfer->owner);
-       }
-       return err;
- }
- static int
- loop_init_xfer(struct loop_device *lo, struct loop_func_table *xfer,
-              const struct loop_info64 *i)
- {
-       int err = 0;
-       if (xfer) {
-               struct module *owner = xfer->owner;
-               if (!try_module_get(owner))
-                       return -EINVAL;
-               if (xfer->init)
-                       err = xfer->init(lo, i);
-               if (err)
-                       module_put(owner);
-               else
-                       lo->lo_encryption = xfer;
-       }
-       return err;
- }
  static int __loop_clr_fd(struct loop_device *lo, bool release)
  {
        struct file *filp = NULL;
@@@ -1263,10 -1344,11 +1344,11 @@@ static in
  loop_set_status(struct loop_device *lo, const struct loop_info64 *info)
  {
        int err;
-       struct loop_func_table *xfer;
-       kuid_t uid = current_uid();
        struct block_device *bdev;
+       kuid_t uid = current_uid();
+       int prev_lo_flags;
        bool partscan = false;
+       bool size_changed = false;
  
        err = mutex_lock_killable(&loop_ctl_mutex);
        if (err)
                err = -ENXIO;
                goto out_unlock;
        }
-       if ((unsigned int) info->lo_encrypt_key_size > LO_KEY_SIZE) {
-               err = -EINVAL;
-               goto out_unlock;
-       }
  
        if (lo->lo_offset != info->lo_offset ||
            lo->lo_sizelimit != info->lo_sizelimit) {
+               size_changed = true;
                sync_blockdev(lo->lo_device);
                kill_bdev(lo->lo_device);
        }
        /* I/O need to be drained during transfer transition */
        blk_mq_freeze_queue(lo->lo_queue);
  
-       err = loop_release_xfer(lo);
-       if (err)
+       if (size_changed && lo->lo_device->bd_inode->i_mapping->nrpages) {
+               /* If any pages were dirtied after kill_bdev(), try again */
+               err = -EAGAIN;
+               pr_warn("%s: loop%d (%s) has still dirty pages (nrpages=%lu)\n",
+                       __func__, lo->lo_number, lo->lo_file_name,
+                       lo->lo_device->bd_inode->i_mapping->nrpages);
                goto out_unfreeze;
+       }
  
-       if (info->lo_encrypt_type) {
-               unsigned int type = info->lo_encrypt_type;
-               if (type >= MAX_LO_CRYPT) {
-                       err = -EINVAL;
-                       goto out_unfreeze;
-               }
-               xfer = xfer_funcs[type];
-               if (xfer == NULL) {
-                       err = -EINVAL;
-                       goto out_unfreeze;
-               }
-       } else
-               xfer = NULL;
+       prev_lo_flags = lo->lo_flags;
  
-       err = loop_init_xfer(lo, xfer, info);
+       err = loop_set_status_from_info(lo, info);
        if (err)
                goto out_unfreeze;
  
-       if (lo->lo_offset != info->lo_offset ||
-           lo->lo_sizelimit != info->lo_sizelimit) {
-               /* kill_bdev should have truncated all the pages */
-               if (lo->lo_device->bd_inode->i_mapping->nrpages) {
-                       err = -EAGAIN;
-                       pr_warn("%s: loop%d (%s) has still dirty pages (nrpages=%lu)\n",
-                               __func__, lo->lo_number, lo->lo_file_name,
-                               lo->lo_device->bd_inode->i_mapping->nrpages);
-                       goto out_unfreeze;
-               }
-               if (figure_loop_size(lo, info->lo_offset, info->lo_sizelimit)) {
-                       err = -EFBIG;
-                       goto out_unfreeze;
-               }
+       /* Mask out flags that can't be set using LOOP_SET_STATUS. */
+       lo->lo_flags &= ~LOOP_SET_STATUS_SETTABLE_FLAGS;
+       /* For those flags, use the previous values instead */
+       lo->lo_flags |= prev_lo_flags & ~LOOP_SET_STATUS_SETTABLE_FLAGS;
+       /* For flags that can't be cleared, use previous values too */
+       lo->lo_flags |= prev_lo_flags & ~LOOP_SET_STATUS_CLEARABLE_FLAGS;
+       if (size_changed) {
+               loff_t new_size = get_size(lo->lo_offset, lo->lo_sizelimit,
+                                          lo->lo_backing_file);
+               loop_set_size(lo, new_size);
        }
  
        loop_config_discard(lo);
  
-       memcpy(lo->lo_file_name, info->lo_file_name, LO_NAME_SIZE);
-       memcpy(lo->lo_crypt_name, info->lo_crypt_name, LO_NAME_SIZE);
-       lo->lo_file_name[LO_NAME_SIZE-1] = 0;
-       lo->lo_crypt_name[LO_NAME_SIZE-1] = 0;
-       if (!xfer)
-               xfer = &none_funcs;
-       lo->transfer = xfer->transfer;
-       lo->ioctl = xfer->ioctl;
-       if ((lo->lo_flags & LO_FLAGS_AUTOCLEAR) !=
-            (info->lo_flags & LO_FLAGS_AUTOCLEAR))
-               lo->lo_flags ^= LO_FLAGS_AUTOCLEAR;
-       lo->lo_encrypt_key_size = info->lo_encrypt_key_size;
-       lo->lo_init[0] = info->lo_init[0];
-       lo->lo_init[1] = info->lo_init[1];
-       if (info->lo_encrypt_key_size) {
-               memcpy(lo->lo_encrypt_key, info->lo_encrypt_key,
-                      info->lo_encrypt_key_size);
-               lo->lo_key_owner = uid;
-       }
        /* update dio if lo_offset or transfer is changed */
        __loop_update_dio(lo, lo->use_dio);
  
  out_unfreeze:
        blk_mq_unfreeze_queue(lo->lo_queue);
  
-       if (!err && (info->lo_flags & LO_FLAGS_PARTSCAN) &&
-            !(lo->lo_flags & LO_FLAGS_PARTSCAN)) {
-               lo->lo_flags |= LO_FLAGS_PARTSCAN;
+       if (!err && (lo->lo_flags & LO_FLAGS_PARTSCAN) &&
+            !(prev_lo_flags & LO_FLAGS_PARTSCAN)) {
                lo->lo_disk->flags &= ~GENHD_FL_NO_PART_SCAN;
                bdev = lo->lo_device;
                partscan = true;
@@@ -1531,10 -1575,15 +1575,15 @@@ loop_get_status64(struct loop_device *l
  
  static int loop_set_capacity(struct loop_device *lo)
  {
+       loff_t size;
        if (unlikely(lo->lo_state != Lo_bound))
                return -ENXIO;
  
-       return figure_loop_size(lo, lo->lo_offset, lo->lo_sizelimit);
+       size = get_loop_size(lo, lo->lo_backing_file);
+       loop_set_size(lo, size);
+       return 0;
  }
  
  static int loop_set_dio(struct loop_device *lo, unsigned long arg)
@@@ -1558,8 -1607,9 +1607,9 @@@ static int loop_set_block_size(struct l
        if (lo->lo_state != Lo_bound)
                return -ENXIO;
  
-       if (arg < 512 || arg > PAGE_SIZE || !is_power_of_2(arg))
-               return -EINVAL;
+       err = loop_validate_block_size(arg);
+       if (err)
+               return err;
  
        if (lo->lo_queue->limits.logical_block_size == arg)
                return 0;
@@@ -1617,11 -1667,31 +1667,31 @@@ static int lo_ioctl(struct block_devic
        unsigned int cmd, unsigned long arg)
  {
        struct loop_device *lo = bdev->bd_disk->private_data;
+       void __user *argp = (void __user *) arg;
        int err;
  
        switch (cmd) {
-       case LOOP_SET_FD:
-               return loop_set_fd(lo, mode, bdev, arg);
+       case LOOP_SET_FD: {
+               /*
+                * Legacy case - pass in a zeroed out struct loop_config with
+                * only the file descriptor set , which corresponds with the
+                * default parameters we'd have used otherwise.
+                */
+               struct loop_config config;
+               memset(&config, 0, sizeof(config));
+               config.fd = arg;
+               return loop_configure(lo, mode, bdev, &config);
+       }
+       case LOOP_CONFIGURE: {
+               struct loop_config config;
+               if (copy_from_user(&config, argp, sizeof(config)))
+                       return -EFAULT;
+               return loop_configure(lo, mode, bdev, &config);
+       }
        case LOOP_CHANGE_FD:
                return loop_change_fd(lo, bdev, arg);
        case LOOP_CLR_FD:
        case LOOP_SET_STATUS:
                err = -EPERM;
                if ((mode & FMODE_WRITE) || capable(CAP_SYS_ADMIN)) {
-                       err = loop_set_status_old(lo,
-                                       (struct loop_info __user *)arg);
+                       err = loop_set_status_old(lo, argp);
                }
                break;
        case LOOP_GET_STATUS:
-               return loop_get_status_old(lo, (struct loop_info __user *) arg);
+               return loop_get_status_old(lo, argp);
        case LOOP_SET_STATUS64:
                err = -EPERM;
                if ((mode & FMODE_WRITE) || capable(CAP_SYS_ADMIN)) {
-                       err = loop_set_status64(lo,
-                                       (struct loop_info64 __user *) arg);
+                       err = loop_set_status64(lo, argp);
                }
                break;
        case LOOP_GET_STATUS64:
-               return loop_get_status64(lo, (struct loop_info64 __user *) arg);
+               return loop_get_status64(lo, argp);
        case LOOP_SET_CAPACITY:
        case LOOP_SET_DIRECT_IO:
        case LOOP_SET_BLOCK_SIZE:
@@@ -1795,6 -1863,7 +1863,7 @@@ static int lo_compat_ioctl(struct block
        case LOOP_CLR_FD:
        case LOOP_GET_STATUS64:
        case LOOP_SET_STATUS64:
+       case LOOP_CONFIGURE:
                arg = (unsigned long) compat_ptr(arg);
                /* fall through */
        case LOOP_SET_FD:
@@@ -2037,7 -2106,7 +2106,7 @@@ static int loop_add(struct loop_device 
        lo->tag_set.queue_depth = 128;
        lo->tag_set.numa_node = NUMA_NO_NODE;
        lo->tag_set.cmd_size = sizeof(struct loop_cmd);
 -      lo->tag_set.flags = BLK_MQ_F_SHOULD_MERGE;
 +      lo->tag_set.flags = BLK_MQ_F_SHOULD_MERGE | BLK_MQ_F_STACKING;
        lo->tag_set.driver_data = lo;
  
        err = blk_mq_alloc_tag_set(&lo->tag_set);
@@@ -110,7 -110,7 +110,7 @@@ static void bch_data_invalidate(struct 
        struct data_insert_op *op = container_of(cl, struct data_insert_op, cl);
        struct bio *bio = op->bio;
  
-       pr_debug("invalidating %i sectors from %llu",
+       pr_debug("invalidating %i sectors from %llu\n",
                 bio_sectors(bio), (uint64_t) bio->bi_iter.bi_sector);
  
        while (bio_sectors(bio)) {
@@@ -396,7 -396,7 +396,7 @@@ static bool check_should_bypass(struct 
  
        if (bio->bi_iter.bi_sector & (c->sb.block_size - 1) ||
            bio_sectors(bio) & (c->sb.block_size - 1)) {
-               pr_debug("skipping unaligned io");
+               pr_debug("skipping unaligned io\n");
                goto skip;
        }
  
@@@ -650,7 -650,7 +650,7 @@@ static void backing_request_endio(struc
                 */
                if (unlikely(s->iop.writeback &&
                             bio->bi_opf & REQ_PREFLUSH)) {
-                       pr_err("Can't flush %s: returned bi_status %i",
+                       pr_err("Can't flush %s: returned bi_status %i\n",
                                dc->backing_dev_name, bio->bi_status);
                } else {
                        /* set to orig_bio->bi_status in bio_complete() */
  static void bio_complete(struct search *s)
  {
        if (s->orig_bio) {
 -              generic_end_io_acct(s->d->disk->queue, bio_op(s->orig_bio),
 -                                  &s->d->disk->part0, s->start_time);
 -
 +              bio_end_io_acct(s->orig_bio, s->start_time);
                trace_bcache_request_end(s->d, s->orig_bio);
                s->orig_bio->bi_status = s->iop.status;
                bio_endio(s->orig_bio);
@@@ -728,7 -730,7 +728,7 @@@ static inline struct search *search_all
        s->recoverable          = 1;
        s->write                = op_is_write(bio_op(bio));
        s->read_dirty_data      = 0;
 -      s->start_time           = jiffies;
 +      s->start_time           = bio_start_io_acct(bio);
  
        s->iop.c                = d->c;
        s->iop.bio              = NULL;
@@@ -1080,7 -1082,8 +1080,7 @@@ static void detached_dev_end_io(struct 
        bio->bi_end_io = ddip->bi_end_io;
        bio->bi_private = ddip->bi_private;
  
 -      generic_end_io_acct(ddip->d->disk->queue, bio_op(bio),
 -                          &ddip->d->disk->part0, ddip->start_time);
 +      bio_end_io_acct(bio, ddip->start_time);
  
        if (bio->bi_status) {
                struct cached_dev *dc = container_of(ddip->d,
@@@ -1105,7 -1108,7 +1105,7 @@@ static void detached_dev_do_request(str
         */
        ddip = kzalloc(sizeof(struct detached_dev_io_private), GFP_NOIO);
        ddip->d = d;
 -      ddip->start_time = jiffies;
 +      ddip->start_time = bio_start_io_acct(bio);
        ddip->bi_end_io = bio->bi_end_io;
        ddip->bi_private = bio->bi_private;
        bio->bi_end_io = detached_dev_end_io;
@@@ -1187,6 -1190,11 +1187,6 @@@ blk_qc_t cached_dev_make_request(struc
                }
        }
  
 -      generic_start_io_acct(q,
 -                            bio_op(bio),
 -                            bio_sectors(bio),
 -                            &d->disk->part0);
 -
        bio_set_dev(bio, dc->bdev);
        bio->bi_iter.bi_sector += dc->sb.data_offset;
  
@@@ -1303,6 -1311,8 +1303,6 @@@ blk_qc_t flash_dev_make_request(struct 
                return BLK_QC_T_NONE;
        }
  
 -      generic_start_io_acct(q, bio_op(bio), bio_sectors(bio), &d->disk->part0);
 -
        s = search_alloc(bio, d);
        cl = &s->cl;
        bio = &s->bio.bio;
diff --combined drivers/nvme/host/core.c
@@@ -19,7 -19,6 +19,6 @@@
  #include <linux/pr.h>
  #include <linux/ptrace.h>
  #include <linux/nvme_ioctl.h>
- #include <linux/t10-pi.h>
  #include <linux/pm_qos.h>
  #include <asm/unaligned.h>
  
@@@ -204,11 -203,6 +203,6 @@@ static void nvme_delete_ctrl_sync(struc
        nvme_put_ctrl(ctrl);
  }
  
- static inline bool nvme_ns_has_pi(struct nvme_ns *ns)
- {
-       return ns->pi_type && ns->ms == sizeof(struct t10_pi_tuple);
- }
  static blk_status_t nvme_error_status(u16 status)
  {
        switch (status & 0x7ff) {
@@@ -310,7 -304,7 +304,7 @@@ bool nvme_cancel_request(struct reques
                return true;
  
        nvme_req(req)->status = NVME_SC_HOST_ABORTED_CMD;
 -      blk_mq_complete_request(req);
 +      blk_mq_force_complete_rq(req);
        return true;
  }
  EXPORT_SYMBOL_GPL(nvme_cancel_request);
@@@ -433,7 -427,6 +427,6 @@@ static void nvme_free_ns_head(struct kr
  
        nvme_mpath_remove_disk(head);
        ida_simple_remove(&head->subsys->ns_ida, head->instance);
-       list_del_init(&head->entry);
        cleanup_srcu_struct(&head->srcu);
        nvme_put_subsystem(head->subsys);
        kfree(head);
@@@ -530,7 -523,7 +523,7 @@@ static int nvme_get_stream_params(struc
  
        c.directive.opcode = nvme_admin_directive_recv;
        c.directive.nsid = cpu_to_le32(nsid);
-       c.directive.numd = cpu_to_le32((sizeof(*s) >> 2) - 1);
+       c.directive.numd = cpu_to_le32(nvme_bytes_to_numd(sizeof(*s)));
        c.directive.doper = NVME_DIR_RCV_ST_OP_PARAM;
        c.directive.dtype = NVME_DIR_STREAMS;
  
@@@ -553,19 -546,22 +546,22 @@@ static int nvme_configure_directives(st
  
        ret = nvme_get_stream_params(ctrl, &s, NVME_NSID_ALL);
        if (ret)
-               return ret;
+               goto out_disable_stream;
  
        ctrl->nssa = le16_to_cpu(s.nssa);
        if (ctrl->nssa < BLK_MAX_WRITE_HINTS - 1) {
                dev_info(ctrl->device, "too few streams (%u) available\n",
                                        ctrl->nssa);
-               nvme_disable_streams(ctrl);
-               return 0;
+               goto out_disable_stream;
        }
  
        ctrl->nr_streams = min_t(unsigned, ctrl->nssa, BLK_MAX_WRITE_HINTS - 1);
        dev_info(ctrl->device, "Using %u streams\n", ctrl->nr_streams);
        return 0;
+ out_disable_stream:
+       nvme_disable_streams(ctrl);
+       return ret;
  }
  
  /*
@@@ -1027,6 -1023,19 +1023,19 @@@ void nvme_stop_keep_alive(struct nvme_c
  }
  EXPORT_SYMBOL_GPL(nvme_stop_keep_alive);
  
+ /*
+  * In NVMe 1.0 the CNS field was just a binary controller or namespace
+  * flag, thus sending any new CNS opcodes has a big chance of not working.
+  * Qemu unfortunately had that bug after reporting a 1.1 version compliance
+  * (but not for any later version).
+  */
+ static bool nvme_ctrl_limited_cns(struct nvme_ctrl *ctrl)
+ {
+       if (ctrl->quirks & NVME_QUIRK_IDENTIFY_CNS)
+               return ctrl->vs < NVME_VS(1, 2, 0);
+       return ctrl->vs < NVME_VS(1, 1, 0);
+ }
  static int nvme_identify_ctrl(struct nvme_ctrl *dev, struct nvme_id_ctrl **id)
  {
        struct nvme_command c = { };
@@@ -1290,7 -1299,7 +1299,7 @@@ static int nvme_submit_io(struct nvme_n
        meta_len = (io.nblocks + 1) * ns->ms;
        metadata = nvme_to_user_ptr(io.metadata);
  
-       if (ns->ext) {
+       if (ns->features & NVME_NS_EXT_LBAS) {
                length += meta_len;
                meta_len = 0;
        } else if (meta_len) {
@@@ -1392,8 -1401,10 +1401,10 @@@ static void nvme_passthru_end(struct nv
        }
        if (effects & NVME_CMD_EFFECTS_CCC)
                nvme_init_identify(ctrl);
-       if (effects & (NVME_CMD_EFFECTS_NIC | NVME_CMD_EFFECTS_NCC))
+       if (effects & (NVME_CMD_EFFECTS_NIC | NVME_CMD_EFFECTS_NCC)) {
                nvme_queue_scan(ctrl);
+               flush_work(&ctrl->scan_work);
+       }
  }
  
  static int nvme_user_cmd(struct nvme_ctrl *ctrl, struct nvme_ns *ns,
@@@ -1682,7 -1693,8 +1693,8 @@@ static int nvme_getgeo(struct block_dev
  }
  
  #ifdef CONFIG_BLK_DEV_INTEGRITY
- static void nvme_init_integrity(struct gendisk *disk, u16 ms, u8 pi_type)
+ static void nvme_init_integrity(struct gendisk *disk, u16 ms, u8 pi_type,
+                               u32 max_integrity_segments)
  {
        struct blk_integrity integrity;
  
        }
        integrity.tuple_size = ms;
        blk_integrity_register(disk, &integrity);
-       blk_queue_max_integrity_segments(disk->queue, 1);
+       blk_queue_max_integrity_segments(disk->queue, max_integrity_segments);
  }
  #else
- static void nvme_init_integrity(struct gendisk *disk, u16 ms, u8 pi_type)
+ static void nvme_init_integrity(struct gendisk *disk, u16 ms, u8 pi_type,
+                               u32 max_integrity_segments)
  {
  }
  #endif /* CONFIG_BLK_DEV_INTEGRITY */
  
- static void nvme_set_chunk_size(struct nvme_ns *ns)
- {
-       u32 chunk_size = nvme_lba_to_sect(ns, ns->noiob);
-       blk_queue_chunk_sectors(ns->queue, rounddown_pow_of_two(chunk_size));
- }
  static void nvme_config_discard(struct gendisk *disk, struct nvme_ns *ns)
  {
        struct nvme_ctrl *ctrl = ns->ctrl;
@@@ -1804,12 -1811,37 +1811,37 @@@ static bool nvme_ns_ids_equal(struct nv
                memcmp(&a->eui64, &b->eui64, sizeof(a->eui64)) == 0;
  }
  
+ static int nvme_setup_streams_ns(struct nvme_ctrl *ctrl, struct nvme_ns *ns,
+                                u32 *phys_bs, u32 *io_opt)
+ {
+       struct streams_directive_params s;
+       int ret;
+       if (!ctrl->nr_streams)
+               return 0;
+       ret = nvme_get_stream_params(ctrl, &s, ns->head->ns_id);
+       if (ret)
+               return ret;
+       ns->sws = le32_to_cpu(s.sws);
+       ns->sgs = le16_to_cpu(s.sgs);
+       if (ns->sws) {
+               *phys_bs = ns->sws * (1 << ns->lba_shift);
+               if (ns->sgs)
+                       *io_opt = *phys_bs * ns->sgs;
+       }
+       return 0;
+ }
  static void nvme_update_disk_info(struct gendisk *disk,
                struct nvme_ns *ns, struct nvme_id_ns *id)
  {
        sector_t capacity = nvme_lba_to_sect(ns, le64_to_cpu(id->nsze));
        unsigned short bs = 1 << ns->lba_shift;
-       u32 atomic_bs, phys_bs, io_opt;
+       u32 atomic_bs, phys_bs, io_opt = 0;
  
        if (ns->lba_shift > PAGE_SHIFT) {
                /* unsupported block size, set capacity to 0 later */
        blk_mq_freeze_queue(disk->queue);
        blk_integrity_unregister(disk);
  
+       atomic_bs = phys_bs = bs;
+       nvme_setup_streams_ns(ns->ctrl, ns, &phys_bs, &io_opt);
        if (id->nabo == 0) {
                /*
                 * Bit 1 indicates whether NAWUPF is defined for this namespace
                 * and whether it should be used instead of AWUPF. If NAWUPF ==
                 * 0 then AWUPF must be used instead.
                 */
-               if (id->nsfeat & (1 << 1) && id->nawupf)
+               if (id->nsfeat & NVME_NS_FEAT_ATOMICS && id->nawupf)
                        atomic_bs = (1 + le16_to_cpu(id->nawupf)) * bs;
                else
                        atomic_bs = (1 + ns->ctrl->subsys->awupf) * bs;
-       } else {
-               atomic_bs = bs;
        }
-       phys_bs = bs;
-       io_opt = bs;
-       if (id->nsfeat & (1 << 4)) {
+       if (id->nsfeat & NVME_NS_FEAT_IO_OPT) {
                /* NPWG = Namespace Preferred Write Granularity */
-               phys_bs *= 1 + le16_to_cpu(id->npwg);
+               phys_bs = bs * (1 + le16_to_cpu(id->npwg));
                /* NOWS = Namespace Optimal Write Size */
-               io_opt *= 1 + le16_to_cpu(id->nows);
+               io_opt = bs * (1 + le16_to_cpu(id->nows));
        }
  
        blk_queue_logical_block_size(disk->queue, bs);
        blk_queue_io_min(disk->queue, phys_bs);
        blk_queue_io_opt(disk->queue, io_opt);
  
-       if (ns->ms && !ns->ext &&
-           (ns->ctrl->ops->flags & NVME_F_METADATA_SUPPORTED))
-               nvme_init_integrity(disk, ns->ms, ns->pi_type);
-       if ((ns->ms && !nvme_ns_has_pi(ns) && !blk_get_integrity(disk)) ||
-           ns->lba_shift > PAGE_SHIFT)
+       /*
+        * The block layer can't support LBA sizes larger than the page size
+        * yet, so catch this early and don't allow block I/O.
+        */
+       if (ns->lba_shift > PAGE_SHIFT)
                capacity = 0;
  
+       /*
+        * Register a metadata profile for PI, or the plain non-integrity NVMe
+        * metadata masquerading as Type 0 if supported, otherwise reject block
+        * I/O to namespaces with metadata except when the namespace supports
+        * PI, as it can strip/insert in that case.
+        */
+       if (ns->ms) {
+               if (IS_ENABLED(CONFIG_BLK_DEV_INTEGRITY) &&
+                   (ns->features & NVME_NS_METADATA_SUPPORTED))
+                       nvme_init_integrity(disk, ns->ms, ns->pi_type,
+                                           ns->ctrl->max_integrity_segments);
+               else if (!nvme_ns_has_pi(ns))
+                       capacity = 0;
+       }
        set_capacity_revalidate_and_notify(disk, capacity, false);
  
        nvme_config_discard(disk, ns);
        nvme_config_write_zeroes(disk, ns);
  
-       if (id->nsattr & (1 << 0))
+       if (id->nsattr & NVME_NS_ATTR_RO)
                set_disk_ro(disk, true);
        else
                set_disk_ro(disk, false);
        blk_mq_unfreeze_queue(disk->queue);
  }
  
- static void __nvme_revalidate_disk(struct gendisk *disk, struct nvme_id_ns *id)
+ static int __nvme_revalidate_disk(struct gendisk *disk, struct nvme_id_ns *id)
  {
        struct nvme_ns *ns = disk->private_data;
+       struct nvme_ctrl *ctrl = ns->ctrl;
+       u32 iob;
  
        /*
         * If identify namespace failed, use default 512 byte block size so
        ns->lba_shift = id->lbaf[id->flbas & NVME_NS_FLBAS_LBA_MASK].ds;
        if (ns->lba_shift == 0)
                ns->lba_shift = 9;
-       ns->noiob = le16_to_cpu(id->noiob);
+       if ((ctrl->quirks & NVME_QUIRK_STRIPE_SIZE) &&
+           is_power_of_2(ctrl->max_hw_sectors))
+               iob = ctrl->max_hw_sectors;
+       else
+               iob = nvme_lba_to_sect(ns, le16_to_cpu(id->noiob));
+       ns->features = 0;
        ns->ms = le16_to_cpu(id->lbaf[id->flbas & NVME_NS_FLBAS_LBA_MASK].ms);
-       ns->ext = ns->ms && (id->flbas & NVME_NS_FLBAS_META_EXT);
        /* the PI implementation requires metadata equal t10 pi tuple size */
        if (ns->ms == sizeof(struct t10_pi_tuple))
                ns->pi_type = id->dps & NVME_NS_DPS_PI_MASK;
        else
                ns->pi_type = 0;
  
-       if (ns->noiob)
-               nvme_set_chunk_size(ns);
+       if (ns->ms) {
+               /*
+                * For PCIe only the separate metadata pointer is supported,
+                * as the block layer supplies metadata in a separate bio_vec
+                * chain. For Fabrics, only metadata as part of extended data
+                * LBA is supported on the wire per the Fabrics specification,
+                * but the HBA/HCA will do the remapping from the separate
+                * metadata buffers for us.
+                */
+               if (id->flbas & NVME_NS_FLBAS_META_EXT) {
+                       ns->features |= NVME_NS_EXT_LBAS;
+                       if ((ctrl->ops->flags & NVME_F_FABRICS) &&
+                           (ctrl->ops->flags & NVME_F_METADATA_SUPPORTED) &&
+                           ctrl->max_integrity_segments)
+                               ns->features |= NVME_NS_METADATA_SUPPORTED;
+               } else {
+                       if (WARN_ON_ONCE(ctrl->ops->flags & NVME_F_FABRICS))
+                               return -EINVAL;
+                       if (ctrl->ops->flags & NVME_F_METADATA_SUPPORTED)
+                               ns->features |= NVME_NS_METADATA_SUPPORTED;
+               }
+       }
+       if (iob)
+               blk_queue_chunk_sectors(ns->queue, rounddown_pow_of_two(iob));
        nvme_update_disk_info(disk, ns, id);
  #ifdef CONFIG_NVME_MULTIPATH
        if (ns->head->disk) {
                nvme_update_disk_info(ns->head->disk, ns, id);
                blk_queue_stack_limits(ns->head->disk->queue, ns->queue);
-               if (bdi_cap_stable_pages_required(ns->queue->backing_dev_info)) {
-                       struct backing_dev_info *info =
-                               ns->head->disk->queue->backing_dev_info;
-                         info->capabilities |= BDI_CAP_STABLE_WRITES;
-               }
                revalidate_disk(ns->head->disk);
        }
  #endif
+       return 0;
  }
  
  static int nvme_revalidate_disk(struct gendisk *disk)
                goto free_id;
        }
  
-       __nvme_revalidate_disk(disk, id);
        ret = nvme_report_ns_ids(ctrl, ns->head->ns_id, id, &ids);
        if (ret)
                goto free_id;
                dev_err(ctrl->device,
                        "identifiers changed for nsid %d\n", ns->head->ns_id);
                ret = -ENODEV;
+               goto free_id;
        }
  
+       ret = __nvme_revalidate_disk(disk, id);
  free_id:
        kfree(id);
  out:
@@@ -2249,10 -2321,8 +2321,8 @@@ static void nvme_set_queue_limits(struc
                blk_queue_max_hw_sectors(q, ctrl->max_hw_sectors);
                blk_queue_max_segments(q, min_t(u32, max_segments, USHRT_MAX));
        }
-       if ((ctrl->quirks & NVME_QUIRK_STRIPE_SIZE) &&
-           is_power_of_2(ctrl->max_hw_sectors))
-               blk_queue_chunk_sectors(q, ctrl->max_hw_sectors);
        blk_queue_virt_boundary(q, ctrl->page_size - 1);
+       blk_queue_dma_alignment(q, 7);
        if (ctrl->vwc & NVME_CTRL_VWC_PRESENT)
                vwc = true;
        blk_queue_write_cache(q, vwc, vwc);
@@@ -2655,7 -2725,7 +2725,7 @@@ static bool nvme_validate_cntlid(struc
                        return false;
                }
  
-               if ((id->cmic & (1 << 1)) ||
+               if ((id->cmic & NVME_CTRL_CMIC_MULTI_CTRL) ||
                    (ctrl->opts && ctrl->opts->discovery_nqn))
                        continue;
  
@@@ -2746,7 -2816,7 +2816,7 @@@ int nvme_get_log(struct nvme_ctrl *ctrl
                void *log, size_t size, u64 offset)
  {
        struct nvme_command c = { };
-       unsigned long dwlen = size / 4 - 1;
+       u32 dwlen = nvme_bytes_to_numd(size);
  
        c.get_log_page.opcode = nvme_admin_get_log_page;
        c.get_log_page.nsid = cpu_to_le32(nsid);
@@@ -3401,7 -3471,6 +3471,6 @@@ static int __nvme_check_ids(struct nvme
  
        list_for_each_entry(h, &subsys->nsheads, entry) {
                if (nvme_ns_ids_valid(&new->ids) &&
-                   !list_empty(&h->list) &&
                    nvme_ns_ids_equal(&new->ids, &h->ids))
                        return -EINVAL;
        }
  }
  
  static struct nvme_ns_head *nvme_alloc_ns_head(struct nvme_ctrl *ctrl,
-               unsigned nsid, struct nvme_id_ns *id,
-               struct nvme_ns_ids *ids)
+               unsigned nsid, struct nvme_ns_ids *ids)
  {
        struct nvme_ns_head *head;
        size_t size = sizeof(*head);
@@@ -3469,42 -3537,51 +3537,51 @@@ static int nvme_init_ns_head(struct nvm
                struct nvme_id_ns *id)
  {
        struct nvme_ctrl *ctrl = ns->ctrl;
-       bool is_shared = id->nmic & (1 << 0);
+       bool is_shared = id->nmic & NVME_NS_NMIC_SHARED;
        struct nvme_ns_head *head = NULL;
        struct nvme_ns_ids ids;
        int ret = 0;
  
        ret = nvme_report_ns_ids(ctrl, nsid, id, &ids);
-       if (ret)
-               goto out;
+       if (ret) {
+               if (ret < 0)
+                       return ret;
+               return blk_status_to_errno(nvme_error_status(ret));
+       }
  
        mutex_lock(&ctrl->subsys->lock);
-       if (is_shared)
-               head = nvme_find_ns_head(ctrl->subsys, nsid);
+       head = nvme_find_ns_head(ctrl->subsys, nsid);
        if (!head) {
-               head = nvme_alloc_ns_head(ctrl, nsid, id, &ids);
+               head = nvme_alloc_ns_head(ctrl, nsid, &ids);
                if (IS_ERR(head)) {
                        ret = PTR_ERR(head);
                        goto out_unlock;
                }
+               head->shared = is_shared;
        } else {
+               ret = -EINVAL;
+               if (!is_shared || !head->shared) {
+                       dev_err(ctrl->device,
+                               "Duplicate unshared namespace %d\n", nsid);
+                       goto out_put_ns_head;
+               }
                if (!nvme_ns_ids_equal(&head->ids, &ids)) {
                        dev_err(ctrl->device,
                                "IDs don't match for shared namespace %d\n",
                                        nsid);
-                       ret = -EINVAL;
-                       goto out_unlock;
+                       goto out_put_ns_head;
                }
        }
  
        list_add_tail(&ns->siblings, &head->list);
        ns->head = head;
+       mutex_unlock(&ctrl->subsys->lock);
+       return 0;
  
+ out_put_ns_head:
+       nvme_put_ns_head(head);
  out_unlock:
        mutex_unlock(&ctrl->subsys->lock);
- out:
-       if (ret > 0)
-               ret = blk_status_to_errno(nvme_error_status(ret));
        return ret;
  }
  
@@@ -3535,32 -3612,6 +3612,6 @@@ static struct nvme_ns *nvme_find_get_ns
        return ret;
  }
  
- static int nvme_setup_streams_ns(struct nvme_ctrl *ctrl, struct nvme_ns *ns)
- {
-       struct streams_directive_params s;
-       int ret;
-       if (!ctrl->nr_streams)
-               return 0;
-       ret = nvme_get_stream_params(ctrl, &s, ns->head->ns_id);
-       if (ret)
-               return ret;
-       ns->sws = le32_to_cpu(s.sws);
-       ns->sgs = le16_to_cpu(s.sgs);
-       if (ns->sws) {
-               unsigned int bs = 1 << ns->lba_shift;
-               blk_queue_io_min(ns->queue, bs * ns->sws);
-               if (ns->sgs)
-                       blk_queue_io_opt(ns->queue, bs * ns->sws * ns->sgs);
-       }
-       return 0;
- }
  static void nvme_alloc_ns(struct nvme_ctrl *ctrl, unsigned nsid)
  {
        struct nvme_ns *ns;
        ret = nvme_init_ns_head(ns, nsid, id);
        if (ret)
                goto out_free_id;
-       nvme_setup_streams_ns(ctrl, ns);
        nvme_set_disk_name(disk_name, ns, ctrl, &flags);
  
        disk = alloc_disk_node(0, node);
        memcpy(disk->disk_name, disk_name, DISK_NAME_LEN);
        ns->disk = disk;
  
-       __nvme_revalidate_disk(disk, id);
+       if (__nvme_revalidate_disk(disk, id))
+               goto out_free_disk;
  
        if ((ctrl->quirks & NVME_QUIRK_LIGHTNVM) && id->vs[0] == 0x1) {
                ret = nvme_nvm_register(ns, disk_name, node);
        /* prevent double queue cleanup */
        ns->disk->queue = NULL;
        put_disk(ns->disk);
+  out_free_disk:
+       del_gendisk(ns->disk);
   out_unlink_ns:
        mutex_lock(&ctrl->subsys->lock);
        list_del_rcu(&ns->siblings);
+       if (list_empty(&ns->head->list))
+               list_del_init(&ns->head->entry);
        mutex_unlock(&ctrl->subsys->lock);
        nvme_put_ns_head(ns->head);
   out_free_id:
@@@ -3667,7 -3722,10 +3722,10 @@@ static void nvme_ns_remove(struct nvme_
  
        mutex_lock(&ns->ctrl->subsys->lock);
        list_del_rcu(&ns->siblings);
+       if (list_empty(&ns->head->list))
+               list_del_init(&ns->head->entry);
        mutex_unlock(&ns->ctrl->subsys->lock);
        synchronize_rcu(); /* guarantee not available in head->list */
        nvme_mpath_clear_current_path(ns);
        synchronize_srcu(&ns->head->srcu); /* wait for concurrent submissions */
        nvme_put_ns(ns);
  }
  
+ static void nvme_ns_remove_by_nsid(struct nvme_ctrl *ctrl, u32 nsid)
+ {
+       struct nvme_ns *ns = nvme_find_get_ns(ctrl, nsid);
+       if (ns) {
+               nvme_ns_remove(ns);
+               nvme_put_ns(ns);
+       }
+ }
  static void nvme_validate_ns(struct nvme_ctrl *ctrl, unsigned nsid)
  {
        struct nvme_ns *ns;
@@@ -3718,39 -3786,34 +3786,34 @@@ static void nvme_remove_invalid_namespa
  
  }
  
- static int nvme_scan_ns_list(struct nvme_ctrl *ctrl, unsigned nn)
+ static int nvme_scan_ns_list(struct nvme_ctrl *ctrl)
  {
-       struct nvme_ns *ns;
+       const int nr_entries = NVME_IDENTIFY_DATA_SIZE / sizeof(__le32);
        __le32 *ns_list;
-       unsigned i, j, nsid, prev = 0;
-       unsigned num_lists = DIV_ROUND_UP_ULL((u64)nn, 1024);
-       int ret = 0;
+       u32 prev = 0;
+       int ret = 0, i;
+       if (nvme_ctrl_limited_cns(ctrl))
+               return -EOPNOTSUPP;
  
        ns_list = kzalloc(NVME_IDENTIFY_DATA_SIZE, GFP_KERNEL);
        if (!ns_list)
                return -ENOMEM;
  
-       for (i = 0; i < num_lists; i++) {
+       for (;;) {
                ret = nvme_identify_ns_list(ctrl, prev, ns_list);
                if (ret)
                        goto free;
  
-               for (j = 0; j < min(nn, 1024U); j++) {
-                       nsid = le32_to_cpu(ns_list[j]);
-                       if (!nsid)
-                               goto out;
+               for (i = 0; i < nr_entries; i++) {
+                       u32 nsid = le32_to_cpu(ns_list[i]);
  
+                       if (!nsid)      /* end of the list? */
+                               goto out;
                        nvme_validate_ns(ctrl, nsid);
-                       while (++prev < nsid) {
-                               ns = nvme_find_get_ns(ctrl, prev);
-                               if (ns) {
-                                       nvme_ns_remove(ns);
-                                       nvme_put_ns(ns);
-                               }
-                       }
+                       while (++prev < nsid)
+                               nvme_ns_remove_by_nsid(ctrl, prev);
                }
-               nn -= j;
        }
   out:
        nvme_remove_invalid_namespaces(ctrl, prev);
        return ret;
  }
  
- static void nvme_scan_ns_sequential(struct nvme_ctrl *ctrl, unsigned nn)
+ static void nvme_scan_ns_sequential(struct nvme_ctrl *ctrl)
  {
-       unsigned i;
+       struct nvme_id_ctrl *id;
+       u32 nn, i;
+       if (nvme_identify_ctrl(ctrl, &id))
+               return;
+       nn = le32_to_cpu(id->nn);
+       kfree(id);
  
        for (i = 1; i <= nn; i++)
                nvme_validate_ns(ctrl, i);
@@@ -3798,8 -3867,6 +3867,6 @@@ static void nvme_scan_work(struct work_
  {
        struct nvme_ctrl *ctrl =
                container_of(work, struct nvme_ctrl, scan_work);
-       struct nvme_id_ctrl *id;
-       unsigned nn;
  
        /* No tagset on a live ctrl means IO queues could not created */
        if (ctrl->state != NVME_CTRL_LIVE || !ctrl->tagset)
                nvme_clear_changed_ns_log(ctrl);
        }
  
-       if (nvme_identify_ctrl(ctrl, &id))
-               return;
        mutex_lock(&ctrl->scan_lock);
-       nn = le32_to_cpu(id->nn);
-       if (ctrl->vs >= NVME_VS(1, 1, 0) &&
-           !(ctrl->quirks & NVME_QUIRK_IDENTIFY_CNS)) {
-               if (!nvme_scan_ns_list(ctrl, nn))
-                       goto out_free_id;
-       }
-       nvme_scan_ns_sequential(ctrl, nn);
- out_free_id:
+       if (nvme_scan_ns_list(ctrl) != 0)
+               nvme_scan_ns_sequential(ctrl);
        mutex_unlock(&ctrl->scan_lock);
-       kfree(id);
        down_write(&ctrl->namespaces_rwsem);
        list_sort(NULL, &ctrl->namespaces, ns_cmp);
        up_write(&ctrl->namespaces_rwsem);
diff --combined drivers/nvme/host/pci.c
@@@ -68,14 -68,30 +68,30 @@@ static int io_queue_depth = 1024
  module_param_cb(io_queue_depth, &io_queue_depth_ops, &io_queue_depth, 0644);
  MODULE_PARM_DESC(io_queue_depth, "set io queue depth, should >= 2");
  
+ static int io_queue_count_set(const char *val, const struct kernel_param *kp)
+ {
+       unsigned int n;
+       int ret;
+       ret = kstrtouint(val, 10, &n);
+       if (ret != 0 || n > num_possible_cpus())
+               return -EINVAL;
+       return param_set_uint(val, kp);
+ }
+ static const struct kernel_param_ops io_queue_count_ops = {
+       .set = io_queue_count_set,
+       .get = param_get_uint,
+ };
  static unsigned int write_queues;
- module_param(write_queues, uint, 0644);
+ module_param_cb(write_queues, &io_queue_count_ops, &write_queues, 0644);
  MODULE_PARM_DESC(write_queues,
        "Number of queues to use for writes. If not set, reads and writes "
        "will share a queue set.");
  
  static unsigned int poll_queues;
- module_param(poll_queues, uint, 0644);
+ module_param_cb(poll_queues, &io_queue_count_ops, &poll_queues, 0644);
  MODULE_PARM_DESC(poll_queues, "Number of queues to use for polled IO.");
  
  struct nvme_dev;
@@@ -128,6 -144,9 +144,9 @@@ struct nvme_dev 
        dma_addr_t host_mem_descs_dma;
        struct nvme_host_mem_buf_desc *host_mem_descs;
        void **host_mem_desc_bufs;
+       unsigned int nr_allocated_queues;
+       unsigned int nr_write_queues;
+       unsigned int nr_poll_queues;
  };
  
  static int io_queue_depth_set(const char *val, const struct kernel_param *kp)
@@@ -166,14 -185,13 +185,13 @@@ struct nvme_queue 
        void *sq_cmds;
         /* only used for poll queues: */
        spinlock_t cq_poll_lock ____cacheline_aligned_in_smp;
-       volatile struct nvme_completion *cqes;
+       struct nvme_completion *cqes;
        dma_addr_t sq_dma_addr;
        dma_addr_t cq_dma_addr;
        u32 __iomem *q_db;
        u16 q_depth;
        u16 cq_vector;
        u16 sq_tail;
-       u16 last_sq_tail;
        u16 cq_head;
        u16 qid;
        u8 cq_phase;
@@@ -209,25 -227,14 +227,14 @@@ struct nvme_iod 
        struct scatterlist *sg;
  };
  
- static unsigned int max_io_queues(void)
+ static inline unsigned int nvme_dbbuf_size(struct nvme_dev *dev)
  {
-       return num_possible_cpus() + write_queues + poll_queues;
- }
- static unsigned int max_queue_count(void)
- {
-       /* IO queues + admin queue */
-       return 1 + max_io_queues();
- }
- static inline unsigned int nvme_dbbuf_size(u32 stride)
- {
-       return (max_queue_count() * 8 * stride);
+       return dev->nr_allocated_queues * 8 * dev->db_stride;
  }
  
  static int nvme_dbbuf_dma_alloc(struct nvme_dev *dev)
  {
-       unsigned int mem_size = nvme_dbbuf_size(dev->db_stride);
+       unsigned int mem_size = nvme_dbbuf_size(dev);
  
        if (dev->dbbuf_dbs)
                return 0;
  
  static void nvme_dbbuf_dma_free(struct nvme_dev *dev)
  {
-       unsigned int mem_size = nvme_dbbuf_size(dev->db_stride);
+       unsigned int mem_size = nvme_dbbuf_size(dev);
  
        if (dev->dbbuf_dbs) {
                dma_free_coherent(dev->dev, mem_size,
@@@ -446,24 -453,11 +453,11 @@@ static int nvme_pci_map_queues(struct b
        return 0;
  }
  
- /*
-  * Write sq tail if we are asked to, or if the next command would wrap.
-  */
- static inline void nvme_write_sq_db(struct nvme_queue *nvmeq, bool write_sq)
+ static inline void nvme_write_sq_db(struct nvme_queue *nvmeq)
  {
-       if (!write_sq) {
-               u16 next_tail = nvmeq->sq_tail + 1;
-               if (next_tail == nvmeq->q_depth)
-                       next_tail = 0;
-               if (next_tail != nvmeq->last_sq_tail)
-                       return;
-       }
        if (nvme_dbbuf_update_and_check_event(nvmeq->sq_tail,
                        nvmeq->dbbuf_sq_db, nvmeq->dbbuf_sq_ei))
                writel(nvmeq->sq_tail, nvmeq->q_db);
-       nvmeq->last_sq_tail = nvmeq->sq_tail;
  }
  
  /**
@@@ -480,7 -474,8 +474,8 @@@ static void nvme_submit_cmd(struct nvme
               cmd, sizeof(*cmd));
        if (++nvmeq->sq_tail == nvmeq->q_depth)
                nvmeq->sq_tail = 0;
-       nvme_write_sq_db(nvmeq, write_sq);
+       if (write_sq)
+               nvme_write_sq_db(nvmeq);
        spin_unlock(&nvmeq->sq_lock);
  }
  
@@@ -489,8 -484,7 +484,7 @@@ static void nvme_commit_rqs(struct blk_
        struct nvme_queue *nvmeq = hctx->driver_data;
  
        spin_lock(&nvmeq->sq_lock);
-       if (nvmeq->sq_tail != nvmeq->last_sq_tail)
-               nvme_write_sq_db(nvmeq, true);
+       nvme_write_sq_db(nvmeq);
        spin_unlock(&nvmeq->sq_lock);
  }
  
@@@ -922,8 -916,9 +916,9 @@@ static void nvme_pci_complete_rq(struc
  /* We read the CQE phase first to check if the rest of the entry is valid */
  static inline bool nvme_cqe_pending(struct nvme_queue *nvmeq)
  {
-       return (le16_to_cpu(nvmeq->cqes[nvmeq->cq_head].status) & 1) ==
-                       nvmeq->cq_phase;
+       struct nvme_completion *hcqe = &nvmeq->cqes[nvmeq->cq_head];
+       return (le16_to_cpu(READ_ONCE(hcqe->status)) & 1) == nvmeq->cq_phase;
  }
  
  static inline void nvme_ring_cq_doorbell(struct nvme_queue *nvmeq)
@@@ -944,7 -939,7 +939,7 @@@ static inline struct blk_mq_tags *nvme_
  
  static inline void nvme_handle_cqe(struct nvme_queue *nvmeq, u16 idx)
  {
-       volatile struct nvme_completion *cqe = &nvmeq->cqes[idx];
+       struct nvme_completion *cqe = &nvmeq->cqes[idx];
        struct request *req;
  
        if (unlikely(cqe->command_id >= nvmeq->q_depth)) {
@@@ -989,11 -984,6 +984,11 @@@ static inline int nvme_process_cq(struc
  
        while (nvme_cqe_pending(nvmeq)) {
                found++;
 +              /*
 +               * load-load control dependency between phase and the rest of
 +               * the cqe requires a full read memory barrier
 +               */
 +              dma_rmb();
                nvme_handle_cqe(nvmeq, nvmeq->cq_head);
                nvme_update_cq_head(nvmeq);
        }
@@@ -1382,19 -1372,16 +1377,19 @@@ static void nvme_disable_admin_queue(st
  
  /*
   * Called only on a device that has been disabled and after all other threads
 - * that can check this device's completion queues have synced. This is the
 - * last chance for the driver to see a natural completion before
 - * nvme_cancel_request() terminates all incomplete requests.
 + * that can check this device's completion queues have synced, except
 + * nvme_poll(). This is the last chance for the driver to see a natural
 + * completion before nvme_cancel_request() terminates all incomplete requests.
   */
  static void nvme_reap_pending_cqes(struct nvme_dev *dev)
  {
        int i;
  
 -      for (i = dev->ctrl.queue_count - 1; i > 0; i--)
 +      for (i = dev->ctrl.queue_count - 1; i > 0; i--) {
 +              spin_lock(&dev->queues[i].cq_poll_lock);
                nvme_process_cq(&dev->queues[i]);
 +              spin_unlock(&dev->queues[i].cq_poll_lock);
 +      }
  }
  
  static int nvme_cmb_qdepth(struct nvme_dev *dev, int nr_io_queues,
@@@ -1501,7 -1488,6 +1496,6 @@@ static void nvme_init_queue(struct nvme
        struct nvme_dev *dev = nvmeq->dev;
  
        nvmeq->sq_tail = 0;
-       nvmeq->last_sq_tail = 0;
        nvmeq->cq_head = 0;
        nvmeq->cq_phase = 1;
        nvmeq->q_db = &dev->dbs[qid * 2 * dev->db_stride];
@@@ -2003,7 -1989,7 +1997,7 @@@ static int nvme_setup_host_mem(struct n
  static void nvme_calc_irq_sets(struct irq_affinity *affd, unsigned int nrirqs)
  {
        struct nvme_dev *dev = affd->priv;
-       unsigned int nr_read_queues;
+       unsigned int nr_read_queues, nr_write_queues = dev->nr_write_queues;
  
        /*
         * If there is no interupt available for queues, ensure that
        if (!nrirqs) {
                nrirqs = 1;
                nr_read_queues = 0;
-       } else if (nrirqs == 1 || !write_queues) {
+       } else if (nrirqs == 1 || !nr_write_queues) {
                nr_read_queues = 0;
-       } else if (write_queues >= nrirqs) {
+       } else if (nr_write_queues >= nrirqs) {
                nr_read_queues = 1;
        } else {
-               nr_read_queues = nrirqs - write_queues;
+               nr_read_queues = nrirqs - nr_write_queues;
        }
  
        dev->io_queues[HCTX_TYPE_DEFAULT] = nrirqs - nr_read_queues;
@@@ -2048,7 -2034,7 +2042,7 @@@ static int nvme_setup_irqs(struct nvme_
         * Poll queues don't need interrupts, but we need at least one IO
         * queue left over for non-polled IO.
         */
-       this_p_queues = poll_queues;
+       this_p_queues = dev->nr_poll_queues;
        if (this_p_queues >= nr_io_queues) {
                this_p_queues = nr_io_queues - 1;
                irq_queues = 1;
@@@ -2078,14 -2064,25 +2072,25 @@@ static void nvme_disable_io_queues(stru
                __nvme_disable_io_queues(dev, nvme_admin_delete_cq);
  }
  
+ static unsigned int nvme_max_io_queues(struct nvme_dev *dev)
+ {
+       return num_possible_cpus() + dev->nr_write_queues + dev->nr_poll_queues;
+ }
  static int nvme_setup_io_queues(struct nvme_dev *dev)
  {
        struct nvme_queue *adminq = &dev->queues[0];
        struct pci_dev *pdev = to_pci_dev(dev->dev);
-       int result, nr_io_queues;
+       unsigned int nr_io_queues;
        unsigned long size;
+       int result;
  
-       nr_io_queues = max_io_queues();
+       /*
+        * Sample the module parameters once at reset time so that we have
+        * stable values to work with.
+        */
+       dev->nr_write_queues = write_queues;
+       dev->nr_poll_queues = poll_queues;
  
        /*
         * If tags are shared with admin queue (Apple bug), then
         */
        if (dev->ctrl.quirks & NVME_QUIRK_SHARED_TAGS)
                nr_io_queues = 1;
+       else
+               nr_io_queues = min(nvme_max_io_queues(dev),
+                                  dev->nr_allocated_queues - 1);
  
        result = nvme_set_queue_count(&dev->ctrl, &nr_io_queues);
        if (result < 0)
@@@ -2565,6 -2565,12 +2573,12 @@@ static void nvme_reset_work(struct work
                goto out;
        }
  
+       /*
+        * We do not support an SGL for metadata (yet), so we are limited to a
+        * single integrity segment for the separate metadata pointer.
+        */
+       dev->ctrl.max_integrity_segments = 1;
        result = nvme_init_identify(&dev->ctrl);
        if (result)
                goto out;
@@@ -2767,8 -2773,11 +2781,11 @@@ static int nvme_probe(struct pci_dev *p
        if (!dev)
                return -ENOMEM;
  
-       dev->queues = kcalloc_node(max_queue_count(), sizeof(struct nvme_queue),
-                                       GFP_KERNEL, node);
+       dev->nr_write_queues = write_queues;
+       dev->nr_poll_queues = poll_queues;
+       dev->nr_allocated_queues = nvme_max_io_queues(dev) + 1;
+       dev->queues = kcalloc_node(dev->nr_allocated_queues,
+                       sizeof(struct nvme_queue), GFP_KERNEL, node);
        if (!dev->queues)
                goto free;
  
@@@ -3131,8 -3140,6 +3148,6 @@@ static int __init nvme_init(void
        BUILD_BUG_ON(sizeof(struct nvme_delete_queue) != 64);
        BUILD_BUG_ON(IRQ_AFFINITY_MAX_SETS < 2);
  
-       write_queues = min(write_queues, num_possible_cpus());
-       poll_queues = min(poll_queues, num_possible_cpus());
        return pci_register_driver(&nvme_driver);
  }
  
@@@ -47,6 -47,22 +47,22 @@@ void nvmet_bdev_set_limits(struct block
        id->nows = to0based(ql->io_opt / ql->logical_block_size);
  }
  
+ static void nvmet_bdev_ns_enable_integrity(struct nvmet_ns *ns)
+ {
+       struct blk_integrity *bi = bdev_get_integrity(ns->bdev);
+       if (bi) {
+               ns->metadata_size = bi->tuple_size;
+               if (bi->profile == &t10_pi_type1_crc)
+                       ns->pi_type = NVME_NS_DPS_PI_TYPE1;
+               else if (bi->profile == &t10_pi_type3_crc)
+                       ns->pi_type = NVME_NS_DPS_PI_TYPE3;
+               else
+                       /* Unsupported metadata type */
+                       ns->metadata_size = 0;
+       }
+ }
  int nvmet_bdev_ns_enable(struct nvmet_ns *ns)
  {
        int ret;
        }
        ns->size = i_size_read(ns->bdev->bd_inode);
        ns->blksize_shift = blksize_bits(bdev_logical_block_size(ns->bdev));
+       ns->pi_type = 0;
+       ns->metadata_size = 0;
+       if (IS_ENABLED(CONFIG_BLK_DEV_INTEGRITY_T10))
+               nvmet_bdev_ns_enable_integrity(ns);
        return 0;
  }
  
@@@ -75,6 -97,11 +97,11 @@@ void nvmet_bdev_ns_disable(struct nvmet
        }
  }
  
+ void nvmet_bdev_ns_revalidate(struct nvmet_ns *ns)
+ {
+       ns->size = i_size_read(ns->bdev->bd_inode);
+ }
  static u16 blk_to_nvme_status(struct nvmet_req *req, blk_status_t blk_sts)
  {
        u16 status = NVME_SC_SUCCESS;
@@@ -142,6 -169,61 +169,61 @@@ static void nvmet_bio_done(struct bio *
                bio_put(bio);
  }
  
+ #ifdef CONFIG_BLK_DEV_INTEGRITY
+ static int nvmet_bdev_alloc_bip(struct nvmet_req *req, struct bio *bio,
+                               struct sg_mapping_iter *miter)
+ {
+       struct blk_integrity *bi;
+       struct bio_integrity_payload *bip;
+       struct block_device *bdev = req->ns->bdev;
+       int rc;
+       size_t resid, len;
+       bi = bdev_get_integrity(bdev);
+       if (unlikely(!bi)) {
+               pr_err("Unable to locate bio_integrity\n");
+               return -ENODEV;
+       }
+       bip = bio_integrity_alloc(bio, GFP_NOIO,
+               min_t(unsigned int, req->metadata_sg_cnt, BIO_MAX_PAGES));
+       if (IS_ERR(bip)) {
+               pr_err("Unable to allocate bio_integrity_payload\n");
+               return PTR_ERR(bip);
+       }
+       bip->bip_iter.bi_size = bio_integrity_bytes(bi, bio_sectors(bio));
+       /* virtual start sector must be in integrity interval units */
+       bip_set_seed(bip, bio->bi_iter.bi_sector >>
+                    (bi->interval_exp - SECTOR_SHIFT));
+       resid = bip->bip_iter.bi_size;
+       while (resid > 0 && sg_miter_next(miter)) {
+               len = min_t(size_t, miter->length, resid);
+               rc = bio_integrity_add_page(bio, miter->page, len,
+                                           offset_in_page(miter->addr));
+               if (unlikely(rc != len)) {
+                       pr_err("bio_integrity_add_page() failed; %d\n", rc);
+                       sg_miter_stop(miter);
+                       return -ENOMEM;
+               }
+               resid -= len;
+               if (len < miter->length)
+                       miter->consumed -= miter->length - len;
+       }
+       sg_miter_stop(miter);
+       return 0;
+ }
+ #else
+ static int nvmet_bdev_alloc_bip(struct nvmet_req *req, struct bio *bio,
+                               struct sg_mapping_iter *miter)
+ {
+       return -EINVAL;
+ }
+ #endif /* CONFIG_BLK_DEV_INTEGRITY */
  static void nvmet_bdev_execute_rw(struct nvmet_req *req)
  {
        int sg_cnt = req->sg_cnt;
        struct scatterlist *sg;
        struct blk_plug plug;
        sector_t sector;
-       int op, i;
+       int op, i, rc;
+       struct sg_mapping_iter prot_miter;
+       unsigned int iter_flags;
+       unsigned int total_len = nvmet_rw_data_len(req) + req->metadata_len;
  
-       if (!nvmet_check_data_len(req, nvmet_rw_len(req)))
+       if (!nvmet_check_transfer_len(req, total_len))
                return;
  
        if (!req->sg_cnt) {
                op = REQ_OP_WRITE | REQ_SYNC | REQ_IDLE;
                if (req->cmd->rw.control & cpu_to_le16(NVME_RW_FUA))
                        op |= REQ_FUA;
+               iter_flags = SG_MITER_TO_SG;
        } else {
                op = REQ_OP_READ;
+               iter_flags = SG_MITER_FROM_SG;
        }
  
        if (is_pci_p2pdma_page(sg_page(req->sg)))
        bio->bi_opf = op;
  
        blk_start_plug(&plug);
+       if (req->metadata_len)
+               sg_miter_start(&prot_miter, req->metadata_sg,
+                              req->metadata_sg_cnt, iter_flags);
        for_each_sg(req->sg, sg, req->sg_cnt, i) {
                while (bio_add_page(bio, sg_page(sg), sg->length, sg->offset)
                                != sg->length) {
                        struct bio *prev = bio;
  
+                       if (req->metadata_len) {
+                               rc = nvmet_bdev_alloc_bip(req, bio,
+                                                         &prot_miter);
+                               if (unlikely(rc)) {
+                                       bio_io_error(bio);
+                                       return;
+                               }
+                       }
                        bio = bio_alloc(GFP_KERNEL, min(sg_cnt, BIO_MAX_PAGES));
                        bio_set_dev(bio, req->ns->bdev);
                        bio->bi_iter.bi_sector = sector;
                sg_cnt--;
        }
  
+       if (req->metadata_len) {
+               rc = nvmet_bdev_alloc_bip(req, bio, &prot_miter);
+               if (unlikely(rc)) {
+                       bio_io_error(bio);
+                       return;
+               }
+       }
        submit_bio(bio);
        blk_finish_plug(&plug);
  }
@@@ -212,7 -320,7 +320,7 @@@ static void nvmet_bdev_execute_flush(st
  {
        struct bio *bio = &req->b.inline_bio;
  
-       if (!nvmet_check_data_len(req, 0))
+       if (!nvmet_check_transfer_len(req, 0))
                return;
  
        bio_init(bio, req->inline_bvec, ARRAY_SIZE(req->inline_bvec));
  
  u16 nvmet_bdev_flush(struct nvmet_req *req)
  {
 -      if (blkdev_issue_flush(req->ns->bdev, GFP_KERNEL, NULL))
 +      if (blkdev_issue_flush(req->ns->bdev, GFP_KERNEL))
                return NVME_SC_INTERNAL | NVME_SC_DNR;
        return 0;
  }
@@@ -304,7 -412,7 +412,7 @@@ static void nvmet_bdev_execute_write_ze
        sector_t nr_sector;
        int ret;
  
-       if (!nvmet_check_data_len(req, 0))
+       if (!nvmet_check_transfer_len(req, 0))
                return;
  
        sector = le64_to_cpu(write_zeroes->slba) <<
@@@ -331,6 -439,8 +439,8 @@@ u16 nvmet_bdev_parse_io_cmd(struct nvme
        case nvme_cmd_read:
        case nvme_cmd_write:
                req->execute = nvmet_bdev_execute_rw;
+               if (req->sq->ctrl->pi_support && nvmet_ns_has_pi(req->ns))
+                       req->metadata_len = nvmet_rw_metadata_len(req);
                return 0;
        case nvme_cmd_flush:
                req->execute = nvmet_bdev_execute_flush;
@@@ -39,8 -39,6 +39,6 @@@
  #include <scsi/scsi_transport_fc.h>
  #include <scsi/fc/fc_fs.h>
  
- #include <linux/nvme-fc-driver.h>
  #include "lpfc_hw4.h"
  #include "lpfc_hw.h"
  #include "lpfc_sli.h"
@@@ -50,7 -48,6 +48,6 @@@
  #include "lpfc.h"
  #include "lpfc_scsi.h"
  #include "lpfc_nvme.h"
- #include "lpfc_nvmet.h"
  #include "lpfc_logmsg.h"
  #include "lpfc_crtn.h"
  #include "lpfc_vport.h"
@@@ -1035,7 -1032,7 +1032,7 @@@ lpfc_debugfs_nvmestat_data(struct lpfc_
  {
        struct lpfc_hba   *phba = vport->phba;
        struct lpfc_nvmet_tgtport *tgtp;
-       struct lpfc_nvmet_rcv_ctx *ctxp, *next_ctxp;
+       struct lpfc_async_xchg_ctx *ctxp, *next_ctxp;
        struct nvme_fc_local_port *localport;
        struct lpfc_fc4_ctrl_stat *cstat;
        struct lpfc_nvme_lport *lport;
@@@ -2166,6 -2163,10 +2163,6 @@@ lpfc_debugfs_lockstat_write(struct fil
        char *pbuf;
        int i;
  
 -      /* Protect copy from user */
 -      if (!access_ok(buf, nbytes))
 -              return -EFAULT;
 -
        memset(mybuf, 0, sizeof(mybuf));
  
        if (copy_from_user(mybuf, buf, nbytes))
@@@ -2617,6 -2618,10 +2614,6 @@@ lpfc_debugfs_multixripools_write(struc
        if (nbytes > 64)
                nbytes = 64;
  
 -      /* Protect copy from user */
 -      if (!access_ok(buf, nbytes))
 -              return -EFAULT;
 -
        memset(mybuf, 0, sizeof(mybuf));
  
        if (copy_from_user(mybuf, buf, nbytes))
@@@ -2779,6 -2784,10 +2776,6 @@@ lpfc_debugfs_scsistat_write(struct fil
        char mybuf[6] = {0};
        int i;
  
 -      /* Protect copy from user */
 -      if (!access_ok(buf, nbytes))
 -              return -EFAULT;
 -
        if (copy_from_user(mybuf, buf, (nbytes >= sizeof(mybuf)) ?
                                       (sizeof(mybuf) - 1) : nbytes))
                return -EFAULT;
diff --combined fs/block_dev.c
@@@ -255,7 -255,7 +255,7 @@@ __blkdev_direct_IO_simple(struct kiocb 
                        break;
                if (!(iocb->ki_flags & IOCB_HIPRI) ||
                    !blk_poll(bdev_get_queue(bdev), qc, true))
 -                      io_schedule();
 +                      blk_io_schedule();
        }
        __set_current_state(TASK_RUNNING);
  
@@@ -449,7 -449,7 +449,7 @@@ __blkdev_direct_IO(struct kiocb *iocb, 
  
                if (!(iocb->ki_flags & IOCB_HIPRI) ||
                    !blk_poll(bdev_get_queue(bdev), qc, true))
 -                      io_schedule();
 +                      blk_io_schedule();
        }
        __set_current_state(TASK_RUNNING);
  
@@@ -614,9 -614,10 +614,9 @@@ static int blkdev_readpage(struct file 
        return block_read_full_page(page, blkdev_get_block);
  }
  
 -static int blkdev_readpages(struct file *file, struct address_space *mapping,
 -                      struct list_head *pages, unsigned nr_pages)
 +static void blkdev_readahead(struct readahead_control *rac)
  {
 -      return mpage_readpages(mapping, pages, nr_pages, blkdev_get_block);
 +      mpage_readahead(rac, blkdev_get_block);
  }
  
  static int blkdev_write_begin(struct file *file, struct address_space *mapping,
@@@ -671,7 -672,7 +671,7 @@@ int blkdev_fsync(struct file *filp, lof
         * i_mutex and doing so causes performance issues with concurrent
         * O_SYNC writers to a block device.
         */
 -      error = blkdev_issue_flush(bdev, GFP_KERNEL, NULL);
 +      error = blkdev_issue_flush(bdev, GFP_KERNEL);
        if (error == -EOPNOTSUPP)
                error = 0;
  
@@@ -2005,7 -2006,8 +2005,7 @@@ ssize_t blkdev_write_iter(struct kiocb 
        if (bdev_read_only(I_BDEV(bd_inode)))
                return -EPERM;
  
 -      /* uswsusp needs write permission to the swap */
 -      if (IS_SWAPFILE(bd_inode) && !hibernation_available())
 +      if (IS_SWAPFILE(bd_inode) && !is_hibernate_resume_dev(bd_inode))
                return -ETXTBSY;
  
        if (!iov_iter_count(from))
@@@ -2066,7 -2068,7 +2066,7 @@@ static int blkdev_writepages(struct add
  
  static const struct address_space_operations def_blk_aops = {
        .readpage       = blkdev_readpage,
 -      .readpages      = blkdev_readpages,
 +      .readahead      = blkdev_readahead,
        .writepage      = blkdev_writepage,
        .write_begin    = blkdev_write_begin,
        .write_end      = blkdev_write_end,
@@@ -2164,18 -2166,6 +2164,6 @@@ const struct file_operations def_blk_fo
        .fallocate      = blkdev_fallocate,
  };
  
- int ioctl_by_bdev(struct block_device *bdev, unsigned cmd, unsigned long arg)
- {
-       int res;
-       mm_segment_t old_fs = get_fs();
-       set_fs(KERNEL_DS);
-       res = blkdev_ioctl(bdev, 0, cmd, arg);
-       set_fs(old_fs);
-       return res;
- }
- EXPORT_SYMBOL(ioctl_by_bdev);
  /**
   * lookup_bdev  - lookup a struct block_device by name
   * @pathname: special file representing the block device
diff --combined include/linux/fs.h
@@@ -292,7 -292,6 +292,7 @@@ enum positive_aop_returns 
  struct page;
  struct address_space;
  struct writeback_control;
 +struct readahead_control;
  
  /*
   * Write life time hint values.
@@@ -376,7 -375,6 +376,7 @@@ struct address_space_operations 
         */
        int (*readpages)(struct file *filp, struct address_space *mapping,
                        struct list_head *pages, unsigned nr_pages);
 +      void (*readahead)(struct readahead_control *);
  
        int (*write_begin)(struct file *, struct address_space *mapping,
                                loff_t pos, unsigned len, unsigned flags,
@@@ -978,7 -976,6 +978,7 @@@ struct file 
  #endif /* #ifdef CONFIG_EPOLL */
        struct address_space    *f_mapping;
        errseq_t                f_wb_err;
 +      errseq_t                f_sb_err; /* for syncfs */
  } __randomize_layout
    __attribute__((aligned(4)));        /* lest something weird decides that 2 is OK */
  
@@@ -986,7 -983,7 +986,7 @@@ struct file_handle 
        __u32 handle_bytes;
        int handle_type;
        /* file identifier */
 -      unsigned char f_handle[0];
 +      unsigned char f_handle[];
  };
  
  static inline struct file *get_file(struct file *f)
@@@ -1523,9 -1520,6 +1523,9 @@@ struct super_block 
        /* Being remounted read-only */
        int s_readonly_remount;
  
 +      /* per-sb errseq_t for reporting writeback errors via syncfs */
 +      errseq_t s_wb_err;
 +
        /* AIO completions deferred from interrupt context */
        struct workqueue_struct *s_dio_done_wq;
        struct hlist_head s_pins;
@@@ -1727,11 -1721,7 +1727,11 @@@ extern int vfs_link(struct dentry *, st
  extern int vfs_rmdir(struct inode *, struct dentry *);
  extern int vfs_unlink(struct inode *, struct dentry *, struct inode **);
  extern int vfs_rename(struct inode *, struct dentry *, struct inode *, struct dentry *, struct inode **, unsigned int);
 -extern int vfs_whiteout(struct inode *, struct dentry *);
 +
 +static inline int vfs_whiteout(struct inode *dir, struct dentry *dentry)
 +{
 +      return vfs_mknod(dir, dentry, S_IFCHR | WHITEOUT_MODE, WHITEOUT_DEV);
 +}
  
  extern struct dentry *vfs_tmpfile(struct dentry *dentry, umode_t mode,
                                  int open_flag);
@@@ -2646,7 -2636,6 +2646,6 @@@ extern int sync_filesystem(struct super
  extern const struct file_operations def_blk_fops;
  extern const struct file_operations def_chr_fops;
  #ifdef CONFIG_BLOCK
- extern int ioctl_by_bdev(struct block_device *, unsigned, unsigned long);
  extern int blkdev_ioctl(struct block_device *, fmode_t, unsigned, unsigned long);
  extern long compat_blkdev_ioctl(struct file *, unsigned, unsigned long);
  extern int blkdev_get(struct block_device *bdev, fmode_t mode, void *holder);
@@@ -2835,18 -2824,6 +2834,18 @@@ static inline errseq_t filemap_sample_w
        return errseq_sample(&mapping->wb_err);
  }
  
 +/**
 + * file_sample_sb_err - sample the current errseq_t to test for later errors
 + * @mapping: mapping to be sampled
 + *
 + * Grab the most current superblock-level errseq_t value for the given
 + * struct file.
 + */
 +static inline errseq_t file_sample_sb_err(struct file *file)
 +{
 +      return errseq_sample(&file->f_path.dentry->d_sb->s_wb_err);
 +}
 +
  static inline int filemap_nr_thps(struct address_space *mapping)
  {
  #ifdef CONFIG_READ_ONLY_THP_FOR_FS
diff --combined include/linux/genhd.h
@@@ -39,6 -39,15 +39,6 @@@ extern struct class block_class
  #include <linux/fs.h>
  #include <linux/workqueue.h>
  
 -struct disk_stats {
 -      u64 nsecs[NR_STAT_GROUPS];
 -      unsigned long sectors[NR_STAT_GROUPS];
 -      unsigned long ios[NR_STAT_GROUPS];
 -      unsigned long merges[NR_STAT_GROUPS];
 -      unsigned long io_ticks;
 -      local_t in_flight[2];
 -};
 -
  #define PARTITION_META_INFO_VOLNAMELTH        64
  /*
   * Enough for the string representation of any kind of UUID plus NULL.
@@@ -59,13 -68,7 +59,13 @@@ struct hd_struct 
         * can be non-atomic on 32bit machines with 64bit sector_t.
         */
        sector_t nr_sects;
 +#if BITS_PER_LONG==32 && defined(CONFIG_SMP)
        seqcount_t nr_sects_seq;
 +#endif
 +      unsigned long stamp;
 +      struct disk_stats __percpu *dkstats;
 +      struct percpu_ref ref;
 +
        sector_t alignment_offset;
        unsigned int discard_alignment;
        struct device __dev;
  #ifdef CONFIG_FAIL_MAKE_REQUEST
        int make_it_fail;
  #endif
 -      unsigned long stamp;
 -#ifdef        CONFIG_SMP
 -      struct disk_stats __percpu *dkstats;
 -#else
 -      struct disk_stats dkstats;
 -#endif
 -      struct percpu_ref ref;
        struct rcu_work rcu_work;
  };
  
@@@ -159,8 -169,6 +159,6 @@@ struct disk_part_tbl 
  struct disk_events;
  struct badblocks;
  
- #if defined(CONFIG_BLK_DEV_INTEGRITY)
  struct blk_integrity {
        const struct blk_integrity_profile      *profile;
        unsigned char                           flags;
        unsigned char                           tag_size;
  };
  
- #endif        /* CONFIG_BLK_DEV_INTEGRITY */
  struct gendisk {
        /* major, first_minor and minors are input parameters only,
         * don't use directly.  Use disk_devt() and disk_max_parts().
@@@ -264,13 -270,6 +260,13 @@@ static inline void disk_put_part(struc
                put_device(part_to_dev(part));
  }
  
 +static inline void hd_sects_seq_init(struct hd_struct *p)
 +{
 +#if BITS_PER_LONG==32 && defined(CONFIG_SMP)
 +      seqcount_init(&p->nr_sects_seq);
 +#endif
 +}
 +
  /*
   * Smarter partition iterator without context limits.
   */