Skip to content

Commit caf7df1

Browse files
Christoph Hellwigaxboe
authored andcommitted
block: remove the errors field from struct request
Signed-off-by: Christoph Hellwig <hch@lst.de> Reviewed-by: Bart Van Assche <Bart.VanAssche@sandisk.com> Acked-by: Roger Pau Monné <roger.pau@citrix.com> Reviewed-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com> Signed-off-by: Jens Axboe <axboe@fb.com>
1 parent cee4b7c commit caf7df1

7 files changed

Lines changed: 24 additions & 49 deletions

File tree

‎block/blk-core.c‎

Lines changed: 1 addition & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1635,7 +1635,6 @@ void blk_init_request_from_bio(struct request *req, struct bio *bio)
16351635
if (bio->bi_opf & REQ_RAHEAD)
16361636
req->cmd_flags |= REQ_FAILFAST_MASK;
16371637

1638-
req->errors = 0;
16391638
req->__sector = bio->bi_iter.bi_sector;
16401639
if (ioprio_valid(bio_prio(bio)))
16411640
req->ioprio = bio_prio(bio);
@@ -2573,22 +2572,11 @@ bool blk_update_request(struct request *req, int error, unsigned int nr_bytes)
25732572
{
25742573
int total_bytes;
25752574

2576-
trace_block_rq_complete(req->q, req, nr_bytes);
2575+
trace_block_rq_complete(req, error, nr_bytes);
25772576

25782577
if (!req->bio)
25792578
return false;
25802579

2581-
/*
2582-
* For fs requests, rq is just carrier of independent bio's
2583-
* and each partial completion should be handled separately.
2584-
* Reset per-request error on each partial completion.
2585-
*
2586-
* TODO: tj: This is too subtle. It would be better to let
2587-
* low level drivers do what they see fit.
2588-
*/
2589-
if (!blk_rq_is_passthrough(req))
2590-
req->errors = 0;
2591-
25922580
if (error && !blk_rq_is_passthrough(req) &&
25932581
!(req->rq_flags & RQF_QUIET)) {
25942582
char *error_type;

‎block/blk-exec.c‎

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -69,8 +69,7 @@ void blk_execute_rq_nowait(struct request_queue *q, struct gendisk *bd_disk,
6969

7070
if (unlikely(blk_queue_dying(q))) {
7171
rq->rq_flags |= RQF_QUIET;
72-
rq->errors = -ENXIO;
73-
__blk_end_request_all(rq, rq->errors);
72+
__blk_end_request_all(rq, -ENXIO);
7473
spin_unlock_irq(q->queue_lock);
7574
return;
7675
}

‎block/blk-mq.c‎

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -213,7 +213,6 @@ void blk_mq_rq_ctx_init(struct request_queue *q, struct blk_mq_ctx *ctx,
213213
#endif
214214
rq->special = NULL;
215215
/* tag was already set */
216-
rq->errors = 0;
217216
rq->extra_len = 0;
218217

219218
INIT_LIST_HEAD(&rq->timeout_list);
@@ -624,8 +623,7 @@ void blk_mq_abort_requeue_list(struct request_queue *q)
624623

625624
rq = list_first_entry(&rq_list, struct request, queuelist);
626625
list_del_init(&rq->queuelist);
627-
rq->errors = -EIO;
628-
blk_mq_end_request(rq, rq->errors);
626+
blk_mq_end_request(rq, -EIO);
629627
}
630628
}
631629
EXPORT_SYMBOL(blk_mq_abort_requeue_list);
@@ -1032,8 +1030,7 @@ bool blk_mq_dispatch_rq_list(struct request_queue *q, struct list_head *list)
10321030
pr_err("blk-mq: bad return on queue: %d\n", ret);
10331031
case BLK_MQ_RQ_QUEUE_ERROR:
10341032
errors++;
1035-
rq->errors = -EIO;
1036-
blk_mq_end_request(rq, rq->errors);
1033+
blk_mq_end_request(rq, -EIO);
10371034
break;
10381035
}
10391036

@@ -1484,8 +1481,7 @@ static void __blk_mq_try_issue_directly(struct request *rq, blk_qc_t *cookie,
14841481

14851482
if (ret == BLK_MQ_RQ_QUEUE_ERROR) {
14861483
*cookie = BLK_QC_T_NONE;
1487-
rq->errors = -EIO;
1488-
blk_mq_end_request(rq, rq->errors);
1484+
blk_mq_end_request(rq, -EIO);
14891485
return;
14901486
}
14911487

‎block/blk-timeout.c‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,6 @@ static void blk_rq_timed_out(struct request *req)
8989
ret = q->rq_timed_out_fn(req);
9090
switch (ret) {
9191
case BLK_EH_HANDLED:
92-
/* Can we use req->errors here? */
9392
__blk_complete_request(req);
9493
break;
9594
case BLK_EH_RESET_TIMER:

‎include/linux/blkdev.h‎

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -220,8 +220,6 @@ struct request {
220220

221221
void *special; /* opaque pointer available for LLD use */
222222

223-
int errors;
224-
225223
unsigned int extra_len; /* length of alignment and padding */
226224

227225
unsigned long deadline;

‎include/trace/events/block.h‎

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,6 @@ TRACE_EVENT(block_rq_requeue,
8080
__field( dev_t, dev )
8181
__field( sector_t, sector )
8282
__field( unsigned int, nr_sector )
83-
__field( int, errors )
8483
__array( char, rwbs, RWBS_LEN )
8584
__dynamic_array( char, cmd, 1 )
8685
),
@@ -89,7 +88,6 @@ TRACE_EVENT(block_rq_requeue,
8988
__entry->dev = rq->rq_disk ? disk_devt(rq->rq_disk) : 0;
9089
__entry->sector = blk_rq_trace_sector(rq);
9190
__entry->nr_sector = blk_rq_trace_nr_sectors(rq);
92-
__entry->errors = rq->errors;
9391

9492
blk_fill_rwbs(__entry->rwbs, rq->cmd_flags, blk_rq_bytes(rq));
9593
__get_str(cmd)[0] = '\0';
@@ -99,13 +97,13 @@ TRACE_EVENT(block_rq_requeue,
9997
MAJOR(__entry->dev), MINOR(__entry->dev),
10098
__entry->rwbs, __get_str(cmd),
10199
(unsigned long long)__entry->sector,
102-
__entry->nr_sector, __entry->errors)
100+
__entry->nr_sector, 0)
103101
);
104102

105103
/**
106104
* block_rq_complete - block IO operation completed by device driver
107-
* @q: queue containing the block operation request
108105
* @rq: block operations request
106+
* @error: status code
109107
* @nr_bytes: number of completed bytes
110108
*
111109
* The block_rq_complete tracepoint event indicates that some portion
@@ -116,16 +114,15 @@ TRACE_EVENT(block_rq_requeue,
116114
*/
117115
TRACE_EVENT(block_rq_complete,
118116

119-
TP_PROTO(struct request_queue *q, struct request *rq,
120-
unsigned int nr_bytes),
117+
TP_PROTO(struct request *rq, int error, unsigned int nr_bytes),
121118

122-
TP_ARGS(q, rq, nr_bytes),
119+
TP_ARGS(rq, error, nr_bytes),
123120

124121
TP_STRUCT__entry(
125122
__field( dev_t, dev )
126123
__field( sector_t, sector )
127124
__field( unsigned int, nr_sector )
128-
__field( int, errors )
125+
__field( int, error )
129126
__array( char, rwbs, RWBS_LEN )
130127
__dynamic_array( char, cmd, 1 )
131128
),
@@ -134,7 +131,7 @@ TRACE_EVENT(block_rq_complete,
134131
__entry->dev = rq->rq_disk ? disk_devt(rq->rq_disk) : 0;
135132
__entry->sector = blk_rq_pos(rq);
136133
__entry->nr_sector = nr_bytes >> 9;
137-
__entry->errors = rq->errors;
134+
__entry->error = error;
138135

139136
blk_fill_rwbs(__entry->rwbs, rq->cmd_flags, nr_bytes);
140137
__get_str(cmd)[0] = '\0';
@@ -144,7 +141,7 @@ TRACE_EVENT(block_rq_complete,
144141
MAJOR(__entry->dev), MINOR(__entry->dev),
145142
__entry->rwbs, __get_str(cmd),
146143
(unsigned long long)__entry->sector,
147-
__entry->nr_sector, __entry->errors)
144+
__entry->nr_sector, __entry->error)
148145
);
149146

150147
DECLARE_EVENT_CLASS(block_rq,

‎kernel/trace/blktrace.c‎

Lines changed: 12 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -690,19 +690,19 @@ void blk_trace_shutdown(struct request_queue *q)
690690

691691
/**
692692
* blk_add_trace_rq - Add a trace for a request oriented action
693-
* @q: queue the io is for
694693
* @rq: the source request
694+
* @error: return status to log
695695
* @nr_bytes: number of completed bytes
696696
* @what: the action
697697
*
698698
* Description:
699699
* Records an action against a request. Will log the bio offset + size.
700700
*
701701
**/
702-
static void blk_add_trace_rq(struct request_queue *q, struct request *rq,
702+
static void blk_add_trace_rq(struct request *rq, int error,
703703
unsigned int nr_bytes, u32 what)
704704
{
705-
struct blk_trace *bt = q->blk_trace;
705+
struct blk_trace *bt = rq->q->blk_trace;
706706

707707
if (likely(!bt))
708708
return;
@@ -713,34 +713,32 @@ static void blk_add_trace_rq(struct request_queue *q, struct request *rq,
713713
what |= BLK_TC_ACT(BLK_TC_FS);
714714

715715
__blk_add_trace(bt, blk_rq_trace_sector(rq), nr_bytes, req_op(rq),
716-
rq->cmd_flags, what, rq->errors, 0, NULL);
716+
rq->cmd_flags, what, error, 0, NULL);
717717
}
718718

719719
static void blk_add_trace_rq_insert(void *ignore,
720720
struct request_queue *q, struct request *rq)
721721
{
722-
blk_add_trace_rq(q, rq, blk_rq_bytes(rq), BLK_TA_INSERT);
722+
blk_add_trace_rq(rq, 0, blk_rq_bytes(rq), BLK_TA_INSERT);
723723
}
724724

725725
static void blk_add_trace_rq_issue(void *ignore,
726726
struct request_queue *q, struct request *rq)
727727
{
728-
blk_add_trace_rq(q, rq, blk_rq_bytes(rq), BLK_TA_ISSUE);
728+
blk_add_trace_rq(rq, 0, blk_rq_bytes(rq), BLK_TA_ISSUE);
729729
}
730730

731731
static void blk_add_trace_rq_requeue(void *ignore,
732732
struct request_queue *q,
733733
struct request *rq)
734734
{
735-
blk_add_trace_rq(q, rq, blk_rq_bytes(rq), BLK_TA_REQUEUE);
735+
blk_add_trace_rq(rq, 0, blk_rq_bytes(rq), BLK_TA_REQUEUE);
736736
}
737737

738-
static void blk_add_trace_rq_complete(void *ignore,
739-
struct request_queue *q,
740-
struct request *rq,
741-
unsigned int nr_bytes)
738+
static void blk_add_trace_rq_complete(void *ignore, struct request *rq,
739+
int error, unsigned int nr_bytes)
742740
{
743-
blk_add_trace_rq(q, rq, nr_bytes, BLK_TA_COMPLETE);
741+
blk_add_trace_rq(rq, error, nr_bytes, BLK_TA_COMPLETE);
744742
}
745743

746744
/**
@@ -935,7 +933,7 @@ static void blk_add_trace_rq_remap(void *ignore,
935933
r.sector_from = cpu_to_be64(from);
936934

937935
__blk_add_trace(bt, blk_rq_pos(rq), blk_rq_bytes(rq),
938-
rq_data_dir(rq), 0, BLK_TA_REMAP, !!rq->errors,
936+
rq_data_dir(rq), 0, BLK_TA_REMAP, 0,
939937
sizeof(r), &r);
940938
}
941939

@@ -960,7 +958,7 @@ void blk_add_driver_data(struct request_queue *q,
960958
return;
961959

962960
__blk_add_trace(bt, blk_rq_trace_sector(rq), blk_rq_bytes(rq), 0, 0,
963-
BLK_TA_DRV_DATA, rq->errors, len, data);
961+
BLK_TA_DRV_DATA, 0, len, data);
964962
}
965963
EXPORT_SYMBOL_GPL(blk_add_driver_data);
966964

0 commit comments

Comments
 (0)