Skip to content

Commit c53dbf5

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: block: remove __generic_unplug_device() from exports block: move q->unplug_work initialization blktrace: pass zfcp driver data blktrace: add support for driver data block: fix current kernel-doc warnings block: only call ->request_fn when the queue is not stopped block: simplify string handling in elv_iosched_store() block: fix kernel-doc for blk_alloc_devt() block: fix nr_phys_segments miscalculation bug block: add partition attribute for partition number block: add BIG FAT WARNING to CONFIG_DEBUG_BLOCK_EXT_DEVT softirq: Add support for triggering softirq work on softirqs.
2 parents b73b636 + f73e2d1 commit c53dbf5

File tree

20 files changed

+305
-27
lines changed

20 files changed

+305
-27
lines changed

block/blk-core.c

Lines changed: 21 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -257,7 +257,6 @@ void __generic_unplug_device(struct request_queue *q)
257257

258258
q->request_fn(q);
259259
}
260-
EXPORT_SYMBOL(__generic_unplug_device);
261260

262261
/**
263262
* generic_unplug_device - fire a request queue
@@ -325,6 +324,9 @@ EXPORT_SYMBOL(blk_unplug);
325324

326325
static void blk_invoke_request_fn(struct request_queue *q)
327326
{
327+
if (unlikely(blk_queue_stopped(q)))
328+
return;
329+
328330
/*
329331
* one level of recursion is ok and is much faster than kicking
330332
* the unplug handling
@@ -399,8 +401,13 @@ void blk_sync_queue(struct request_queue *q)
399401
EXPORT_SYMBOL(blk_sync_queue);
400402

401403
/**
402-
* blk_run_queue - run a single device queue
404+
* __blk_run_queue - run a single device queue
403405
* @q: The queue to run
406+
*
407+
* Description:
408+
* See @blk_run_queue. This variant must be called with the queue lock
409+
* held and interrupts disabled.
410+
*
404411
*/
405412
void __blk_run_queue(struct request_queue *q)
406413
{
@@ -418,6 +425,12 @@ EXPORT_SYMBOL(__blk_run_queue);
418425
/**
419426
* blk_run_queue - run a single device queue
420427
* @q: The queue to run
428+
*
429+
* Description:
430+
* Invoke request handling on this queue, if it has pending work to do.
431+
* May be used to restart queueing when a request has completed. Also
432+
* See @blk_start_queueing.
433+
*
421434
*/
422435
void blk_run_queue(struct request_queue *q)
423436
{
@@ -501,6 +514,7 @@ struct request_queue *blk_alloc_queue_node(gfp_t gfp_mask, int node_id)
501514
init_timer(&q->unplug_timer);
502515
setup_timer(&q->timeout, blk_rq_timed_out_timer, (unsigned long) q);
503516
INIT_LIST_HEAD(&q->timeout_list);
517+
INIT_WORK(&q->unplug_work, blk_unplug_work);
504518

505519
kobject_init(&q->kobj, &blk_queue_ktype);
506520

@@ -884,7 +898,8 @@ EXPORT_SYMBOL(blk_get_request);
884898
*
885899
* This is basically a helper to remove the need to know whether a queue
886900
* is plugged or not if someone just wants to initiate dispatch of requests
887-
* for this queue.
901+
* for this queue. Should be used to start queueing on a device outside
902+
* of ->request_fn() context. Also see @blk_run_queue.
888903
*
889904
* The queue lock must be held with interrupts disabled.
890905
*/
@@ -1003,8 +1018,9 @@ static void part_round_stats_single(int cpu, struct hd_struct *part,
10031018
}
10041019

10051020
/**
1006-
* part_round_stats() - Round off the performance stats on a struct
1007-
* disk_stats.
1021+
* part_round_stats() - Round off the performance stats on a struct disk_stats.
1022+
* @cpu: cpu number for stats access
1023+
* @part: target partition
10081024
*
10091025
* The average IO queue length and utilisation statistics are maintained
10101026
* by observing the current state of the queue length and the amount of

block/blk-merge.c

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -77,12 +77,20 @@ void blk_recalc_rq_segments(struct request *rq)
7777
continue;
7878
}
7979
new_segment:
80+
if (nr_phys_segs == 1 && seg_size > rq->bio->bi_seg_front_size)
81+
rq->bio->bi_seg_front_size = seg_size;
82+
8083
nr_phys_segs++;
8184
bvprv = bv;
8285
seg_size = bv->bv_len;
8386
highprv = high;
8487
}
8588

89+
if (nr_phys_segs == 1 && seg_size > rq->bio->bi_seg_front_size)
90+
rq->bio->bi_seg_front_size = seg_size;
91+
if (seg_size > rq->biotail->bi_seg_back_size)
92+
rq->biotail->bi_seg_back_size = seg_size;
93+
8694
rq->nr_phys_segments = nr_phys_segs;
8795
}
8896

@@ -106,7 +114,8 @@ static int blk_phys_contig_segment(struct request_queue *q, struct bio *bio,
106114
if (!test_bit(QUEUE_FLAG_CLUSTER, &q->queue_flags))
107115
return 0;
108116

109-
if (bio->bi_size + nxt->bi_size > q->max_segment_size)
117+
if (bio->bi_seg_back_size + nxt->bi_seg_front_size >
118+
q->max_segment_size)
110119
return 0;
111120

112121
if (!bio_has_data(bio))
@@ -309,6 +318,8 @@ static int ll_merge_requests_fn(struct request_queue *q, struct request *req,
309318
struct request *next)
310319
{
311320
int total_phys_segments;
321+
unsigned int seg_size =
322+
req->biotail->bi_seg_back_size + next->bio->bi_seg_front_size;
312323

313324
/*
314325
* First check if the either of the requests are re-queued
@@ -324,8 +335,13 @@ static int ll_merge_requests_fn(struct request_queue *q, struct request *req,
324335
return 0;
325336

326337
total_phys_segments = req->nr_phys_segments + next->nr_phys_segments;
327-
if (blk_phys_contig_segment(q, req->biotail, next->bio))
338+
if (blk_phys_contig_segment(q, req->biotail, next->bio)) {
339+
if (req->nr_phys_segments == 1)
340+
req->bio->bi_seg_front_size = seg_size;
341+
if (next->nr_phys_segments == 1)
342+
next->biotail->bi_seg_back_size = seg_size;
328343
total_phys_segments--;
344+
}
329345

330346
if (total_phys_segments > q->max_phys_segments)
331347
return 0;

block/blk-settings.c

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -141,8 +141,6 @@ void blk_queue_make_request(struct request_queue *q, make_request_fn *mfn)
141141
if (q->unplug_delay == 0)
142142
q->unplug_delay = 1;
143143

144-
INIT_WORK(&q->unplug_work, blk_unplug_work);
145-
146144
q->unplug_timer.function = blk_unplug_timeout;
147145
q->unplug_timer.data = (unsigned long)q;
148146

block/blk.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ void blk_unplug_timeout(unsigned long data);
2020
void blk_rq_timed_out_timer(unsigned long data);
2121
void blk_delete_timer(struct request *);
2222
void blk_add_timer(struct request *);
23+
void __generic_unplug_device(struct request_queue *);
2324

2425
/*
2526
* Internal atomic flags for request handling

block/elevator.c

Lines changed: 5 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -612,7 +612,7 @@ void elv_insert(struct request_queue *q, struct request *rq, int where)
612612
* processing.
613613
*/
614614
blk_remove_plug(q);
615-
q->request_fn(q);
615+
blk_start_queueing(q);
616616
break;
617617

618618
case ELEVATOR_INSERT_SORT:
@@ -950,7 +950,7 @@ void elv_completed_request(struct request_queue *q, struct request *rq)
950950
blk_ordered_cur_seq(q) == QUEUE_ORDSEQ_DRAIN &&
951951
blk_ordered_req_seq(first_rq) > QUEUE_ORDSEQ_DRAIN) {
952952
blk_ordered_complete_seq(q, QUEUE_ORDSEQ_DRAIN, 0);
953-
q->request_fn(q);
953+
blk_start_queueing(q);
954954
}
955955
}
956956
}
@@ -1109,8 +1109,7 @@ static int elevator_switch(struct request_queue *q, struct elevator_type *new_e)
11091109
elv_drain_elevator(q);
11101110

