Commit d5afaf91 authored by Linus Torvalds's avatar Linus Torvalds

Merge tag 'block-6.11-20240823' of git://git.kernel.dk/linux

Pull block fixes from Jens Axboe:

 - NVMe pull request via Keith
     - Remove unused struct field (Nilay)
     - Fix fabrics keep-alive teardown order (Ming)

 - Write zeroes fixes (John)

* tag 'block-6.11-20240823' of git://git.kernel.dk/linux:
  nvme: Remove unused field
  nvme: move stopping keep-alive into nvme_uninit_ctrl()
  block: Drop NULL check in bdev_write_zeroes_sectors()
  block: Read max write zeroes once for __blkdev_issue_write_zeroes()
parents 489270f4 e6b09a17
...@@ -111,13 +111,20 @@ static sector_t bio_write_zeroes_limit(struct block_device *bdev) ...@@ -111,13 +111,20 @@ static sector_t bio_write_zeroes_limit(struct block_device *bdev)
(UINT_MAX >> SECTOR_SHIFT) & ~bs_mask); (UINT_MAX >> SECTOR_SHIFT) & ~bs_mask);
} }
/*
* There is no reliable way for the SCSI subsystem to determine whether a
* device supports a WRITE SAME operation without actually performing a write
* to media. As a result, write_zeroes is enabled by default and will be
* disabled if a zeroing operation subsequently fails. This means that this
* queue limit is likely to change at runtime.
*/
static void __blkdev_issue_write_zeroes(struct block_device *bdev, static void __blkdev_issue_write_zeroes(struct block_device *bdev,
sector_t sector, sector_t nr_sects, gfp_t gfp_mask, sector_t sector, sector_t nr_sects, gfp_t gfp_mask,
struct bio **biop, unsigned flags) struct bio **biop, unsigned flags, sector_t limit)
{ {
while (nr_sects) { while (nr_sects) {
unsigned int len = min_t(sector_t, nr_sects, unsigned int len = min(nr_sects, limit);
bio_write_zeroes_limit(bdev));
struct bio *bio; struct bio *bio;
if ((flags & BLKDEV_ZERO_KILLABLE) && if ((flags & BLKDEV_ZERO_KILLABLE) &&
...@@ -141,12 +148,14 @@ static void __blkdev_issue_write_zeroes(struct block_device *bdev, ...@@ -141,12 +148,14 @@ static void __blkdev_issue_write_zeroes(struct block_device *bdev,
static int blkdev_issue_write_zeroes(struct block_device *bdev, sector_t sector, static int blkdev_issue_write_zeroes(struct block_device *bdev, sector_t sector,
sector_t nr_sects, gfp_t gfp, unsigned flags) sector_t nr_sects, gfp_t gfp, unsigned flags)
{ {
sector_t limit = bio_write_zeroes_limit(bdev);
struct bio *bio = NULL; struct bio *bio = NULL;
struct blk_plug plug; struct blk_plug plug;
int ret = 0; int ret = 0;
blk_start_plug(&plug); blk_start_plug(&plug);
__blkdev_issue_write_zeroes(bdev, sector, nr_sects, gfp, &bio, flags); __blkdev_issue_write_zeroes(bdev, sector, nr_sects, gfp, &bio,
flags, limit);
if (bio) { if (bio) {
if ((flags & BLKDEV_ZERO_KILLABLE) && if ((flags & BLKDEV_ZERO_KILLABLE) &&
fatal_signal_pending(current)) { fatal_signal_pending(current)) {
...@@ -165,7 +174,7 @@ static int blkdev_issue_write_zeroes(struct block_device *bdev, sector_t sector, ...@@ -165,7 +174,7 @@ static int blkdev_issue_write_zeroes(struct block_device *bdev, sector_t sector,
* on an I/O error, in which case we'll turn any error into * on an I/O error, in which case we'll turn any error into
* "not supported" here. * "not supported" here.
*/ */
if (ret && !bdev_write_zeroes_sectors(bdev)) if (ret && !limit)
return -EOPNOTSUPP; return -EOPNOTSUPP;
return ret; return ret;
} }
...@@ -265,12 +274,14 @@ int __blkdev_issue_zeroout(struct block_device *bdev, sector_t sector, ...@@ -265,12 +274,14 @@ int __blkdev_issue_zeroout(struct block_device *bdev, sector_t sector,
sector_t nr_sects, gfp_t gfp_mask, struct bio **biop, sector_t nr_sects, gfp_t gfp_mask, struct bio **biop,
unsigned flags) unsigned flags)
{ {
sector_t limit = bio_write_zeroes_limit(bdev);
if (bdev_read_only(bdev)) if (bdev_read_only(bdev))
return -EPERM; return -EPERM;
if (bdev_write_zeroes_sectors(bdev)) { if (limit) {
__blkdev_issue_write_zeroes(bdev, sector, nr_sects, __blkdev_issue_write_zeroes(bdev, sector, nr_sects,
gfp_mask, biop, flags); gfp_mask, biop, flags, limit);
} else { } else {
if (flags & BLKDEV_ZERO_NOFALLBACK) if (flags & BLKDEV_ZERO_NOFALLBACK)
return -EOPNOTSUPP; return -EOPNOTSUPP;
......
...@@ -4612,7 +4612,6 @@ void nvme_stop_ctrl(struct nvme_ctrl *ctrl) ...@@ -4612,7 +4612,6 @@ void nvme_stop_ctrl(struct nvme_ctrl *ctrl)
{ {
nvme_mpath_stop(ctrl); nvme_mpath_stop(ctrl);
nvme_auth_stop(ctrl); nvme_auth_stop(ctrl);
nvme_stop_keep_alive(ctrl);
nvme_stop_failfast_work(ctrl); nvme_stop_failfast_work(ctrl);
flush_work(&ctrl->async_event_work); flush_work(&ctrl->async_event_work);
cancel_work_sync(&ctrl->fw_act_work); cancel_work_sync(&ctrl->fw_act_work);
...@@ -4648,6 +4647,7 @@ EXPORT_SYMBOL_GPL(nvme_start_ctrl); ...@@ -4648,6 +4647,7 @@ EXPORT_SYMBOL_GPL(nvme_start_ctrl);
void nvme_uninit_ctrl(struct nvme_ctrl *ctrl) void nvme_uninit_ctrl(struct nvme_ctrl *ctrl)
{ {
nvme_stop_keep_alive(ctrl);
nvme_hwmon_exit(ctrl); nvme_hwmon_exit(ctrl);
nvme_fault_inject_fini(&ctrl->fault_inject); nvme_fault_inject_fini(&ctrl->fault_inject);
dev_pm_qos_hide_latency_tolerance(ctrl->device); dev_pm_qos_hide_latency_tolerance(ctrl->device);
......
...@@ -301,7 +301,6 @@ struct nvme_ctrl { ...@@ -301,7 +301,6 @@ struct nvme_ctrl {
struct opal_dev *opal_dev; struct opal_dev *opal_dev;
char name[12];
u16 cntlid; u16 cntlid;
u16 mtfa; u16 mtfa;
......
...@@ -1296,12 +1296,7 @@ bdev_max_secure_erase_sectors(struct block_device *bdev) ...@@ -1296,12 +1296,7 @@ bdev_max_secure_erase_sectors(struct block_device *bdev)
static inline unsigned int bdev_write_zeroes_sectors(struct block_device *bdev) static inline unsigned int bdev_write_zeroes_sectors(struct block_device *bdev)
{ {
struct request_queue *q = bdev_get_queue(bdev); return bdev_get_queue(bdev)->limits.max_write_zeroes_sectors;
if (q)
return q->limits.max_write_zeroes_sectors;
return 0;
} }
static inline bool bdev_nonrot(struct block_device *bdev) static inline bool bdev_nonrot(struct block_device *bdev)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment