Skip to content

Commit 8d72e5b

Browse files
committed
Merge tag 'for-linus-20190608' of git://git.kernel.dk/linux-block
Pull block fixes from Jens Axboe: - Allow symlink from the bfq.weight cgroup parameter to the general weight (Angelo) - Damien is new skd maintainer (Bart) - NVMe pull request from Sagi, with a few small fixes. - Ensure we set DMA segment size properly, dma-debug is now tripping on these (Christoph) - Remove useless debugfs_create() return check (Greg) - Remove redundant unlikely() check on IS_ERR() (Kefeng) - Fixup request freeing on exit (Ming) * tag 'for-linus-20190608' of git://git.kernel.dk/linux-block: block, bfq: add weight symlink to the bfq.weight cgroup parameter cgroup: let a symlink too be created with a cftype file block: free sched's request pool in blk_cleanup_queue nvme-rdma: use dynamic dma mapping per command nvme: Fix u32 overflow in the number of namespace list calculation mmc: also set max_segment_size in the device mtip32xx: also set max_segment_size in the device rsxx: don't call dma_set_max_seg_size nvme-pci: don't limit DMA segement size block: Drop unlikely before IS_ERR(_OR_NULL) block: aoe: no need to check return value of debugfs_create functions nvmet: fix data_len to 0 for bdev-backed write_zeroes MAINTAINERS: Hand over skd maintainership nvme-tcp: fix queue mapping when queue count is limited nvme-rdma: fix queue mapping when queue count is limited
2 parents 1b02caa + 6c70f89 commit 8d72e5b

20 files changed

Lines changed: 251 additions & 92 deletions

File tree

‎MAINTAINERS‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14995,7 +14995,7 @@ S: Odd Fixes
1499514995
F: drivers/net/ethernet/adaptec/starfire*
1499614996

1499714997
STEC S1220 SKD DRIVER
14998-
M: Bart Van Assche <bart.vanassche@wdc.com>
14998+
M: Damien Le Moal <Damien.LeMoal@wdc.com>
1499914999
L: linux-block@vger.kernel.org
1500015000
S: Maintained
1500115001
F: drivers/block/skd*[ch]

