Skip to content

Commit 2335cbe

Browse files
committed
Merge tag 'for-linus-20190323' of git://git.kernel.dk/linux-block
Pull block fixes from Jens Axboe: "A set of fixes/changes that should go into this series. This contains: - Kernel doc / comment updates (Bart, Shenghui) - Un-export of core-only used function (Bart) - Fix race on loop file access (Dongli) - pf/pcd queue cleanup fixes (me) - Use appropriate helper for RESTART bit set (Yufen) - Use named identifier for classic poll (Yufen)" * tag 'for-linus-20190323' of git://git.kernel.dk/linux-block: sbitmap: trivial - update comment for sbitmap_deferred_clear_bit blkcg: Fix kernel-doc warnings blk-iolatency: #include "blk.h" block: Unexport blk_mq_add_to_requeue_list() block: add BLK_MQ_POLL_CLASSIC for hybrid poll and return EINVAL for unexpected value blk-mq: remove unused 'nr_expired' from blk_mq_hw_ctx loop: access lo_backing_file only when the loop device is Lo_bound blk-mq: use blk_mq_sched_mark_restart_hctx to set RESTART paride/pcd: cleanup queues when detection fails paride/pf: cleanup queues when detection fails
2 parents 9a1050a + 1e4471e commit 2335cbe

File tree

11 files changed

+39
-25
lines changed

11 files changed

+39
-25
lines changed

block/blk-cgroup.c

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1736,8 +1736,8 @@ void blkcg_maybe_throttle_current(void)
17361736

17371737
/**
17381738
* blkcg_schedule_throttle - this task needs to check for throttling
1739-
* @q - the request queue IO was submitted on
1740-
* @use_memdelay - do we charge this to memory delay for PSI
1739+
* @q: the request queue IO was submitted on
1740+
* @use_memdelay: do we charge this to memory delay for PSI
17411741
*
17421742
* This is called by the IO controller when we know there's delay accumulated
17431743
* for the blkg for this task. We do not pass the blkg because there are places
@@ -1769,8 +1769,9 @@ void blkcg_schedule_throttle(struct request_queue *q, bool use_memdelay)
17691769

17701770
/**
17711771
* blkcg_add_delay - add delay to this blkg
1772-
* @now - the current time in nanoseconds
1773-
* @delta - how many nanoseconds of delay to add
1772+
* @blkg: blkg of interest
1773+
* @now: the current time in nanoseconds
1774+
* @delta: how many nanoseconds of delay to add
17741775
*
17751776
* Charge @delta to the blkg's current delay accumulation. This is used to
17761777
* throttle tasks if an IO controller thinks we need more throttling.

block/blk-iolatency.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,7 @@
7575
#include <linux/blk-mq.h>
7676
#include "blk-rq-qos.h"
7777
#include "blk-stat.h"
78+
#include "blk.h"
7879

7980
#define DEFAULT_SCALE_COOKIE 1000000U
8081

block/blk-mq.c

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -782,7 +782,6 @@ void blk_mq_add_to_requeue_list(struct request *rq, bool at_head,
782782
if (kick_requeue_list)
783783
blk_mq_kick_requeue_list(q);
784784
}
785-
EXPORT_SYMBOL(blk_mq_add_to_requeue_list);
786785

787786
void blk_mq_kick_requeue_list(struct request_queue *q)
788787
{
@@ -1093,8 +1092,7 @@ static bool blk_mq_mark_tag_wait(struct blk_mq_hw_ctx *hctx,
10931092
bool ret;
10941093

10951094
if (!(hctx->flags & BLK_MQ_F_TAG_SHARED)) {
1096-
if (!test_bit(BLK_MQ_S_SCHED_RESTART, &hctx->state))
1097-
set_bit(BLK_MQ_S_SCHED_RESTART, &hctx->state);
1095+
blk_mq_sched_mark_restart_hctx(hctx);
10981096

10991097
/*
11001098
* It's possible that a tag was freed in the window between the
@@ -2857,7 +2855,7 @@ struct request_queue *blk_mq_init_allocated_queue(struct blk_mq_tag_set *set,
28572855
/*
28582856
* Default to classic polling
28592857
*/
2860-
q->poll_nsec = -1;
2858+
q->poll_nsec = BLK_MQ_POLL_CLASSIC;
28612859