11111111
while (q->rq.elvpriv) {
1112-
blk_remove_plug(q);
1113-
q->request_fn(q);
1112+
blk_start_queueing(q);
11141113
spin_unlock_irq(q->queue_lock);
11151114
msleep(10);
11161115
spin_lock_irq(q->queue_lock);
@@ -1166,15 +1165,10 @@ ssize_t elv_iosched_store(struct request_queue *q, const char *name,
11661165
size_t count)
11671166
{
11681167
char elevator_name[ELV_NAME_MAX];
1169-
size_t len;
11701168
struct elevator_type *e;
11711169

1172-
elevator_name[sizeof(elevator_name) - 1] = '\0';
1173-
strncpy(elevator_name, name, sizeof(elevator_name) - 1);
1174-
len = strlen(elevator_name);
1175-
1176-
if (len && elevator_name[len - 1] == '\n')
1177-
elevator_name[len - 1] = '\0';
1170+
strlcpy(elevator_name, name, sizeof(elevator_name));
1171+
strstrip(elevator_name);
11781172

11791173
e = elevator_get(elevator_name);
11801174
if (!e) {

block/genhd.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -358,7 +358,6 @@ static int blk_mangle_minor(int minor)
358358
/**
359359
* blk_alloc_devt - allocate a dev_t for a partition
360360
* @part: partition to allocate dev_t for
361-
* @gfp_mask: memory allocation flag
362361
* @devt: out parameter for resulting dev_t
363362
*
364363
* Allocate a dev_t for block device.
@@ -535,7 +534,7 @@ void unlink_gendisk(struct gendisk *disk)
535534
/**
536535
* get_gendisk - get partitioning information for a given device
537536
* @devt: device to get partitioning information for
538-
* @part: returned partition index
537+
* @partno: returned partition index
539538
*
540539
* This function gets the structure containing partitioning
541540
* information for the given device @devt.

drivers/ide/ide-io.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1493,8 +1493,8 @@ void ide_do_drive_cmd(ide_drive_t *drive, struct request *rq)
14931493

14941494
spin_lock_irqsave(&ide_lock, flags);
14951495
hwgroup->rq = NULL;
1496-
__elv_add_request(drive->queue, rq, ELEVATOR_INSERT_FRONT, 1);
1497-
__generic_unplug_device(drive->queue);
1496+
__elv_add_request(drive->queue, rq, ELEVATOR_INSERT_FRONT, 0);
1497+
blk_start_queueing(drive->queue);
14981498
spin_unlock_irqrestore(&ide_lock, flags);
14991499
}
15001500

drivers/s390/scsi/zfcp_def.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -583,6 +583,8 @@ struct zfcp_fsf_req {
583583
unsigned long long issued; /* request sent time (STCK) */
584584
struct zfcp_unit *unit;
585585
void (*handler)(struct zfcp_fsf_req *);
586+
u16 qdio_outb_usage;/* usage of outbound queue */
587+
u16 qdio_inb_usage; /* usage of inbound queue */
586588
};
587589

588590
/* driver data */

drivers/s390/scsi/zfcp_fsf.c

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
* Copyright IBM Corporation 2002, 2008
77
*/
88

9+
#include <linux/blktrace_api.h>
910
#include "zfcp_ext.h"
1011

1112
static void zfcp_fsf_request_timeout_handler(unsigned long data)
@@ -777,6 +778,7 @@ static int zfcp_fsf_req_send(struct zfcp_fsf_req *req)
777778
list_add_tail(&req->list, &adapter->req_list[idx]);
778779
spin_unlock(&adapter->req_list_lock);
779780

781+
req->qdio_outb_usage = atomic_read(&req_q->count);
780782
req->issued = get_clock();
781783
if (zfcp_qdio_send(req)) {
782784
/* Queues are down..... */
@@ -2082,6 +2084,36 @@ static void zfcp_fsf_req_latency(struct zfcp_fsf_req *req)
20822084
spin_unlock_irqrestore(&unit->latencies.lock, flags);
20832085
}
20842086

2087+
#ifdef CONFIG_BLK_DEV_IO_TRACE
2088+
static void zfcp_fsf_trace_latency(struct zfcp_fsf_req *fsf_req)
2089+
{
2090+
struct fsf_qual_latency_info *lat_inf;
2091+
struct scsi_cmnd *scsi_cmnd = (struct scsi_cmnd *)fsf_req->data;
2092+
struct request *req = scsi_cmnd->request;
2093+
struct zfcp_blk_drv_data trace;
2094+
int ticks = fsf_req->adapter->timer_ticks;
2095+
2096+
trace.flags = 0;
2097+
trace.magic = ZFCP_BLK_DRV_DATA_MAGIC;
2098+
if (fsf_req->adapter->adapter_features & FSF_FEATURE_MEASUREMENT_DATA) {
2099+
trace.flags |= ZFCP_BLK_LAT_VALID;
2100+
lat_inf = &fsf_req->qtcb->prefix.prot_status_qual.latency_info;
2101+
trace.channel_lat = lat_inf->channel_lat * ticks;
2102+
trace.fabric_lat = lat_inf->fabric_lat * ticks;
2103+
}
2104+
if (fsf_req->status & ZFCP_STATUS_FSFREQ_ERROR)
2105+
trace.flags |= ZFCP_BLK_REQ_ERROR;
2106+
trace.inb_usage = fsf_req->qdio_inb_usage;
2107+
trace.outb_usage = fsf_req->qdio_outb_usage;
2108+
2109+
blk_add_driver_data(req->q, req, &trace, sizeof(trace));
2110+
}
2111+
#else
2112+
static inline void zfcp_fsf_trace_latency(struct zfcp_fsf_req *fsf_req)
2113+
{
2114+
}
2115+
#endif
2116+
20852117
static void zfcp_fsf_send_fcp_command_task_handler(struct zfcp_fsf_req *req)
20862118
{
20872119
struct scsi_cmnd *scpnt = req->data;
@@ -2114,6 +2146,8 @@ static void zfcp_fsf_send_fcp_command_task_handler(struct zfcp_fsf_req *req)
21142146
if (req->adapter->adapter_features & FSF_FEATURE_MEASUREMENT_DATA)
21152147
zfcp_fsf_req_latency(req);
21162148

2149+
zfcp_fsf_trace_latency(req);
2150+
21172151
if (unlikely(fcp_rsp_iu->validity.bits.fcp_rsp_len_valid)) {
21182152
if (fcp_rsp_info[3] == RSP_CODE_GOOD)
21192153
set_host_byte(scpnt, DID_OK);

drivers/s390/scsi/zfcp_fsf.h

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -439,4 +439,16 @@ struct fsf_qtcb {
439439
u8 log[FSF_QTCB_LOG_SIZE];
440440
} __attribute__ ((packed));
441441

442+
struct zfcp_blk_drv_data {
443+
#define ZFCP_BLK_DRV_DATA_MAGIC 0x1
444+
u32 magic;
445+
#define ZFCP_BLK_LAT_VALID 0x1
446+
#define ZFCP_BLK_REQ_ERROR 0x2
447+
u16 flags;
448+
u8 inb_usage;
449+
u8 outb_usage;
450+
u64 channel_lat;
451+
u64 fabric_lat;
452+
} __attribute__ ((packed));
453+
442454
#endif /* FSF_H */

drivers/s390/scsi/zfcp_qdio.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -115,6 +115,7 @@ static void zfcp_qdio_reqid_check(struct zfcp_adapter *adapter,
115115
spin_unlock_irqrestore(&adapter->req_list_lock, flags);
116116

117117
fsf_req->sbal_response = sbal_idx;
118+
fsf_req->qdio_inb_usage = atomic_read(&adapter->resp_q.count);
118119
zfcp_fsf_req_complete(fsf_req);
119120
}
120121

fs/block_dev.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1262,7 +1262,7 @@ EXPORT_SYMBOL(ioctl_by_bdev);
12621262

12631263
/**
12641264
* lookup_bdev - lookup a struct block_device by name
1265-
* @pathname: special file representing the block device
1265+
* @path: special file representing the block device
12661266
*
12671267
* Get a reference to the blockdevice at @pathname in the current
12681268
* namespace if possible and return it. Return ERR_PTR(error)

fs/partitions/check.c

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -195,6 +195,14 @@ check_partition(struct gendisk *hd, struct block_device *bdev)
195195
return ERR_PTR(res);
196196
}
197197

198+
static ssize_t part_partition_show(struct device *dev,
199+
struct device_attribute *attr, char *buf)
200+
{
201+
struct hd_struct *p = dev_to_part(dev);
202+
203+
return sprintf(buf, "%d\n", p->partno);
204+
}
205+
198206
static ssize_t part_start_show(struct device *dev,
199207
struct device_attribute *attr, char *buf)
200208
{
@@ -260,6 +268,7 @@ ssize_t part_fail_store(struct device *dev,
260268
}
261269
#endif
262270

271+
static DEVICE_ATTR(partition, S_IRUGO, part_partition_show, NULL);
263272
static DEVICE_ATTR(start, S_IRUGO, part_start_show, NULL);
264273
static DEVICE_ATTR(size, S_IRUGO, part_size_show, NULL);
265274
static DEVICE_ATTR(stat, S_IRUGO, part_stat_show, NULL);
@@ -269,6 +278,7 @@ static struct device_attribute dev_attr_fail =
269278
#endif
270279

271280
static struct attribute *part_attrs[] = {
281+
&dev_attr_partition.attr,
272282
&dev_attr_start.attr,
273283
&dev_attr_size.attr,
274284
&dev_attr_stat.attr,

include/linux/bio.h

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,13 @@ struct bio {
7979

8080
unsigned int bi_size; /* residual I/O count */
8181

82+
/*
83+
* To keep track of the max segment size, we account for the
84+
* sizes of the first and last mergeable segments in this bio.
85+
*/
86+
unsigned int bi_seg_front_size;
87+
unsigned int bi_seg_back_size;
88+
8289
unsigned int bi_max_vecs; /* max bvl_vecs we can hold */
8390

8491
unsigned int bi_comp_cpu; /* completion CPU */

include/linux/blkdev.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -865,7 +865,6 @@ extern void blk_ordered_complete_seq(struct request_queue *, unsigned, int);
865865
extern int blk_rq_map_sg(struct request_queue *, struct request *, struct scatterlist *);
866866
extern void blk_dump_rq_flags(struct request *, char *);
867867
extern void generic_unplug_device(struct request_queue *);
868-
extern void __generic_unplug_device(struct request_queue *);
869868
extern long nr_blockdev_pages(void);
870869

871870
int blk_get_queue(struct request_queue *);

0 commit comments

Comments
 (0)