提交 797a455d 编写于 作者: J Jens Axboe

block: ensure that completion error gets properly traced

We normally just use the BIO_UPTODATE flag to signal 0/-EIO. If
we have more information available, we should pass that along to
the trace output.
Signed-off-by: NJens Axboe <jaxboe@fusionio.com>
上级 23036f1a
...@@ -758,54 +758,58 @@ static void blk_add_trace_rq_complete(void *ignore, ...@@ -758,54 +758,58 @@ static void blk_add_trace_rq_complete(void *ignore,
* @q: queue the io is for * @q: queue the io is for
* @bio: the source bio * @bio: the source bio
* @what: the action * @what: the action
* @error: error, if any
* *
* Description: * Description:
* Records an action against a bio. Will log the bio offset + size. * Records an action against a bio. Will log the bio offset + size.
* *
**/ **/
static void blk_add_trace_bio(struct request_queue *q, struct bio *bio, static void blk_add_trace_bio(struct request_queue *q, struct bio *bio,
u32 what) u32 what, int error)
{ {
struct blk_trace *bt = q->blk_trace; struct blk_trace *bt = q->blk_trace;
if (likely(!bt)) if (likely(!bt))
return; return;
if (!error && !bio_flagged(bio, BIO_UPTODATE))
error = EIO;
__blk_add_trace(bt, bio->bi_sector, bio->bi_size, bio->bi_rw, what, __blk_add_trace(bt, bio->bi_sector, bio->bi_size, bio->bi_rw, what,
!bio_flagged(bio, BIO_UPTODATE), 0, NULL); error, 0, NULL);
} }
static void blk_add_trace_bio_bounce(void *ignore, static void blk_add_trace_bio_bounce(void *ignore,
struct request_queue *q, struct bio *bio) struct request_queue *q, struct bio *bio)
{ {
blk_add_trace_bio(q, bio, BLK_TA_BOUNCE); blk_add_trace_bio(q, bio, BLK_TA_BOUNCE, 0);
} }
static void blk_add_trace_bio_complete(void *ignore, static void blk_add_trace_bio_complete(void *ignore,
struct request_queue *q, struct bio *bio, struct request_queue *q, struct bio *bio,
int error) int error)
{ {
blk_add_trace_bio(q, bio, BLK_TA_COMPLETE); blk_add_trace_bio(q, bio, BLK_TA_COMPLETE, error);
} }
static void blk_add_trace_bio_backmerge(void *ignore, static void blk_add_trace_bio_backmerge(void *ignore,
struct request_queue *q, struct request_queue *q,
struct bio *bio) struct bio *bio)
{ {
blk_add_trace_bio(q, bio, BLK_TA_BACKMERGE); blk_add_trace_bio(q, bio, BLK_TA_BACKMERGE, 0);
} }
static void blk_add_trace_bio_frontmerge(void *ignore, static void blk_add_trace_bio_frontmerge(void *ignore,
struct request_queue *q, struct request_queue *q,
struct bio *bio) struct bio *bio)
{ {
blk_add_trace_bio(q, bio, BLK_TA_FRONTMERGE); blk_add_trace_bio(q, bio, BLK_TA_FRONTMERGE, 0);
} }
static void blk_add_trace_bio_queue(void *ignore, static void blk_add_trace_bio_queue(void *ignore,
struct request_queue *q, struct bio *bio) struct request_queue *q, struct bio *bio)
{ {
blk_add_trace_bio(q, bio, BLK_TA_QUEUE); blk_add_trace_bio(q, bio, BLK_TA_QUEUE, 0);
} }
static void blk_add_trace_getrq(void *ignore, static void blk_add_trace_getrq(void *ignore,
...@@ -813,7 +817,7 @@ static void blk_add_trace_getrq(void *ignore, ...@@ -813,7 +817,7 @@ static void blk_add_trace_getrq(void *ignore,
struct bio *bio, int rw) struct bio *bio, int rw)
{ {
if (bio) if (bio)
blk_add_trace_bio(q, bio, BLK_TA_GETRQ); blk_add_trace_bio(q, bio, BLK_TA_GETRQ, 0);
else { else {
struct blk_trace *bt = q->blk_trace; struct blk_trace *bt = q->blk_trace;
...@@ -828,7 +832,7 @@ static void blk_add_trace_sleeprq(void *ignore, ...@@ -828,7 +832,7 @@ static void blk_add_trace_sleeprq(void *ignore,
struct bio *bio, int rw) struct bio *bio, int rw)
{ {
if (bio) if (bio)
blk_add_trace_bio(q, bio, BLK_TA_SLEEPRQ); blk_add_trace_bio(q, bio, BLK_TA_SLEEPRQ, 0);
else { else {
struct blk_trace *bt = q->blk_trace; struct blk_trace *bt = q->blk_trace;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册