diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2019-01-19 16:12:50 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2019-01-19 16:12:50 -0500 |
commit | 0facb892456ff922924e704f78cafcaa7be85e8c (patch) | |
tree | 9b3c39756dbc9c206e30504591527dcc97c5deb2 | |
parent | 2339e91d0e6609e17943a0ab3c3c8c4044760c05 (diff) | |
parent | 38197ca176fc259fa4c871d07bcf8389d044a895 (diff) |
Merge tag 'for-linus-20190118' of git://git.kernel.dk/linux-block
Pull block fixes from Jens Axboe:
- block size setting fixes for loop/nbd (Jan Kara)
- md bio_alloc_mddev() cleanup (Marcos)
- Ensure we don't lose the REQ_INTEGRITY flag (Ming)
- Two NVMe fixes by way of Christoph:
- Fix NVMe IRQ calculation (Ming)
- Uninitialized variable in nvmet-tcp (Sagi)
- BFQ comment fix (Paolo)
- License cleanup for recently added blk-mq-debugfs-zoned (Thomas)
* tag 'for-linus-20190118' of git://git.kernel.dk/linux-block:
block: Cleanup license notice
nvme-pci: fix nvme_setup_irqs()
nvmet-tcp: fix uninitialized variable access
block: don't lose track of REQ_INTEGRITY flag
blockdev: Fix livelocks on loop device
nbd: Use set_blocksize() to set device blocksize
md: Make bio_alloc_mddev use bio_alloc_bioset
block, bfq: fix comments on __bfq_deactivate_entity
-rw-r--r-- | block/bfq-wf2q.c | 11 | ||||
-rw-r--r-- | block/blk-mq-debugfs-zoned.c | 2 | ||||
-rw-r--r-- | block/blk-mq.c | 3 | ||||
-rw-r--r-- | drivers/block/nbd.c | 5 | ||||
-rw-r--r-- | drivers/md/md.c | 7 | ||||
-rw-r--r-- | drivers/nvme/host/pci.c | 21 | ||||
-rw-r--r-- | drivers/nvme/target/tcp.c | 2 | ||||
-rw-r--r-- | fs/block_dev.c | 28 |
8 files changed, 43 insertions, 36 deletions
diff --git a/block/bfq-wf2q.c b/block/bfq-wf2q.c index 63e0f12be7c9..72adbbe975d5 100644 --- a/block/bfq-wf2q.c +++ b/block/bfq-wf2q.c | |||
@@ -1154,15 +1154,14 @@ static void bfq_activate_requeue_entity(struct bfq_entity *entity, | |||
1154 | } | 1154 | } |
1155 | 1155 | ||
1156 | /** | 1156 | /** |
1157 | * __bfq_deactivate_entity - deactivate an entity from its service tree. | 1157 | * __bfq_deactivate_entity - update sched_data and service trees for |
1158 | * @entity: the entity to deactivate. | 1158 | * entity, so as to represent entity as inactive |
1159 | * @entity: the entity being deactivated. | ||
1159 | * @ins_into_idle_tree: if false, the entity will not be put into the | 1160 | * @ins_into_idle_tree: if false, the entity will not be put into the |
1160 | * idle tree. | 1161 | * idle tree. |
1161 | * | 1162 | * |
1162 | * Deactivates an entity, independently of its previous state. Must | 1163 | * If necessary and allowed, puts entity into the idle tree. NOTE: |
1163 | * be invoked only if entity is on a service tree. Extracts the entity | 1164 | * entity may be on no tree if in service. |
1164 | * from that tree, and if necessary and allowed, puts it into the idle | ||
1165 | * tree. | ||
1166 | */ | 1165 | */ |
1167 | bool __bfq_deactivate_entity(struct bfq_entity *entity, bool ins_into_idle_tree) | 1166 | bool __bfq_deactivate_entity(struct bfq_entity *entity, bool ins_into_idle_tree) |
1168 | { | 1167 | { |
diff --git a/block/blk-mq-debugfs-zoned.c b/block/blk-mq-debugfs-zoned.c index fb2c82c351e4..038cb627c868 100644 --- a/block/blk-mq-debugfs-zoned.c +++ b/block/blk-mq-debugfs-zoned.c | |||
@@ -1,8 +1,6 @@ | |||
1 | // SPDX-License-Identifier: GPL-2.0 | 1 | // SPDX-License-Identifier: GPL-2.0 |
2 | /* | 2 | /* |
3 | * Copyright (C) 2017 Western Digital Corporation or its affiliates. | 3 | * Copyright (C) 2017 Western Digital Corporation or its affiliates. |
4 | * | ||
5 | * This file is released under the GPL. | ||
6 | */ | 4 | */ |
7 | 5 | ||
8 | #include <linux/blkdev.h> | 6 | #include <linux/blkdev.h> |
diff --git a/block/blk-mq.c b/block/blk-mq.c index 3ba37b9e15e9..8f5b533764ca 100644 --- a/block/blk-mq.c +++ b/block/blk-mq.c | |||
@@ -1906,7 +1906,7 @@ static blk_qc_t blk_mq_make_request(struct request_queue *q, struct bio *bio) | |||
1906 | { | 1906 | { |
1907 | const int is_sync = op_is_sync(bio->bi_opf); | 1907 | const int is_sync = op_is_sync(bio->bi_opf); |
1908 | const int is_flush_fua = op_is_flush(bio->bi_opf); | 1908 | const int is_flush_fua = op_is_flush(bio->bi_opf); |
1909 | struct blk_mq_alloc_data data = { .flags = 0, .cmd_flags = bio->bi_opf }; | 1909 | struct blk_mq_alloc_data data = { .flags = 0}; |
1910 | struct request *rq; | 1910 | struct request *rq; |
1911 | struct blk_plug *plug; | 1911 | struct blk_plug *plug; |
1912 | struct request *same_queue_rq = NULL; | 1912 | struct request *same_queue_rq = NULL; |
@@ -1928,6 +1928,7 @@ static blk_qc_t blk_mq_make_request(struct request_queue *q, struct bio *bio) | |||
1928 | 1928 | ||
1929 | rq_qos_throttle(q, bio); | 1929 | rq_qos_throttle(q, bio); |
1930 | 1930 | ||
1931 | data.cmd_flags = bio->bi_opf; | ||
1931 | rq = blk_mq_get_request(q, bio, &data); | 1932 | rq = blk_mq_get_request(q, bio, &data); |
1932 | if (unlikely(!rq)) { | 1933 | if (unlikely(!rq)) { |
1933 | rq_qos_cleanup(q, bio); | 1934 | rq_qos_cleanup(q, bio); |
diff --git a/drivers/block/nbd.c b/drivers/block/nbd.c index 08696f5f00bb..7c9a949e876b 100644 --- a/drivers/block/nbd.c +++ b/drivers/block/nbd.c | |||
@@ -288,9 +288,10 @@ static void nbd_size_update(struct nbd_device *nbd) | |||
288 | blk_queue_physical_block_size(nbd->disk->queue, config->blksize); | 288 | blk_queue_physical_block_size(nbd->disk->queue, config->blksize); |
289 | set_capacity(nbd->disk, config->bytesize >> 9); | 289 | set_capacity(nbd->disk, config->bytesize >> 9); |
290 | if (bdev) { | 290 | if (bdev) { |
291 | if (bdev->bd_disk) | 291 | if (bdev->bd_disk) { |
292 | bd_set_size(bdev, config->bytesize); | 292 | bd_set_size(bdev, config->bytesize); |
293 | else | 293 | set_blocksize(bdev, config->blksize); |
294 | } else | ||
294 | bdev->bd_invalidated = 1; | 295 | bdev->bd_invalidated = 1; |
295 | bdput(bdev); | 296 | bdput(bdev); |
296 | } | 297 | } |
diff --git a/drivers/md/md.c b/drivers/md/md.c index fd4af4de03b4..05ffffb8b769 100644 --- a/drivers/md/md.c +++ b/drivers/md/md.c | |||
@@ -207,15 +207,10 @@ static bool create_on_open = true; | |||
207 | struct bio *bio_alloc_mddev(gfp_t gfp_mask, int nr_iovecs, | 207 | struct bio *bio_alloc_mddev(gfp_t gfp_mask, int nr_iovecs, |
208 | struct mddev *mddev) | 208 | struct mddev *mddev) |
209 | { | 209 | { |
210 | struct bio *b; | ||
211 | |||
212 | if (!mddev || !bioset_initialized(&mddev->bio_set)) | 210 | if (!mddev || !bioset_initialized(&mddev->bio_set)) |
213 | return bio_alloc(gfp_mask, nr_iovecs); | 211 | return bio_alloc(gfp_mask, nr_iovecs); |
214 | 212 | ||
215 | b = bio_alloc_bioset(gfp_mask, nr_iovecs, &mddev->bio_set); | 213 | return bio_alloc_bioset(gfp_mask, nr_iovecs, &mddev->bio_set); |
216 | if (!b) | ||
217 | return NULL; | ||
218 | return b; | ||
219 | } | 214 | } |
220 | EXPORT_SYMBOL_GPL(bio_alloc_mddev); | 215 | EXPORT_SYMBOL_GPL(bio_alloc_mddev); |
221 | 216 | ||
diff --git a/drivers/nvme/host/pci.c b/drivers/nvme/host/pci.c index deb1a66bf117..9bc585415d9b 100644 --- a/drivers/nvme/host/pci.c +++ b/drivers/nvme/host/pci.c | |||
@@ -2041,14 +2041,18 @@ static int nvme_setup_host_mem(struct nvme_dev *dev) | |||
2041 | return ret; | 2041 | return ret; |
2042 | } | 2042 | } |
2043 | 2043 | ||
2044 | /* irq_queues covers admin queue */ | ||
2044 | static void nvme_calc_io_queues(struct nvme_dev *dev, unsigned int irq_queues) | 2045 | static void nvme_calc_io_queues(struct nvme_dev *dev, unsigned int irq_queues) |
2045 | { | 2046 | { |
2046 | unsigned int this_w_queues = write_queues; | 2047 | unsigned int this_w_queues = write_queues; |
2047 | 2048 | ||
2049 | WARN_ON(!irq_queues); | ||
2050 | |||
2048 | /* | 2051 | /* |
2049 | * Setup read/write queue split | 2052 | * Setup read/write queue split, assign admin queue one independent |
2053 | * irq vector if irq_queues is > 1. | ||
2050 | */ | 2054 | */ |
2051 | if (irq_queues == 1) { | 2055 | if (irq_queues <= 2) { |
2052 | dev->io_queues[HCTX_TYPE_DEFAULT] = 1; | 2056 | dev->io_queues[HCTX_TYPE_DEFAULT] = 1; |
2053 | dev->io_queues[HCTX_TYPE_READ] = 0; | 2057 | dev->io_queues[HCTX_TYPE_READ] = 0; |
2054 | return; | 2058 | return; |
@@ -2056,21 +2060,21 @@ static void nvme_calc_io_queues(struct nvme_dev *dev, unsigned int irq_queues) | |||
2056 | 2060 | ||
2057 | /* | 2061 | /* |
2058 | * If 'write_queues' is set, ensure it leaves room for at least | 2062 | * If 'write_queues' is set, ensure it leaves room for at least |
2059 | * one read queue | 2063 | * one read queue and one admin queue |
2060 | */ | 2064 | */ |
2061 | if (this_w_queues >= irq_queues) | 2065 | if (this_w_queues >= irq_queues) |
2062 | this_w_queues = irq_queues - 1; | 2066 | this_w_queues = irq_queues - 2; |
2063 | 2067 | ||
2064 | /* | 2068 | /* |
2065 | * If 'write_queues' is set to zero, reads and writes will share | 2069 | * If 'write_queues' is set to zero, reads and writes will share |
2066 | * a queue set. | 2070 | * a queue set. |
2067 | */ | 2071 | */ |
2068 | if (!this_w_queues) { | 2072 | if (!this_w_queues) { |
2069 | dev->io_queues[HCTX_TYPE_DEFAULT] = irq_queues; | 2073 | dev->io_queues[HCTX_TYPE_DEFAULT] = irq_queues - 1; |
2070 | dev->io_queues[HCTX_TYPE_READ] = 0; | 2074 | dev->io_queues[HCTX_TYPE_READ] = 0; |
2071 | } else { | 2075 | } else { |
2072 | dev->io_queues[HCTX_TYPE_DEFAULT] = this_w_queues; | 2076 | dev->io_queues[HCTX_TYPE_DEFAULT] = this_w_queues; |
2073 | dev->io_queues[HCTX_TYPE_READ] = irq_queues - this_w_queues; | 2077 | dev->io_queues[HCTX_TYPE_READ] = irq_queues - this_w_queues - 1; |
2074 | } | 2078 | } |
2075 | } | 2079 | } |
2076 | 2080 | ||
@@ -2095,7 +2099,7 @@ static int nvme_setup_irqs(struct nvme_dev *dev, unsigned int nr_io_queues) | |||
2095 | this_p_queues = nr_io_queues - 1; | 2099 | this_p_queues = nr_io_queues - 1; |
2096 | irq_queues = 1; | 2100 | irq_queues = 1; |
2097 | } else { | 2101 | } else { |
2098 | irq_queues = nr_io_queues - this_p_queues; | 2102 | irq_queues = nr_io_queues - this_p_queues + 1; |
2099 | } | 2103 | } |
2100 | dev->io_queues[HCTX_TYPE_POLL] = this_p_queues; | 2104 | dev->io_queues[HCTX_TYPE_POLL] = this_p_queues; |
2101 | 2105 | ||
@@ -2115,8 +2119,9 @@ static int nvme_setup_irqs(struct nvme_dev *dev, unsigned int nr_io_queues) | |||
2115 | * If we got a failure and we're down to asking for just | 2119 | * If we got a failure and we're down to asking for just |
2116 | * 1 + 1 queues, just ask for a single vector. We'll share | 2120 | * 1 + 1 queues, just ask for a single vector. We'll share |
2117 | * that between the single IO queue and the admin queue. | 2121 | * that between the single IO queue and the admin queue. |
2122 | * Otherwise, we assign one independent vector to admin queue. | ||
2118 | */ | 2123 | */ |
2119 | if (result >= 0 && irq_queues > 1) | 2124 | if (irq_queues > 1) |
2120 | irq_queues = irq_sets[0] + irq_sets[1] + 1; | 2125 | irq_queues = irq_sets[0] + irq_sets[1] + 1; |
2121 | 2126 | ||
2122 | result = pci_alloc_irq_vectors_affinity(pdev, irq_queues, | 2127 | result = pci_alloc_irq_vectors_affinity(pdev, irq_queues, |
diff --git a/drivers/nvme/target/tcp.c b/drivers/nvme/target/tcp.c index 44b37b202e39..ad0df786fe93 100644 --- a/drivers/nvme/target/tcp.c +++ b/drivers/nvme/target/tcp.c | |||
@@ -1089,7 +1089,7 @@ out: | |||
1089 | 1089 | ||
1090 | static int nvmet_tcp_try_recv_one(struct nvmet_tcp_queue *queue) | 1090 | static int nvmet_tcp_try_recv_one(struct nvmet_tcp_queue *queue) |
1091 | { | 1091 | { |
1092 | int result; | 1092 | int result = 0; |
1093 | 1093 | ||
1094 | if (unlikely(queue->rcv_state == NVMET_TCP_RECV_ERR)) | 1094 | if (unlikely(queue->rcv_state == NVMET_TCP_RECV_ERR)) |
1095 | return 0; | 1095 | return 0; |
diff --git a/fs/block_dev.c b/fs/block_dev.c index c546cdce77e6..58a4c1217fa8 100644 --- a/fs/block_dev.c +++ b/fs/block_dev.c | |||
@@ -104,6 +104,20 @@ void invalidate_bdev(struct block_device *bdev) | |||
104 | } | 104 | } |
105 | EXPORT_SYMBOL(invalidate_bdev); | 105 | EXPORT_SYMBOL(invalidate_bdev); |
106 | 106 | ||
107 | static void set_init_blocksize(struct block_device *bdev) | ||
108 | { | ||
109 | unsigned bsize = bdev_logical_block_size(bdev); | ||
110 | loff_t size = i_size_read(bdev->bd_inode); | ||
111 | |||
112 | while (bsize < PAGE_SIZE) { | ||
113 | if (size & bsize) | ||
114 | break; | ||
115 | bsize <<= 1; | ||
116 | } | ||
117 | bdev->bd_block_size = bsize; | ||
118 | bdev->bd_inode->i_blkbits = blksize_bits(bsize); | ||
119 | } | ||
120 | |||
107 | int set_blocksize(struct block_device *bdev, int size) | 121 | int set_blocksize(struct block_device *bdev, int size) |
108 | { | 122 | { |
109 | /* Size must be a power of two, and between 512 and PAGE_SIZE */ | 123 | /* Size must be a power of two, and between 512 and PAGE_SIZE */ |
@@ -1431,18 +1445,9 @@ EXPORT_SYMBOL(check_disk_change); | |||
1431 | 1445 | ||
1432 | void bd_set_size(struct block_device *bdev, loff_t size) | 1446 | void bd_set_size(struct block_device *bdev, loff_t size) |
1433 | { | 1447 | { |
1434 | unsigned bsize = bdev_logical_block_size(bdev); | ||
1435 | |||
1436 | inode_lock(bdev->bd_inode); | 1448 | inode_lock(bdev->bd_inode); |
1437 | i_size_write(bdev->bd_inode, size); | 1449 | i_size_write(bdev->bd_inode, size); |
1438 | inode_unlock(bdev->bd_inode); | 1450 | inode_unlock(bdev->bd_inode); |
1439 | while (bsize < PAGE_SIZE) { | ||
1440 | if (size & bsize) | ||
1441 | break; | ||
1442 | bsize <<= 1; | ||
1443 | } | ||
1444 | bdev->bd_block_size = bsize; | ||
1445 | bdev->bd_inode->i_blkbits = blksize_bits(bsize); | ||
1446 | } | 1451 | } |
1447 | EXPORT_SYMBOL(bd_set_size); | 1452 | EXPORT_SYMBOL(bd_set_size); |
1448 | 1453 | ||
@@ -1519,8 +1524,10 @@ static int __blkdev_get(struct block_device *bdev, fmode_t mode, int for_part) | |||
1519 | } | 1524 | } |
1520 | } | 1525 | } |
1521 | 1526 | ||
1522 | if (!ret) | 1527 | if (!ret) { |
1523 | bd_set_size(bdev,(loff_t)get_capacity(disk)<<9); | 1528 | bd_set_size(bdev,(loff_t)get_capacity(disk)<<9); |
1529 | set_init_blocksize(bdev); | ||
1530 | } | ||
1524 | 1531 | ||
1525 | /* | 1532 | /* |
1526 | * If the device is invalidated, rescan partition | 1533 | * If the device is invalidated, rescan partition |
@@ -1555,6 +1562,7 @@ static int __blkdev_get(struct block_device *bdev, fmode_t mode, int for_part) | |||
1555 | goto out_clear; | 1562 | goto out_clear; |
1556 | } | 1563 | } |
1557 | bd_set_size(bdev, (loff_t)bdev->bd_part->nr_sects << 9); | 1564 | bd_set_size(bdev, (loff_t)bdev->bd_part->nr_sects << 9); |
1565 | set_init_blocksize(bdev); | ||
1558 | } | 1566 | } |
1559 | 1567 | ||
1560 | if (bdev->bd_bdi == &noop_backing_dev_info) | 1568 | if (bdev->bd_bdi == &noop_backing_dev_info) |