History

Merge tag 'for-linus-20190209' of git://git.kernel.dk/linux-block

Pull block fixes from Jens Axboe: - NVMe pull request from Christoph, fixing namespace locking when dealing with the effects log, and a rapid add/remove issue (Keith) - blktrace tweak, ensuring requests with -1 sectors are shown (Jan) - link power management quirk for a Smasung SSD (Hans) - m68k nfblock dynamic major number fix (Chengguang) - series fixing blk-iolatency inflight counter issue (Liu) - ensure that we clear ->private when setting up the aio kiocb (Mike) - __find_get_block_slow() rate limit print (Tetsuo) * tag 'for-linus-20190209' of git://git.kernel.dk/linux-block: blk-mq: remove duplicated definition of blk_mq_freeze_queue Blk-iolatency: warn on negative inflight IO counter blk-iolatency: fix IO hang due to negative inflight counter blktrace: Show requests without sector fs: ratelimit __find_get_block_slow() failure message. m68k: set proper major_num when specifying module param major_num libata: Add NOLPM quirk for SAMSUNG MZ7TE512HMHP-000L1 SSD nvme-pci: fix rapid add remove sequence nvme: lock NS list changes while handling command effects aio: initialize kiocb private in case any filesystems expect it.

Linus Torvalds committed 7 years ago

Commit e5a8a112 parents 5610789 269848410 files · +94 −33Browse files

Unified · Split

10 files
  1. arch/m68k/emu/nfblock.c +7 −3
  2. block/blk-iolatency.c +48 −8
  3. block/blk-mq.h +0 −1
  4. drivers/ata/libata-core.c +1 −0
  5. drivers/nvme/host/core.c +7 −1
  6. drivers/nvme/host/nvme.h +1 −0
  7. drivers/nvme/host/pci.c +12 −10
  8. fs/aio.c +1 −0
  9. fs/buffer.c +10 −9
  10. include/linux/blktrace_api.h +7 −1