28622860
blk_mq_init_cpu_queues(q, set->nr_hw_queues);
28632861
blk_mq_add_queue_tag_set(set, q);
@@ -3392,7 +3390,7 @@ static bool blk_mq_poll_hybrid(struct request_queue *q,
33923390
{
33933391
struct request *rq;
33943392

3395-
if (q->poll_nsec == -1)
3393+
if (q->poll_nsec == BLK_MQ_POLL_CLASSIC)
33963394
return false;
33973395

33983396
if (!blk_qc_t_is_internal(cookie))

block/blk-mq.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,8 @@ void blk_mq_free_queue(struct request_queue *q);
4141
int blk_mq_update_nr_requests(struct request_queue *q, unsigned int nr);
4242
void blk_mq_wake_waiters(struct request_queue *q);
4343
bool blk_mq_dispatch_rq_list(struct request_queue *, struct list_head *, bool);
44+
void blk_mq_add_to_requeue_list(struct request *rq, bool at_head,
45+
bool kick_requeue_list);
4446
void blk_mq_flush_busy_ctxs(struct blk_mq_hw_ctx *hctx, struct list_head *list);
4547
bool blk_mq_get_driver_tag(struct request *rq);
4648
struct request *blk_mq_dequeue_from_ctx(struct blk_mq_hw_ctx *hctx,

block/blk-sysfs.c

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -360,8 +360,8 @@ static ssize_t queue_poll_delay_show(struct request_queue *q, char *page)
360360
{
361361
int val;
362362

363-
if (q->poll_nsec == -1)
364-
val = -1;
363+
if (q->poll_nsec == BLK_MQ_POLL_CLASSIC)
364+
val = BLK_MQ_POLL_CLASSIC;
365365
else
366366
val = q->poll_nsec / 1000;
367367

@@ -380,10 +380,12 @@ static ssize_t queue_poll_delay_store(struct request_queue *q, const char *page,
380380
if (err < 0)
381381
return err;
382382

383-
if (val == -1)
384-
q->poll_nsec = -1;
385-
else
383+
if (val == BLK_MQ_POLL_CLASSIC)
384+
q->poll_nsec = BLK_MQ_POLL_CLASSIC;
385+
else if (val >= 0)
386386
q->poll_nsec = val * 1000;
387+
else
388+
return -EINVAL;
387389

388390
return count;
389391
}

drivers/block/loop.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -656,7 +656,7 @@ static int loop_validate_file(struct file *file, struct block_device *bdev)
656656
return -EBADF;
657657

658658
l = f->f_mapping->host->i_bdev->bd_disk->private_data;
659-
if (l->lo_state == Lo_unbound) {
659+
if (l->lo_state != Lo_bound) {
660660
return -EINVAL;
661661
}
662662
f = l->lo_backing_file;

drivers/block/paride/pcd.c

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -749,8 +749,12 @@ static int pcd_detect(void)
749749
return 0;
750750

751751
printk("%s: No CD-ROM drive found\n", name);
752-
for (unit = 0, cd = pcd; unit < PCD_UNITS; unit++, cd++)
752+
for (unit = 0, cd = pcd; unit < PCD_UNITS; unit++, cd++) {
753+
blk_cleanup_queue(cd->disk->queue);
754+
cd->disk->queue = NULL;
755+
blk_mq_free_tag_set(&cd->tag_set);
753756
put_disk(cd->disk);
757+
}
754758
pi_unregister_driver(par_drv);
755759
return -1;
756760
}

drivers/block/paride/pf.c

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -761,8 +761,12 @@ static int pf_detect(void)
761761
return 0;
762762

763763
printk("%s: No ATAPI disk detected\n", name);
764-
for (pf = units, unit = 0; unit < PF_UNITS; pf++, unit++)
764+
for (pf = units, unit = 0; unit < PF_UNITS; pf++, unit++) {
765+
blk_cleanup_queue(pf->disk->queue);
766+
pf->disk->queue = NULL;
767+
blk_mq_free_tag_set(&pf->tag_set);
765768
put_disk(pf->disk);
769+
}
766770
pi_unregister_driver(par_drv);
767771
return -1;
768772
}
@@ -1047,13 +1051,15 @@ static void __exit pf_exit(void)
10471051
int unit;
10481052
unregister_blkdev(major, name);
10491053
for (pf = units, unit = 0; unit < PF_UNITS; pf++, unit++) {
1050-
if (!pf->present)
1051-
continue;
1052-
del_gendisk(pf->disk);
1054+
if (pf->present)
1055+
del_gendisk(pf->disk);
1056+
10531057
blk_cleanup_queue(pf->disk->queue);
10541058
blk_mq_free_tag_set(&pf->tag_set);
10551059
put_disk(pf->disk);
1056-
pi_release(pf->pi);
1060+
1061+
if (pf->present)
1062+
pi_release(pf->pi);
10571063
}
10581064
}
10591065

include/linux/blk-mq.h

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,6 @@ struct blk_mq_hw_ctx {
5757
unsigned int queue_num;
5858

5959
atomic_t nr_active;
60-
unsigned int nr_expired;
6160

6261
struct hlist_node cpuhp_dead;
6362
struct kobject kobj;
@@ -300,8 +299,6 @@ void blk_mq_end_request(struct request *rq, blk_status_t error);
300299
void __blk_mq_end_request(struct request *rq, blk_status_t error);
301300

302301
void blk_mq_requeue_request(struct request *rq, bool kick_requeue_list);
303-
void blk_mq_add_to_requeue_list(struct request *rq, bool at_head,
304-
bool kick_requeue_list);
305302
void blk_mq_kick_requeue_list(struct request_queue *q);
306303
void blk_mq_delay_kick_requeue_list(struct request_queue *q, unsigned long msecs);
307304
bool blk_mq_complete_request(struct request *rq);

include/linux/blkdev.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,9 @@ struct blk_stat_callback;
5050
/* Must be consistent with blk_mq_poll_stats_bkt() */
5151
#define BLK_MQ_POLL_STATS_BKTS 16
5252

53+
/* Doing classic polling */
54+
#define BLK_MQ_POLL_CLASSIC -1
55+
5356
/*
5457
* Maximum number of blkcg policies allowed to be registered concurrently.
5558
* Defined here to simplify include dependency.

include/linux/sbitmap.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -330,7 +330,7 @@ static inline void sbitmap_clear_bit(struct sbitmap *sb, unsigned int bitnr)
330330
/*
331331
* This one is special, since it doesn't actually clear the bit, rather it
332332
* sets the corresponding bit in the ->cleared mask instead. Paired with
333-
* the caller doing sbitmap_batch_clear() if a given index is full, which
333+
* the caller doing sbitmap_deferred_clear() if a given index is full, which
334334
* will clear the previously freed entries in the corresponding ->word.
335335
*/
336336
static inline void sbitmap_deferred_clear_bit(struct sbitmap *sb, unsigned int bitnr)

0 commit comments

Comments
 (0)