aboutsummaryrefslogtreecommitdiffstats
path: root/kernel/trace
diff options
context:
space:
mode:
authorChristoph Hellwig <hch@lst.de>2010-08-07 12:20:39 -0400
committerJens Axboe <jaxboe@fusionio.com>2010-08-07 12:20:39 -0400
commit7b6d91daee5cac6402186ff224c3af39d79f4a0e (patch)
treeb1518cf0b6c301178e0a320f80610cd5b3aa7625 /kernel/trace
parent33659ebbae262228eef4e0fe990f393d1f0ed941 (diff)
block: unify flags for struct bio and struct request
Remove the current bio flags and reuse the request flags for the bio, too. This allows to more easily trace the type of I/O from the filesystem down to the block driver. There were two flags in the bio that were missing in the requests: BIO_RW_UNPLUG and BIO_RW_AHEAD. Also I've renamed two request flags that had a superflous RW in them. Note that the flags are in bio.h despite having the REQ_ name - as blkdev.h includes bio.h that is the only way to go for now. Signed-off-by: Christoph Hellwig <hch@lst.de> Signed-off-by: Jens Axboe <jaxboe@fusionio.com>
Diffstat (limited to 'kernel/trace')
-rw-r--r--kernel/trace/blktrace.c27
1 files changed, 15 insertions, 12 deletions
diff --git a/kernel/trace/blktrace.c b/kernel/trace/blktrace.c
index 4f149944cb89..3b4a695051b6 100644
--- a/kernel/trace/blktrace.c
+++ b/kernel/trace/blktrace.c
@@ -169,9 +169,12 @@ static int act_log_check(struct blk_trace *bt, u32 what, sector_t sector,
169static const u32 ddir_act[2] = { BLK_TC_ACT(BLK_TC_READ), 169static const u32 ddir_act[2] = { BLK_TC_ACT(BLK_TC_READ),
170 BLK_TC_ACT(BLK_TC_WRITE) }; 170 BLK_TC_ACT(BLK_TC_WRITE) };
171 171
172#define BLK_TC_HARDBARRIER BLK_TC_BARRIER
173#define BLK_TC_RAHEAD BLK_TC_AHEAD
174
172/* The ilog2() calls fall out because they're constant */ 175/* The ilog2() calls fall out because they're constant */
173#define MASK_TC_BIT(rw, __name) ((rw & (1 << BIO_RW_ ## __name)) << \ 176#define MASK_TC_BIT(rw, __name) ((rw & REQ_ ## __name) << \
174 (ilog2(BLK_TC_ ## __name) + BLK_TC_SHIFT - BIO_RW_ ## __name)) 177 (ilog2(BLK_TC_ ## __name) + BLK_TC_SHIFT - __REQ_ ## __name))
175 178
176/* 179/*
177 * The worker for the various blk_add_trace*() types. Fills out a 180 * The worker for the various blk_add_trace*() types. Fills out a
@@ -194,9 +197,9 @@ static void __blk_add_trace(struct blk_trace *bt, sector_t sector, int bytes,
194 return; 197 return;
195 198
196 what |= ddir_act[rw & WRITE]; 199 what |= ddir_act[rw & WRITE];
197 what |= MASK_TC_BIT(rw, BARRIER); 200 what |= MASK_TC_BIT(rw, HARDBARRIER);
198 what |= MASK_TC_BIT(rw, SYNCIO); 201 what |= MASK_TC_BIT(rw, SYNC);
199 what |= MASK_TC_BIT(rw, AHEAD); 202 what |= MASK_TC_BIT(rw, RAHEAD);
200 what |= MASK_TC_BIT(rw, META); 203 what |= MASK_TC_BIT(rw, META);
201 what |= MASK_TC_BIT(rw, DISCARD); 204 what |= MASK_TC_BIT(rw, DISCARD);
202 205
@@ -662,7 +665,7 @@ static void blk_add_trace_rq(struct request_queue *q, struct request *rq,
662 return; 665 return;
663 666
664 if (rq->cmd_flags & REQ_DISCARD) 667 if (rq->cmd_flags & REQ_DISCARD)
665 rw |= (1 << BIO_RW_DISCARD); 668 rw |= REQ_DISCARD;
666 669
667 if (rq->cmd_type == REQ_TYPE_BLOCK_PC) { 670 if (rq->cmd_type == REQ_TYPE_BLOCK_PC) {
668 what |= BLK_TC_ACT(BLK_TC_PC); 671 what |= BLK_TC_ACT(BLK_TC_PC);
@@ -1755,20 +1758,20 @@ void blk_fill_rwbs(char *rwbs, u32 rw, int bytes)
1755 1758
1756 if (rw & WRITE) 1759 if (rw & WRITE)
1757 rwbs[i++] = 'W'; 1760 rwbs[i++] = 'W';
1758 else if (rw & 1 << BIO_RW_DISCARD) 1761 else if (rw & REQ_DISCARD)
1759 rwbs[i++] = 'D'; 1762 rwbs[i++] = 'D';
1760 else if (bytes) 1763 else if (bytes)
1761 rwbs[i++] = 'R'; 1764 rwbs[i++] = 'R';
1762 else 1765 else
1763 rwbs[i++] = 'N'; 1766 rwbs[i++] = 'N';
1764 1767
1765 if (rw & 1 << BIO_RW_AHEAD) 1768 if (rw & REQ_RAHEAD)
1766 rwbs[i++] = 'A'; 1769 rwbs[i++] = 'A';
1767 if (rw & 1 << BIO_RW_BARRIER) 1770 if (rw & REQ_HARDBARRIER)
1768 rwbs[i++] = 'B'; 1771 rwbs[i++] = 'B';
1769 if (rw & 1 << BIO_RW_SYNCIO) 1772 if (rw & REQ_SYNC)
1770 rwbs[i++] = 'S'; 1773 rwbs[i++] = 'S';
1771 if (rw & 1 << BIO_RW_META) 1774 if (rw & REQ_META)
1772 rwbs[i++] = 'M'; 1775 rwbs[i++] = 'M';
1773 1776
1774 rwbs[i] = '\0'; 1777 rwbs[i] = '\0';
@@ -1780,7 +1783,7 @@ void blk_fill_rwbs_rq(char *rwbs, struct request *rq)
1780 int bytes; 1783 int bytes;
1781 1784
1782 if (rq->cmd_flags & REQ_DISCARD) 1785 if (rq->cmd_flags & REQ_DISCARD)
1783 rw |= (1 << BIO_RW_DISCARD); 1786 rw |= REQ_DISCARD;
1784 1787
1785 bytes = blk_rq_bytes(rq); 1788 bytes = blk_rq_bytes(rq);
1786 1789