Skip to content

Commit ffaa60d

Browse files
committed
Merge branch 'for-linus' of git://git.kernel.dk/linux-2.6-block
* 'for-linus' of git://git.kernel.dk/linux-2.6-block: cciss: Make cciss_seq_show handle holes in the h->drv[] array cfq-iosched: split seeky coop queues after one slice
2 parents efa82ba + 531c2dc commit ffaa60d

File tree

2 files changed

+19
-33
lines changed

2 files changed

+19
-33
lines changed

block/cfq-iosched.c

Lines changed: 16 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -42,16 +42,13 @@ static const int cfq_hist_divisor = 4;
4242
*/
4343
#define CFQ_MIN_TT (2)
4444

45-
/*
46-
* Allow merged cfqqs to perform this amount of seeky I/O before
47-
* deciding to break the queues up again.
48-
*/
49-
#define CFQQ_COOP_TOUT (HZ)
50-
5145
#define CFQ_SLICE_SCALE (5)
5246
#define CFQ_HW_QUEUE_MIN (5)
5347
#define CFQ_SERVICE_SHIFT 12
5448

49+
#define CFQQ_SEEK_THR 8 * 1024
50+
#define CFQQ_SEEKY(cfqq) ((cfqq)->seek_mean > CFQQ_SEEK_THR)
51+
5552
#define RQ_CIC(rq) \
5653
((struct cfq_io_context *) (rq)->elevator_private)
5754
#define RQ_CFQQ(rq) (struct cfq_queue *) ((rq)->elevator_private2)
@@ -137,7 +134,6 @@ struct cfq_queue {
137134
u64 seek_total;
138135
sector_t seek_mean;
139136
sector_t last_request_pos;
140-
unsigned long seeky_start;
141137

142138
pid_t pid;
143139

@@ -314,6 +310,7 @@ enum cfqq_state_flags {
314310
CFQ_CFQQ_FLAG_slice_new, /* no requests dispatched in slice */
315311
CFQ_CFQQ_FLAG_sync, /* synchronous queue */
316312
CFQ_CFQQ_FLAG_coop, /* cfqq is shared */
313+
CFQ_CFQQ_FLAG_split_coop, /* shared cfqq will be splitted */
317314
CFQ_CFQQ_FLAG_deep, /* sync cfqq experienced large depth */
318315
CFQ_CFQQ_FLAG_wait_busy, /* Waiting for next request */
319316
};
@@ -342,6 +339,7 @@ CFQ_CFQQ_FNS(prio_changed);
342339
CFQ_CFQQ_FNS(slice_new);
343340
CFQ_CFQQ_FNS(sync);
344341
CFQ_CFQQ_FNS(coop);
342+
CFQ_CFQQ_FNS(split_coop);
345343
CFQ_CFQQ_FNS(deep);
346344
CFQ_CFQQ_FNS(wait_busy);
347345
#undef CFQ_CFQQ_FNS
@@ -1565,6 +1563,15 @@ __cfq_slice_expired(struct cfq_data *cfqd, struct cfq_queue *cfqq,
15651563
cfq_clear_cfqq_wait_request(cfqq);
15661564
cfq_clear_cfqq_wait_busy(cfqq);
15671565

1566+
/*
1567+
* If this cfqq is shared between multiple processes, check to
1568+
* make sure that those processes are still issuing I/Os within
1569+
* the mean seek distance. If not, it may be time to break the
1570+
* queues apart again.
1571+
*/
1572+
if (cfq_cfqq_coop(cfqq) && CFQQ_SEEKY(cfqq))
1573+
cfq_mark_cfqq_split_coop(cfqq);
1574+
15681575
/*
15691576
* store what was left of this slice, if the queue idled/timed out
15701577
*/
@@ -1663,9 +1670,6 @@ static inline sector_t cfq_dist_from_last(struct cfq_data *cfqd,
16631670
return cfqd->last_position - blk_rq_pos(rq);
16641671
}
16651672

1666-
#define CFQQ_SEEK_THR 8 * 1024
1667-
#define CFQQ_SEEKY(cfqq) ((cfqq)->seek_mean > CFQQ_SEEK_THR)
1668-
16691673
static inline int cfq_rq_close(struct cfq_data *cfqd, struct cfq_queue *cfqq,
16701674
struct request *rq, bool for_preempt)
16711675
{
@@ -3000,19 +3004,6 @@ cfq_update_io_seektime(struct cfq_data *cfqd, struct cfq_queue *cfqq,
30003004
total = cfqq->seek_total + (cfqq->seek_samples/2);
30013005
do_div(total, cfqq->seek_samples);
30023006
cfqq->seek_mean = (sector_t)total;
3003-
3004-
/*
3005-
* If this cfqq is shared between multiple processes, check to
3006-
* make sure that those processes are still issuing I/Os within
3007-
* the mean seek distance. If not, it may be time to break the
3008-
* queues apart again.
3009-
*/
3010-
if (cfq_cfqq_coop(cfqq)) {
3011-
if (CFQQ_SEEKY(cfqq) && !cfqq->seeky_start)
3012-
cfqq->seeky_start = jiffies;
3013-
else if (!CFQQ_SEEKY(cfqq))
3014-
cfqq->seeky_start = 0;
3015-
}
30163007
}
30173008

30183009
/*
@@ -3453,14 +3444,6 @@ cfq_merge_cfqqs(struct cfq_data *cfqd, struct cfq_io_context *cic,
34533444
return cic_to_cfqq(cic, 1);
34543445
}
34553446

3456-
static int should_split_cfqq(struct cfq_queue *cfqq)
3457-
{
3458-
if (cfqq->seeky_start &&
3459-
time_after(jiffies, cfqq->seeky_start + CFQQ_COOP_TOUT))
3460-
return 1;
3461-
return 0;
3462-
}
3463-
34643447
/*
34653448
* Returns NULL if a new cfqq should be allocated, or the old cfqq if this
34663449
* was the last process referring to said cfqq.
@@ -3469,9 +3452,9 @@ static struct cfq_queue *
34693452
split_cfqq(struct cfq_io_context *cic, struct cfq_queue *cfqq)
34703453
{
34713454
if (cfqq_process_refs(cfqq) == 1) {
3472-
cfqq->seeky_start = 0;
34733455
cfqq->pid = current->pid;
34743456
cfq_clear_cfqq_coop(cfqq);
3457+
cfq_clear_cfqq_split_coop(cfqq);
34753458
return cfqq;
34763459
}
34773460

@@ -3510,7 +3493,7 @@ cfq_set_request(struct request_queue *q, struct request *rq, gfp_t gfp_mask)
35103493
/*
35113494
* If the queue was seeky for too long, break it apart.
35123495
*/
3513-
if (cfq_cfqq_coop(cfqq) && should_split_cfqq(cfqq)) {
3496+
if (cfq_cfqq_coop(cfqq) && cfq_cfqq_split_coop(cfqq)) {
35143497
cfq_log_cfqq(cfqd, cfqq, "breaking apart cfqq");
35153498
cfqq = split_cfqq(cic, cfqq);
35163499
if (!cfqq)

drivers/block/cciss.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -337,6 +337,9 @@ static int cciss_seq_show(struct seq_file *seq, void *v)
337337
if (*pos > h->highest_lun)
338338
return 0;
339339

340+
if (drv == NULL) /* it's possible for h->drv[] to have holes. */
341+
return 0;
342+
340343
if (drv->heads == 0)
341344
return 0;
342345

0 commit comments

Comments
 (0)