‎block/bfq-cgroup.c‎

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1046,7 +1046,8 @@ struct blkcg_policy blkcg_policy_bfq = {
10461046
struct cftype bfq_blkcg_legacy_files[] = {
10471047
{
10481048
.name = "bfq.weight",
1049-
.flags = CFTYPE_NOT_ON_ROOT,
1049+
.link_name = "weight",
1050+
.flags = CFTYPE_NOT_ON_ROOT | CFTYPE_SYMLINKED,
10501051
.seq_show = bfq_io_show_weight,
10511052
.write_u64 = bfq_io_set_weight_legacy,
10521053
},
@@ -1166,7 +1167,8 @@ struct cftype bfq_blkcg_legacy_files[] = {
11661167
struct cftype bfq_blkg_files[] = {
11671168
{
11681169
.name = "bfq.weight",
1169-
.flags = CFTYPE_NOT_ON_ROOT,
1170+
.link_name = "weight",
1171+
.flags = CFTYPE_NOT_ON_ROOT | CFTYPE_SYMLINKED,
11701172
.seq_show = bfq_io_show_weight,
11711173
.write = bfq_io_set_weight,
11721174
},

‎block/blk-cgroup.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -881,7 +881,7 @@ int blkg_conf_prep(struct blkcg *blkcg, const struct blkcg_policy *pol,
881881
blkg_free(new_blkg);
882882
} else {
883883
blkg = blkg_create(pos, q, new_blkg);
884-
if (unlikely(IS_ERR(blkg))) {
884+
if (IS_ERR(blkg)) {
885885
ret = PTR_ERR(blkg);
886886
goto fail_unlock;
887887
}

‎block/blk-core.c‎

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -320,6 +320,19 @@ void blk_cleanup_queue(struct request_queue *q)
320320
if (queue_is_mq(q))
321321
blk_mq_exit_queue(q);
322322

323+
/*
324+
* In theory, request pool of sched_tags belongs to request queue.
325+
* However, the current implementation requires tag_set for freeing
326+
* requests, so free the pool now.
327+
*
328+
* Queue has become frozen, there can't be any in-queue requests, so
329+
* it is safe to free requests now.
330+
*/
331+
mutex_lock(&q->sysfs_lock);
332+
if (q->elevator)
333+
blk_mq_sched_free_requests(q);
334+
mutex_unlock(&q->sysfs_lock);
335+
323336
percpu_ref_exit(&q->q_usage_counter);
324337

325338
/* @q is and will stay empty, shutdown and put */

‎block/blk-mq-sched.c‎

Lines changed: 27 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -475,14 +475,18 @@ static int blk_mq_sched_alloc_tags(struct request_queue *q,
475475
return ret;
476476
}
477477

478+
/* called in queue's release handler, tagset has gone away */
478479
static void blk_mq_sched_tags_teardown(struct request_queue *q)
479480
{
480-
struct blk_mq_tag_set *set = q->tag_set;
481481
struct blk_mq_hw_ctx *hctx;
482482
int i;
483483

484-
queue_for_each_hw_ctx(q, hctx, i)
485-
blk_mq_sched_free_tags(set, hctx, i);
484+
queue_for_each_hw_ctx(q, hctx, i) {
485+
if (hctx->sched_tags) {
486+
blk_mq_free_rq_map(hctx->sched_tags);
487+
hctx->sched_tags = NULL;
488+
}
489+
}
486490
}
487491

488492
int blk_mq_init_sched(struct request_queue *q, struct elevator_type *e)
@@ -523,6 +527,7 @@ int blk_mq_init_sched(struct request_queue *q, struct elevator_type *e)
523527
ret = e->ops.init_hctx(hctx, i);
524528
if (ret) {
525529
eq = q->elevator;
530+
blk_mq_sched_free_requests(q);
526531
blk_mq_exit_sched(q, eq);
527532
kobject_put(&eq->kobj);
528533
return ret;
@@ -534,11 +539,30 @@ int blk_mq_init_sched(struct request_queue *q, struct elevator_type *e)
534539
return 0;
535540

536541
err:
542+
blk_mq_sched_free_requests(q);
537543
blk_mq_sched_tags_teardown(q);
538544
q->elevator = NULL;
539545
return ret;
540546
}
541547

548+
/*
549+
* called in either blk_queue_cleanup or elevator_switch, tagset
550+
* is required for freeing requests
551+
*/
552+
void blk_mq_sched_free_requests(struct request_queue *q)
553+
{
554+
struct blk_mq_hw_ctx *hctx;
555+
int i;
556+
557+
lockdep_assert_held(&q->sysfs_lock);
558+
WARN_ON(!q->elevator);
559+
560+
queue_for_each_hw_ctx(q, hctx, i) {
561+
if (hctx->sched_tags)
562+
blk_mq_free_rqs(q->tag_set, hctx->sched_tags, i);
563+
}
564+
}
565+
542566
void blk_mq_exit_sched(struct request_queue *q, struct elevator_queue *e)
543567
{
544568
struct blk_mq_hw_ctx *hctx;

‎block/blk-mq-sched.h‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ void blk_mq_sched_dispatch_requests(struct blk_mq_hw_ctx *hctx);
2828

2929
int blk_mq_init_sched(struct request_queue *q, struct elevator_type *e);
3030
void blk_mq_exit_sched(struct request_queue *q, struct elevator_queue *e);
31+
void blk_mq_sched_free_requests(struct request_queue *q);
3132

3233
static inline bool
3334
blk_mq_sched_bio_merge(struct request_queue *q, struct bio *bio)

‎block/blk-sysfs.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -850,7 +850,7 @@ static void blk_exit_queue(struct request_queue *q)
850850
*/
851851
if (q->elevator) {
852852
ioc_clear_queue(q);
853-
elevator_exit(q, q->elevator);
853+
__elevator_exit(q, q->elevator);
854854
q->elevator = NULL;
855855
}
856856

‎block/blk.h‎

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
#include <linux/blk-mq.h>
77
#include <xen/xen.h>
88
#include "blk-mq.h"
9+
#include "blk-mq-sched.h"
910

1011
/* Max future timer expiry for timeouts */
1112
#define BLK_MAX_TIMEOUT (5 * HZ)
@@ -176,10 +177,17 @@ void blk_insert_flush(struct request *rq);
176177
int elevator_init_mq(struct request_queue *q);
177178
int elevator_switch_mq(struct request_queue *q,
178179
struct elevator_type *new_e);
179-
void elevator_exit(struct request_queue *, struct elevator_queue *);
180+
void __elevator_exit(struct request_queue *, struct elevator_queue *);
180181
int elv_register_queue(struct request_queue *q);
181182
void elv_unregister_queue(struct request_queue *q);
182183

184+
static inline void elevator_exit(struct request_queue *q,
185+
struct elevator_queue *e)
186+
{
187+
blk_mq_sched_free_requests(q);
188+
__elevator_exit(q, e);
189+
}
190+
183191
struct hd_struct *__disk_get_part(struct gendisk *disk, int partno);
184192

185193
#ifdef CONFIG_FAIL_IO_TIMEOUT

‎block/elevator.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -178,7 +178,7 @@ static void elevator_release(struct kobject *kobj)
178178
kfree(e);
179179
}
180180

181-
void elevator_exit(struct request_queue *q, struct elevator_queue *e)
181+
void __elevator_exit(struct request_queue *q, struct elevator_queue *e)
182182
{
183183
mutex_lock(&e->sysfs_lock);
184184
if (e->type->ops.exit_sched)

‎drivers/block/aoe/aoeblk.c‎

Lines changed: 2 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -196,7 +196,6 @@ static const struct file_operations aoe_debugfs_fops = {
196196
static void
197197
aoedisk_add_debugfs(struct aoedev *d)
198198
{
199-
struct dentry *entry;
200199
char *p;
201200

202201
if (aoe_debugfs_dir == NULL)
@@ -207,15 +206,8 @@ aoedisk_add_debugfs(struct aoedev *d)
207206
else
208207
p++;
209208
BUG_ON(*p == '\0');
210-
entry = debugfs_create_file(p, 0444, aoe_debugfs_dir, d,
211-
&aoe_debugfs_fops);
212-
if (IS_ERR_OR_NULL(entry)) {
213-
pr_info("aoe: cannot create debugfs file for %s\n",
214-
d->gd->disk_name);
215-
return;
216-
}
217-
BUG_ON(d->debugfs);
218-
d->debugfs = entry;
209+
d->debugfs = debugfs_create_file(p, 0444, aoe_debugfs_dir, d,
210+
&aoe_debugfs_fops);
219211
}
220212
void
221213
aoedisk_rm_debugfs(struct aoedev *d)
@@ -472,10 +464,6 @@ aoeblk_init(void)
472464
if (buf_pool_cache == NULL)
473465
return -ENOMEM;
474466
aoe_debugfs_dir = debugfs_create_dir("aoe", NULL);
475-
if (IS_ERR_OR_NULL(aoe_debugfs_dir)) {
476-
pr_info("aoe: cannot create debugfs directory\n");
477-
aoe_debugfs_dir = NULL;
478-
}
479467
return 0;
480468
}
481469

0 commit comments

Comments
 (0)