Skip to content

Commit fed678d

Browse files
committed
Merge branch 'for-linus' of git://git.kernel.dk/linux-block
* 'for-linus' of git://git.kernel.dk/linux-block: floppy: use del_timer_sync() in init cleanup blk-cgroup: be able to remove the record of unplugged device block: Don't check QUEUE_FLAG_SAME_COMP in __blk_complete_request mm: Add comment explaining task state setting in bdi_forker_thread() mm: Cleanup clearing of BDI_pending bit in bdi_forker_thread() block: simplify force plug flush code a little bit block: change force plug flush call order block: Fix queue_flag update when rq_affinity goes from 2 to 1 block: separate priority boosting from REQ_META block: remove READ_META and WRITE_META xen-blkback: fixed indentation and comments xen-blkback: Don't disconnect backend until state switched to XenbusStateClosed.
2 parents 808bf29 + 6c4867f commit fed678d

File tree

21 files changed

+92
-78
lines changed

21 files changed

+92
-78
lines changed

block/blk-cgroup.c

Lines changed: 16 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -785,10 +785,10 @@ static int blkio_policy_parse_and_set(char *buf,
785785
{
786786
char *s[4], *p, *major_s = NULL, *minor_s = NULL;
787787
int ret;
788-
unsigned long major, minor, temp;
788+
unsigned long major, minor;
789789
int i = 0;
790790
dev_t dev;
791-
u64 bps, iops;
791+
u64 temp;
792792

793793
memset(s, 0, sizeof(s));
794794

@@ -826,20 +826,23 @@ static int blkio_policy_parse_and_set(char *buf,
826826

827827
dev = MKDEV(major, minor);
828828

829-
ret = blkio_check_dev_num(dev);
829+
ret = strict_strtoull(s[1], 10, &temp);
830830
if (ret)
831-
return ret;
831+
return -EINVAL;
832832

833-
newpn->dev = dev;
833+
/* For rule removal, do not check for device presence. */
834+
if (temp) {
835+
ret = blkio_check_dev_num(dev);
836+
if (ret)
837+
return ret;
838+
}
834839

835-
if (s[1] == NULL)
836-
return -EINVAL;
840+
newpn->dev = dev;
837841

838842
switch (plid) {
839843
case BLKIO_POLICY_PROP:
840-
ret = strict_strtoul(s[1], 10, &temp);
841-
if (ret || (temp < BLKIO_WEIGHT_MIN && temp > 0) ||
842-
temp > BLKIO_WEIGHT_MAX)
844+
if ((temp < BLKIO_WEIGHT_MIN && temp > 0) ||
845+
temp > BLKIO_WEIGHT_MAX)
843846
return -EINVAL;
844847

845848
newpn->plid = plid;
@@ -850,26 +853,18 @@ static int blkio_policy_parse_and_set(char *buf,
850853
switch(fileid) {
851854
case BLKIO_THROTL_read_bps_device:
852855
case BLKIO_THROTL_write_bps_device:
853-
ret = strict_strtoull(s[1], 10, &bps);
854-
if (ret)
855-
return -EINVAL;
856-
857856
newpn->plid = plid;
858857
newpn->fileid = fileid;
859-
newpn->val.bps = bps;
858+
newpn->val.bps = temp;
860859
break;
861860
case BLKIO_THROTL_read_iops_device:
862861
case BLKIO_THROTL_write_iops_device:
863-
ret = strict_strtoull(s[1], 10, &iops);
864-
if (ret)
865-
return -EINVAL;
866-
867-
if (iops > THROTL_IOPS_MAX)
862+
if (temp > THROTL_IOPS_MAX)
868863
return -EINVAL;
869864

870865
newpn->plid = plid;
871866
newpn->fileid = fileid;
872-
newpn->val.iops = (unsigned int)iops;
867+
newpn->val.iops = (unsigned int)temp;
873868
break;
874869
}
875870
break;

block/blk-core.c

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1167,7 +1167,7 @@ static bool bio_attempt_front_merge(struct request_queue *q,
11671167
* true if merge was successful, otherwise false.
11681168
*/
11691169
static bool attempt_plug_merge(struct task_struct *tsk, struct request_queue *q,
1170-
struct bio *bio)
1170+
struct bio *bio, unsigned int *request_count)
11711171
{
11721172
struct blk_plug *plug;
11731173
struct request *rq;
@@ -1176,10 +1176,13 @@ static bool attempt_plug_merge(struct task_struct *tsk, struct request_queue *q,
11761176
plug = tsk->plug;
11771177
if (!plug)
11781178
goto out;
1179+
*request_count = 0;
11791180

11801181
list_for_each_entry_reverse(rq, &plug->list, queuelist) {
11811182
int el_ret;
11821183

1184+
(*request_count)++;
1185+
11831186
if (rq->q != q)
11841187
continue;
11851188

@@ -1219,6 +1222,7 @@ static int __make_request(struct request_queue *q, struct bio *bio)
12191222
struct blk_plug *plug;
12201223
int el_ret, rw_flags, where = ELEVATOR_INSERT_SORT;
12211224
struct request *req;
1225+
unsigned int request_count = 0;
12221226

12231227
/*
12241228
* low level driver can indicate that it wants pages above a
@@ -1237,7 +1241,7 @@ static int __make_request(struct request_queue *q, struct bio *bio)
12371241
* Check if we can merge with the plugged list before grabbing
12381242
* any locks.
12391243
*/
1240-
if (attempt_plug_merge(current, q, bio))
1244+
if (attempt_plug_merge(current, q, bio, &request_count))
12411245
goto out;
12421246

12431247
spin_lock_irq(q->queue_lock);
@@ -1302,11 +1306,10 @@ static int __make_request(struct request_queue *q, struct bio *bio)
13021306
if (__rq->q != q)
13031307
plug->should_sort = 1;
13041308
}
1309+
if (request_count >= BLK_MAX_REQUEST_COUNT)
1310+
blk_flush_plug_list(plug, false);
13051311
list_add_tail(&req->queuelist, &plug->list);
1306-
plug->count++;
13071312
drive_stat_acct(req, 1);
1308-
if (plug->count >= BLK_MAX_REQUEST_COUNT)
1309-
blk_flush_plug_list(plug, false);
13101313
} else {
13111314
spin_lock_irq(q->queue_lock);
13121315
add_acct_request(q, req, where);
@@ -2634,7 +2637,6 @@ void blk_start_plug(struct blk_plug *plug)
26342637
INIT_LIST_HEAD(&plug->list);
26352638
INIT_LIST_HEAD(&plug->cb_list);
26362639
plug->should_sort = 0;
2637-
plug->count = 0;
26382640

26392641
/*
26402642
* If this is a nested plug, don't actually assign it. It will be
@@ -2718,7 +2720,6 @@ void blk_flush_plug_list(struct blk_plug *plug, bool from_schedule)
27182720
return;
27192721

27202722
list_splice_init(&plug->list, &list);
2721-
plug->count = 0;
27222723

27232724
if (plug->should_sort) {
27242725
list_sort(NULL, &list, plug_rq_cmp);

block/blk-softirq.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ void __blk_complete_request(struct request *req)
115115
/*
116116
* Select completion CPU
117117
*/
118-
if (test_bit(QUEUE_FLAG_SAME_COMP, &q->queue_flags) && req->cpu != -1) {
118+
if (req->cpu != -1) {
119119
ccpu = req->cpu;
120120
if (!test_bit(QUEUE_FLAG_SAME_FORCE, &q->queue_flags)) {
121121
ccpu = blk_cpu_to_group(ccpu);

block/blk-sysfs.c

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -258,11 +258,13 @@ queue_rq_affinity_store(struct request_queue *q, const char *page, size_t count)
258258

259259
ret = queue_var_store(&val, page, count);
260260
spin_lock_irq(q->queue_lock);
261-
if (val) {
261+
if (val == 2) {
262262
queue_flag_set(QUEUE_FLAG_SAME_COMP, q);
263-
if (val == 2)
264-
queue_flag_set(QUEUE_FLAG_SAME_FORCE, q);
265-
} else {
263+
queue_flag_set(QUEUE_FLAG_SAME_FORCE, q);
264+
} else if (val == 1) {
265+
queue_flag_set(QUEUE_FLAG_SAME_COMP, q);
266+
queue_flag_clear(QUEUE_FLAG_SAME_FORCE, q);
267+
} else if (val == 0) {
266268
queue_flag_clear(QUEUE_FLAG_SAME_COMP, q);
267269
queue_flag_clear(QUEUE_FLAG_SAME_FORCE, q);
268270
}

block/cfq-iosched.c

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -130,8 +130,8 @@ struct cfq_queue {
130130
unsigned long slice_end;
131131
long slice_resid;
132132

133-
/* pending metadata requests */
134-
int meta_pending;
133+
/* pending priority requests */
134+
int prio_pending;
135135
/* number of requests that are on the dispatch list or inside driver */
136136
int dispatched;
137137

@@ -684,8 +684,8 @@ cfq_choose_req(struct cfq_data *cfqd, struct request *rq1, struct request *rq2,
684684
if (rq_is_sync(rq1) != rq_is_sync(rq2))
685685
return rq_is_sync(rq1) ? rq1 : rq2;
686686

687-
if ((rq1->cmd_flags ^ rq2->cmd_flags) & REQ_META)
688-
return rq1->cmd_flags & REQ_META ? rq1 : rq2;
687+
if ((rq1->cmd_flags ^ rq2->cmd_flags) & REQ_PRIO)
688+
return rq1->cmd_flags & REQ_PRIO ? rq1 : rq2;
689689

690690
s1 = blk_rq_pos(rq1);
691691
s2 = blk_rq_pos(rq2);
@@ -1612,9 +1612,9 @@ static void cfq_remove_request(struct request *rq)
16121612
cfqq->cfqd->rq_queued--;
16131613
cfq_blkiocg_update_io_remove_stats(&(RQ_CFQG(rq))->blkg,
16141614
rq_data_dir(rq), rq_is_sync(rq));
1615-
if (rq->cmd_flags & REQ_META) {
1616-
WARN_ON(!cfqq->meta_pending);
1617-
cfqq->meta_pending--;
1615+
if (rq->cmd_flags & REQ_PRIO) {
1616+
WARN_ON(!cfqq->prio_pending);
1617+
cfqq->prio_pending--;
16181618
}
16191619
}
16201620

@@ -3372,7 +3372,7 @@ cfq_should_preempt(struct cfq_data *cfqd, struct cfq_queue *new_cfqq,
33723372
* So both queues are sync. Let the new request get disk time if
33733373
* it's a metadata request and the current queue is doing regular IO.
33743374
*/
3375-
if ((rq->cmd_flags & REQ_META) && !cfqq->meta_pending)
3375+
if ((rq->cmd_flags & REQ_PRIO) && !cfqq->prio_pending)
33763376
return true;
33773377

33783378
/*
@@ -3439,8 +3439,8 @@ cfq_rq_enqueued(struct cfq_data *cfqd, struct cfq_queue *cfqq,
34393439
struct cfq_io_context *cic = RQ_CIC(rq);
34403440

34413441
cfqd->rq_queued++;
3442-
if (rq->cmd_flags & REQ_META)
3443-
cfqq->meta_pending++;
3442+
if (rq->cmd_flags & REQ_PRIO)
3443+
cfqq->prio_pending++;
34443444

34453445
cfq_update_io_thinktime(cfqd, cfqq, cic);
34463446
cfq_update_io_seektime(cfqd, cfqq, rq);

drivers/block/floppy.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4250,7 +4250,7 @@ static int __init floppy_init(void)
42504250
use_virtual_dma = can_use_virtual_dma & 1;
42514251
fdc_state[0].address = FDC1;
42524252
if (fdc_state[0].address == -1) {
4253-
del_timer(&fd_timeout);
4253+
del_timer_sync(&fd_timeout);
42544254
err = -ENODEV;
42554255
goto out_unreg_region;
42564256
}
@@ -4261,7 +4261,7 @@ static int __init floppy_init(void)
42614261
fdc = 0; /* reset fdc in case of unexpected interrupt */
42624262
err = floppy_grab_irq_and_dma();
42634263
if (err) {
4264-
del_timer(&fd_timeout);
4264+
del_timer_sync(&fd_timeout);
42654265
err = -EBUSY;
42664266
goto out_unreg_region;
42674267
}
@@ -4318,7 +4318,7 @@ static int __init floppy_init(void)
43184318
user_reset_fdc(-1, FD_RESET_ALWAYS, false);
43194319
}
43204320
fdc = 0;
4321-
del_timer(&fd_timeout);
4321+
del_timer_sync(&fd_timeout);
43224322
current_drive = 0;
43234323
initialized = true;
43244324
if (have_no_fdc) {
@@ -4368,7 +4368,7 @@ static int __init floppy_init(void)
43684368
unregister_blkdev(FLOPPY_MAJOR, "fd");
43694369
out_put_disk:
43704370
while (dr--) {
4371-
del_timer(&motor_off_timer[dr]);
4371+
del_timer_sync(&motor_off_timer[dr]);
43724372
if (disks[dr]->queue)
43734373
blk_cleanup_queue(disks[dr]->queue);
43744374
put_disk(disks[dr]);

drivers/block/xen-blkback/common.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@
4646

4747
#define DRV_PFX "xen-blkback:"
4848
#define DPRINTK(fmt, args...) \
49-
pr_debug(DRV_PFX "(%s:%d) " fmt ".\n", \
49+
pr_debug(DRV_PFX "(%s:%d) " fmt ".\n", \
5050
__func__, __LINE__, ##args)
5151

5252

drivers/block/xen-blkback/xenbus.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -590,7 +590,7 @@ static void frontend_changed(struct xenbus_device *dev,
590590

591591
/*
592592
* Enforce precondition before potential leak point.
593-
* blkif_disconnect() is idempotent.
593+
* xen_blkif_disconnect() is idempotent.
594594
*/
595595
xen_blkif_disconnect(be->blkif);
596596

@@ -601,17 +601,17 @@ static void frontend_changed(struct xenbus_device *dev,
601601
break;
602602

603603
case XenbusStateClosing:
604-
xen_blkif_disconnect(be->blkif);
605604
xenbus_switch_state(dev, XenbusStateClosing);
606605
break;
607606

608607
case XenbusStateClosed:
608+
xen_blkif_disconnect(be->blkif);
609609
xenbus_switch_state(dev, XenbusStateClosed);
610610
if (xenbus_dev_is_online(dev))
611611
break;
612612
/* fall through if not online */
613613
case XenbusStateUnknown:
614-
/* implies blkif_disconnect() via blkback_remove() */
614+
/* implies xen_blkif_disconnect() via xen_blkbk_remove() */
615615
device_unregister(&dev->dev);
616616
break;
617617

drivers/mmc/card/block.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -926,6 +926,9 @@ static void mmc_blk_rw_rq_prep(struct mmc_queue_req *mqrq,
926926
/*
927927
* Reliable writes are used to implement Forced Unit Access and
928928
* REQ_META accesses, and are supported only on MMCs.
929+
*
930+
* XXX: this really needs a good explanation of why REQ_META
931+
* is treated special.
929932
*/
930933
bool do_rel_wr = ((req->cmd_flags & REQ_FUA) ||
931934
(req->cmd_flags & REQ_META)) &&

fs/ext3/inode.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1134,7 +1134,7 @@ struct buffer_head *ext3_bread(handle_t *handle, struct inode *inode,
11341134
return bh;
11351135
if (buffer_uptodate(bh))
11361136
return bh;
1137-
ll_rw_block(READ_META, 1, &bh);
1137+
ll_rw_block(READ | REQ_META | REQ_PRIO, 1, &bh);
11381138
wait_on_buffer(bh);
11391139
if (buffer_uptodate(bh))
11401140
return bh;
@@ -2807,7 +2807,7 @@ static int __ext3_get_inode_loc(struct inode *inode,
28072807
trace_ext3_load_inode(inode);
28082808
get_bh(bh);
28092809
bh->b_end_io = end_buffer_read_sync;
2810-
submit_bh(READ_META, bh);
2810+
submit_bh(READ | REQ_META | REQ_PRIO, bh);
28112811
wait_on_buffer(bh);
28122812
if (!buffer_uptodate(bh)) {
28132813
ext3_error(inode->i_sb, "ext3_get_inode_loc",

fs/ext3/namei.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -922,7 +922,8 @@ static struct buffer_head *ext3_find_entry(struct inode *dir,
922922
bh = ext3_getblk(NULL, dir, b++, 0, &err);
923923
bh_use[ra_max] = bh;
924924
if (bh)
925-
ll_rw_block(READ_META, 1, &bh);
925+
ll_rw_block(READ | REQ_META | REQ_PRIO,
926+
1, &bh);
926927
}
927928
}
928929
if ((bh = bh_use[ra_ptr++]) == NULL)

fs/ext4/inode.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -647,7 +647,7 @@ struct buffer_head *ext4_bread(handle_t *handle, struct inode *inode,
647647
return bh;
648648
if (buffer_uptodate(bh))
649649
return bh;
650-
ll_rw_block(READ_META, 1, &bh);
650+
ll_rw_block(READ | REQ_META | REQ_PRIO, 1, &bh);
651651
wait_on_buffer(bh);
652652
if (buffer_uptodate(bh))
653653
return bh;
@@ -3298,7 +3298,7 @@ static int __ext4_get_inode_loc(struct inode *inode,
32983298
trace_ext4_load_inode(inode);
32993299
get_bh(bh);
33003300
bh->b_end_io = end_buffer_read_sync;
3301-
submit_bh(READ_META, bh);
3301+
submit_bh(READ | REQ_META | REQ_PRIO, bh);
33023302
wait_on_buffer(bh);
33033303
if (!buffer_uptodate(bh)) {
33043304
EXT4_ERROR_INODE_BLOCK(inode, block,

fs/ext4/namei.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -922,7 +922,8 @@ static struct buffer_head * ext4_find_entry (struct inode *dir,
922922
bh = ext4_getblk(NULL, dir, b++, 0, &err);
923923
bh_use[ra_max] = bh;
924924
if (bh)
925-
ll_rw_block(READ_META, 1, &bh);
925+
ll_rw_block(READ | REQ_META | REQ_PRIO,
926+
1, &bh);
926927
}
927928
}
928929
if ((bh = bh_use[ra_ptr++]) == NULL)

fs/gfs2/log.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -624,9 +624,9 @@ static void log_write_header(struct gfs2_sbd *sdp, u32 flags, int pull)
624624
bh->b_end_io = end_buffer_write_sync;
625625
get_bh(bh);
626626
if (test_bit(SDF_NOBARRIERS, &sdp->sd_flags))
627-
submit_bh(WRITE_SYNC | REQ_META, bh);
627+
submit_bh(WRITE_SYNC | REQ_META | REQ_PRIO, bh);
628628
else
629-
submit_bh(WRITE_FLUSH_FUA | REQ_META, bh);
629+
submit_bh(WRITE_FLUSH_FUA | REQ_META | REQ_PRIO, bh);
630630
wait_on_buffer(bh);
631631

632632
if (!buffer_uptodate(bh))

0 commit comments

Comments
 (0)