arch/m68k/emu/nfblock.c+7−3
@@ -155,18 +155,22 @@ out: · 154 unmodified lines
155static int __init nfhd_init(void)155static int __init nfhd_init(void)
156{156{
157 u32 blocks, bsize;157 u32 blocks, bsize;
158 int ret;
158 int i;159 int i;
159 160
160 nfhd_id = nf_get_id("XHDI");161 nfhd_id = nf_get_id("XHDI");
161 if (!nfhd_id)162 if (!nfhd_id)
162 return -ENODEV;163 return -ENODEV;
163 164
164 major_num = register_blkdev(major_num, "nfhd");165 ret = register_blkdev(major_num, "nfhd");
165 if (major_num <= 0) {166 if (ret < 0) {
166 pr_warn("nfhd: unable to get major number\n");167 pr_warn("nfhd: unable to get major number\n");
167 return major_num;168 return ret;
168 }169 }
169 170
171 if (!major_num)
172 major_num = ret;
173
170 for (i = NFHD_DEV_OFFSET; i < 24; i++) {174 for (i = NFHD_DEV_OFFSET; i < 24; i++) {
171 if (nfhd_get_capacity(i, 0, &blocks, &bsize))175 if (nfhd_get_capacity(i, 0, &blocks, &bsize))
172 continue;176 continue;
block/blk-iolatency.c+48−8
@@ -72,6 +72,7 @@ · 71 unmodified lines
72#include <linux/sched/loadavg.h>72#include <linux/sched/loadavg.h>
73#include <linux/sched/signal.h>73#include <linux/sched/signal.h>
74#include <trace/events/block.h>74#include <trace/events/block.h>
75#include <linux/blk-mq.h>
75#include "blk-rq-qos.h"76#include "blk-rq-qos.h"
76#include "blk-stat.h"77#include "blk-stat.h"
77 78
@@ -591,6 +592,7 @@ static void blkcg_iolatency_done_bio(struct rq_qos *rqos, struct bio *bio) · 513 unmodified lines
591 u64 now = ktime_to_ns(ktime_get());592 u64 now = ktime_to_ns(ktime_get());
592 bool issue_as_root = bio_issue_as_root_blkg(bio);593 bool issue_as_root = bio_issue_as_root_blkg(bio);
593 bool enabled = false;594 bool enabled = false;
595 int inflight = 0;
594 596
595 blkg = bio->bi_blkg;597 blkg = bio->bi_blkg;
596 if (!blkg || !bio_flagged(bio, BIO_TRACKED))598 if (!blkg || !bio_flagged(bio, BIO_TRACKED))
@@ -601,6 +603,9 @@ static void blkcg_iolatency_done_bio(struct rq_qos *rqos, struct bio *bio) · 4 unmodified lines
601 return;603 return;
602 604
603 enabled = blk_iolatency_enabled(iolat->blkiolat);605 enabled = blk_iolatency_enabled(iolat->blkiolat);
606 if (!enabled)
607 return;
608
604 while (blkg && blkg->parent) {609 while (blkg && blkg->parent) {
605 iolat = blkg_to_lat(blkg);610 iolat = blkg_to_lat(blkg);
606 if (!iolat) {611 if (!iolat) {
@@ -609,8 +614,9 @@ static void blkcg_iolatency_done_bio(struct rq_qos *rqos, struct bio *bio) · 2 unmodified lines
609 }614 }
610 rqw = &iolat->rq_wait;615 rqw = &iolat->rq_wait;
611 616
612 atomic_dec(&rqw->inflight);617 inflight = atomic_dec_return(&rqw->inflight);
613 if (!enabled || iolat->min_lat_nsec == 0)618 WARN_ON_ONCE(inflight < 0);
619 if (iolat->min_lat_nsec == 0)
614 goto next;620 goto next;
615 iolatency_record_time(iolat, &bio->bi_issue, now,621 iolatency_record_time(iolat, &bio->bi_issue, now,
616 issue_as_root);622 issue_as_root);
@@ -754,10 +760,13 @@ int blk_iolatency_init(struct request_queue *q) · 137 unmodified lines
754 return 0;760 return 0;
755}761}
756 762
757static void iolatency_set_min_lat_nsec(struct blkcg_gq *blkg, u64 val)763/*
764 * return 1 for enabling iolatency, return -1 for disabling iolatency, otherwise
765 * return 0.
766 */
767static int iolatency_set_min_lat_nsec(struct blkcg_gq *blkg, u64 val)
758{768{
759 struct iolatency_grp *iolat = blkg_to_lat(blkg);769 struct iolatency_grp *iolat = blkg_to_lat(blkg);
760 struct blk_iolatency *blkiolat = iolat->blkiolat;
761 u64 oldval = iolat->min_lat_nsec;770 u64 oldval = iolat->min_lat_nsec;
762 771
763 iolat->min_lat_nsec = val;772 iolat->min_lat_nsec = val;
@@ -766,9 +775,10 @@ static void iolatency_set_min_lat_nsec(struct blkcg_gq *blkg, u64 val) · 2 unmodified lines
766 BLKIOLATENCY_MAX_WIN_SIZE);775 BLKIOLATENCY_MAX_WIN_SIZE);
767 776
768 if (!oldval && val)777 if (!oldval && val)
769 atomic_inc(&blkiolat->enabled);778 return 1;
770 if (oldval && !val)779 if (oldval && !val)
771 atomic_dec(&blkiolat->enabled);780 return -1;
781 return 0;
772}782}
773 783
774static void iolatency_clear_scaling(struct blkcg_gq *blkg)784static void iolatency_clear_scaling(struct blkcg_gq *blkg)
@@ -800,6 +810,7 @@ static ssize_t iolatency_set_limit(struct kernfs_open_file *of, char *buf, · 25 unmodified lines
800 u64 lat_val = 0;810 u64 lat_val = 0;
801 u64 oldval;811 u64 oldval;
802 int ret;812 int ret;
813 int enable = 0;
803 814
804 ret = blkg_conf_prep(blkcg, &blkcg_policy_iolatency, buf, &ctx);815 ret = blkg_conf_prep(blkcg, &blkcg_policy_iolatency, buf, &ctx);
805 if (ret)816 if (ret)
@@ -834,7 +845,12 @@ static ssize_t iolatency_set_limit(struct kernfs_open_file *of, char *buf, · 28 unmodified lines
834 blkg = ctx.blkg;845 blkg = ctx.blkg;
835 oldval = iolat->min_lat_nsec;846 oldval = iolat->min_lat_nsec;
836 847
837 iolatency_set_min_lat_nsec(blkg, lat_val);848 enable = iolatency_set_min_lat_nsec(blkg, lat_val);
849 if (enable) {
850 WARN_ON_ONCE(!blk_get_queue(blkg->q));
851 blkg_get(blkg);
852 }
853
838 if (oldval != iolat->min_lat_nsec) {854 if (oldval != iolat->min_lat_nsec) {
839 iolatency_clear_scaling(blkg);855 iolatency_clear_scaling(blkg);
840 }856 }
@@ -842,6 +858,24 @@ static ssize_t iolatency_set_limit(struct kernfs_open_file *of, char *buf, · 1 unmodified line
842 ret = 0;858 ret = 0;
843out:859out:
844 blkg_conf_finish(&ctx);860 blkg_conf_finish(&ctx);
861 if (ret == 0 && enable) {
862 struct iolatency_grp *tmp = blkg_to_lat(blkg);
863 struct blk_iolatency *blkiolat = tmp->blkiolat;
864
865 blk_mq_freeze_queue(blkg->q);
866
867 if (enable == 1)
868 atomic_inc(&blkiolat->enabled);
869 else if (enable == -1)
870 atomic_dec(&blkiolat->enabled);
871 else
872 WARN_ON_ONCE(1);
873
874 blk_mq_unfreeze_queue(blkg->q);
875
876 blkg_put(blkg);
877 blk_put_queue(blkg->q);
878 }
845 return ret ?: nbytes;879 return ret ?: nbytes;
846}880}
847 881
@@ -977,8 +1011,14 @@ static void iolatency_pd_offline(struct blkg_policy_data *pd) · 129 unmodified lines
977{1011{
978 struct iolatency_grp *iolat = pd_to_lat(pd);1012 struct iolatency_grp *iolat = pd_to_lat(pd);
979 struct blkcg_gq *blkg = lat_to_blkg(iolat);1013 struct blkcg_gq *blkg = lat_to_blkg(iolat);
1014 struct blk_iolatency *blkiolat = iolat->blkiolat;
1015 int ret;
980 1016
981 iolatency_set_min_lat_nsec(blkg, 0);1017 ret = iolatency_set_min_lat_nsec(blkg, 0);
1018 if (ret == 1)
1019 atomic_inc(&blkiolat->enabled);
1020 if (ret == -1)
1021 atomic_dec(&blkiolat->enabled);
982 iolatency_clear_scaling(blkg);1022 iolatency_clear_scaling(blkg);
983}1023}
984 1024
block/blk-mq.h+0−1
@@ -36,7 +36,6 @@ struct blk_mq_ctx { · 35 unmodified lines
36 struct kobject kobj;36 struct kobject kobj;
37} ____cacheline_aligned_in_smp;37} ____cacheline_aligned_in_smp;
38 38
39void blk_mq_freeze_queue(struct request_queue *q);
40void blk_mq_free_queue(struct request_queue *q);39void blk_mq_free_queue(struct request_queue *q);
41int blk_mq_update_nr_requests(struct request_queue *q, unsigned int nr);40int blk_mq_update_nr_requests(struct request_queue *q, unsigned int nr);
42void blk_mq_wake_waiters(struct request_queue *q);41void blk_mq_wake_waiters(struct request_queue *q);
drivers/ata/libata-core.c+1−0
@@ -4554,6 +4554,7 @@ static const struct ata_blacklist_entry ata_device_blacklist [] = { · 4553 unmodified lines
4554 { "SAMSUNG MZMPC128HBFU-000MV", "CXM14M1Q", ATA_HORKAGE_NOLPM, },4554 { "SAMSUNG MZMPC128HBFU-000MV", "CXM14M1Q", ATA_HORKAGE_NOLPM, },
4555 { "SAMSUNG SSD PM830 mSATA *", "CXM13D1Q", ATA_HORKAGE_NOLPM, },4555 { "SAMSUNG SSD PM830 mSATA *", "CXM13D1Q", ATA_HORKAGE_NOLPM, },
4556 { "SAMSUNG MZ7TD256HAFV-000L9", NULL, ATA_HORKAGE_NOLPM, },4556 { "SAMSUNG MZ7TD256HAFV-000L9", NULL, ATA_HORKAGE_NOLPM, },
4557 { "SAMSUNG MZ7TE512HMHP-000L1", "EXT06L0Q", ATA_HORKAGE_NOLPM, },
4557 4558
4558 /* devices that don't properly handle queued TRIM commands */4559 /* devices that don't properly handle queued TRIM commands */
4559 { "Micron_M500IT_*", "MU01", ATA_HORKAGE_NO_NCQ_TRIM |4560 { "Micron_M500IT_*", "MU01", ATA_HORKAGE_NO_NCQ_TRIM |
drivers/nvme/host/core.c+7−1
@@ -1253,6 +1253,7 @@ static u32 nvme_passthru_start(struct nvme_ctrl *ctrl, struct nvme_ns *ns, · 1252 unmodified lines
1253 * effects say only one namespace is affected.1253 * effects say only one namespace is affected.
1254 */1254 */
1255 if (effects & (NVME_CMD_EFFECTS_LBCC | NVME_CMD_EFFECTS_CSE_MASK)) {1255 if (effects & (NVME_CMD_EFFECTS_LBCC | NVME_CMD_EFFECTS_CSE_MASK)) {
1256 mutex_lock(&ctrl->scan_lock);
1256 nvme_start_freeze(ctrl);1257 nvme_start_freeze(ctrl);
1257 nvme_wait_freeze(ctrl);1258 nvme_wait_freeze(ctrl);
1258 }1259 }
@@ -1281,8 +1282,10 @@ static void nvme_passthru_end(struct nvme_ctrl *ctrl, u32 effects) · 22 unmodified lines
1281 */1282 */
1282 if (effects & NVME_CMD_EFFECTS_LBCC)1283 if (effects & NVME_CMD_EFFECTS_LBCC)
1283 nvme_update_formats(ctrl);1284 nvme_update_formats(ctrl);
1284 if (effects & (NVME_CMD_EFFECTS_LBCC | NVME_CMD_EFFECTS_CSE_MASK))1285 if (effects & (NVME_CMD_EFFECTS_LBCC | NVME_CMD_EFFECTS_CSE_MASK)) {
1285 nvme_unfreeze(ctrl);1286 nvme_unfreeze(ctrl);
1287 mutex_unlock(&ctrl->scan_lock);
1288 }
1286 if (effects & NVME_CMD_EFFECTS_CCC)1289 if (effects & NVME_CMD_EFFECTS_CCC)
1287 nvme_init_identify(ctrl);1290 nvme_init_identify(ctrl);
1288 if (effects & (NVME_CMD_EFFECTS_NIC | NVME_CMD_EFFECTS_NCC))1291 if (effects & (NVME_CMD_EFFECTS_NIC | NVME_CMD_EFFECTS_NCC))
@@ -3401,6 +3404,7 @@ static void nvme_scan_work(struct work_struct *work) · 2112 unmodified lines
3401 if (nvme_identify_ctrl(ctrl, &id))3404 if (nvme_identify_ctrl(ctrl, &id))
3402 return;3405 return;
3403 3406
3407 mutex_lock(&ctrl->scan_lock);
3404 nn = le32_to_cpu(id->nn);3408 nn = le32_to_cpu(id->nn);
3405 if (ctrl->vs >= NVME_VS(1, 1, 0) &&3409 if (ctrl->vs >= NVME_VS(1, 1, 0) &&
3406 !(ctrl->quirks & NVME_QUIRK_IDENTIFY_CNS)) {3410 !(ctrl->quirks & NVME_QUIRK_IDENTIFY_CNS)) {
@@ -3409,6 +3413,7 @@ static void nvme_scan_work(struct work_struct *work) · 2 unmodified lines
3409 }3413 }
3410 nvme_scan_ns_sequential(ctrl, nn);3414 nvme_scan_ns_sequential(ctrl, nn);
3411out_free_id:3415out_free_id:
3416 mutex_unlock(&ctrl->scan_lock);
3412 kfree(id);3417 kfree(id);
3413 down_write(&ctrl->namespaces_rwsem);3418 down_write(&ctrl->namespaces_rwsem);
3414 list_sort(NULL, &ctrl->namespaces, ns_cmp);3419 list_sort(NULL, &ctrl->namespaces, ns_cmp);
@@ -3652,6 +3657,7 @@ int nvme_init_ctrl(struct nvme_ctrl *ctrl, struct device *dev, · 237 unmodified lines
3652 3657
3653 ctrl->state = NVME_CTRL_NEW;3658 ctrl->state = NVME_CTRL_NEW;
3654 spin_lock_init(&ctrl->lock);3659 spin_lock_init(&ctrl->lock);
3660 mutex_init(&ctrl->scan_lock);
3655 INIT_LIST_HEAD(&ctrl->namespaces);3661 INIT_LIST_HEAD(&ctrl->namespaces);
3656 init_rwsem(&ctrl->namespaces_rwsem);3662 init_rwsem(&ctrl->namespaces_rwsem);
3657 ctrl->dev = dev;3663 ctrl->dev = dev;
drivers/nvme/host/nvme.h+1−0
@@ -154,6 +154,7 @@ struct nvme_ctrl { · 153 unmodified lines
154 enum nvme_ctrl_state state;154 enum nvme_ctrl_state state;
155 bool identified;155 bool identified;
156 spinlock_t lock;156 spinlock_t lock;
157 struct mutex scan_lock;
157 const struct nvme_ctrl_ops *ops;158 const struct nvme_ctrl_ops *ops;
158 struct request_queue *admin_q;159 struct request_queue *admin_q;
159 struct request_queue *connect_q;160 struct request_queue *connect_q;
drivers/nvme/host/pci.c+12−10
@@ -2557,16 +2557,7 @@ static void nvme_reset_work(struct work_struct *work) · 2556 unmodified lines
2557 if (dev->ctrl.ctrl_config & NVME_CC_ENABLE)2557 if (dev->ctrl.ctrl_config & NVME_CC_ENABLE)
2558 nvme_dev_disable(dev, false);2558 nvme_dev_disable(dev, false);
2559 2559
2560 /*2560 mutex_lock(&dev->shutdown_lock);
2561 * Introduce CONNECTING state from nvme-fc/rdma transports to mark the
2562 * initializing procedure here.
2563 */
2564 if (!nvme_change_ctrl_state(&dev->ctrl, NVME_CTRL_CONNECTING)) {
2565 dev_warn(dev->ctrl.device,
2566 "failed to mark controller CONNECTING\n");
2567 goto out;
2568 }
2569
2570 result = nvme_pci_enable(dev);2561 result = nvme_pci_enable(dev);
2571 if (result)2562 if (result)
2572 goto out;2563 goto out;
@@ -2585,6 +2576,17 @@ static void nvme_reset_work(struct work_struct *work) · 12 unmodified lines
2585 */2576 */
2586 dev->ctrl.max_hw_sectors = NVME_MAX_KB_SZ << 1;2577 dev->ctrl.max_hw_sectors = NVME_MAX_KB_SZ << 1;
2587 dev->ctrl.max_segments = NVME_MAX_SEGS;2578 dev->ctrl.max_segments = NVME_MAX_SEGS;
2579 mutex_unlock(&dev->shutdown_lock);
2580
2581 /*
2582 * Introduce CONNECTING state from nvme-fc/rdma transports to mark the
2583 * initializing procedure here.
2584 */
2585 if (!nvme_change_ctrl_state(&dev->ctrl, NVME_CTRL_CONNECTING)) {
2586 dev_warn(dev->ctrl.device,
2587 "failed to mark controller CONNECTING\n");
2588 goto out;
2589 }
2588 2590
2589 result = nvme_init_identify(&dev->ctrl);2591 result = nvme_init_identify(&dev->ctrl);
2590 if (result)2592 if (result)
fs/aio.c+1−0
@@ -1436,6 +1436,7 @@ static int aio_prep_rw(struct kiocb *req, const struct iocb *iocb) · 1435 unmodified lines
1436 if (unlikely(!req->ki_filp))1436 if (unlikely(!req->ki_filp))
1437 return -EBADF;1437 return -EBADF;
1438 req->ki_complete = aio_complete_rw;1438 req->ki_complete = aio_complete_rw;
1439 req->private = NULL;
1439 req->ki_pos = iocb->aio_offset;1440 req->ki_pos = iocb->aio_offset;
1440 req->ki_flags = iocb_flags(req->ki_filp);1441 req->ki_flags = iocb_flags(req->ki_filp);
1441 if (iocb->aio_flags & IOCB_FLAG_RESFD)1442 if (iocb->aio_flags & IOCB_FLAG_RESFD)
fs/buffer.c+10−9
@@ -200,6 +200,7 @@ __find_get_block_slow(struct block_device *bdev, sector_t block) · 199 unmodified lines
200 struct buffer_head *head;200 struct buffer_head *head;
201 struct page *page;201 struct page *page;
202 int all_mapped = 1;202 int all_mapped = 1;
203 static DEFINE_RATELIMIT_STATE(last_warned, HZ, 1);
203 204
204 index = block >> (PAGE_SHIFT - bd_inode->i_blkbits);205 index = block >> (PAGE_SHIFT - bd_inode->i_blkbits);
205 page = find_get_page_flags(bd_mapping, index, FGP_ACCESSED);206 page = find_get_page_flags(bd_mapping, index, FGP_ACCESSED);
@@ -227,15 +228,15 @@ __find_get_block_slow(struct block_device *bdev, sector_t block) · 21 unmodified lines
227 * file io on the block device and getblk. It gets dealt with228 * file io on the block device and getblk. It gets dealt with
228 * elsewhere, don't buffer_error if we had some unmapped buffers229 * elsewhere, don't buffer_error if we had some unmapped buffers
229 */230 */
230 if (all_mapped) {231 ratelimit_set_flags(&last_warned, RATELIMIT_MSG_ON_RELEASE);
231 printk("__find_get_block_slow() failed. "232 if (all_mapped && __ratelimit(&last_warned)) {
232 "block=%llu, b_blocknr=%llu\n",233 printk("__find_get_block_slow() failed. block=%llu, "
233 (unsigned long long)block,234 "b_blocknr=%llu, b_state=0x%08lx, b_size=%zu, "
234 (unsigned long long)bh->b_blocknr);235 "device %pg blocksize: %d\n",
235 printk("b_state=0x%08lx, b_size=%zu\n",236 (unsigned long long)block,
236 bh->b_state, bh->b_size);237 (unsigned long long)bh->b_blocknr,
237 printk("device %pg blocksize: %d\n", bdev,238 bh->b_state, bh->b_size, bdev,
238 1 << bd_inode->i_blkbits);239 1 << bd_inode->i_blkbits);
239 }240 }
240out_unlock:241out_unlock:
241 spin_unlock(&bd_mapping->private_lock);242 spin_unlock(&bd_mapping->private_lock);
include/linux/blktrace_api.h+7−1
@@ -116,7 +116,13 @@ extern void blk_fill_rwbs(char *rwbs, unsigned int op, int bytes); · 115 unmodified lines
116 116
117static inline sector_t blk_rq_trace_sector(struct request *rq)117static inline sector_t blk_rq_trace_sector(struct request *rq)
118{118{
119 return blk_rq_is_passthrough(rq) ? 0 : blk_rq_pos(rq);119 /*
120 * Tracing should ignore starting sector for passthrough requests and
121 * requests where starting sector didn't get set.
122 */
123 if (blk_rq_is_passthrough(rq) || blk_rq_pos(rq) == (sector_t)-1)
124 return 0;
125 return blk_rq_pos(rq);
120}126}
121 127
122static inline unsigned int blk_rq_trace_nr_sectors(struct request *rq)128static inline unsigned int blk_rq_trace_nr_sectors(struct request *rq)

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t