diff options
author | Nathan Scott <nathans@sgi.com> | 2006-07-06 04:03:28 -0400 |
---|---|---|
committer | Jens Axboe <axboe@suse.de> | 2006-07-06 04:03:28 -0400 |
commit | 40359ccb836866435b03a0cb57345002b587d875 (patch) | |
tree | 4e0530a7759ba9802658901432a89683fbb0965d | |
parent | fc0a75ce4835187a3f76d6b35f0644d1b168eef5 (diff) |
[PATCH] blktrace: readahead support
Provide the needed kernel support for distinguishing readahead
from regular read requests when tracing block devices.
Signed-off-by: Nathan Scott <nathans@sgi.com>
Signed-off-by: Jens Axboe <axboe@suse.de>
-rw-r--r-- | block/blktrace.c | 5 | ||||
-rw-r--r-- | include/linux/blktrace_api.h | 1 |
2 files changed, 5 insertions, 1 deletions
diff --git a/block/blktrace.c b/block/blktrace.c index 92925e7d9e6c..b8c0702777ff 100644 --- a/block/blktrace.c +++ b/block/blktrace.c | |||
@@ -69,7 +69,7 @@ static u32 ddir_act[2] __read_mostly = { BLK_TC_ACT(BLK_TC_READ), BLK_TC_ACT(BLK | |||
69 | /* | 69 | /* |
70 | * Bio action bits of interest | 70 | * Bio action bits of interest |
71 | */ | 71 | */ |
72 | static u32 bio_act[3] __read_mostly = { 0, BLK_TC_ACT(BLK_TC_BARRIER), BLK_TC_ACT(BLK_TC_SYNC) }; | 72 | static u32 bio_act[5] __read_mostly = { 0, BLK_TC_ACT(BLK_TC_BARRIER), BLK_TC_ACT(BLK_TC_SYNC), 0, BLK_TC_ACT(BLK_TC_AHEAD) }; |
73 | 73 | ||
74 | /* | 74 | /* |
75 | * More could be added as needed, taking care to increment the decrementer | 75 | * More could be added as needed, taking care to increment the decrementer |
@@ -79,6 +79,8 @@ static u32 bio_act[3] __read_mostly = { 0, BLK_TC_ACT(BLK_TC_BARRIER), BLK_TC_AC | |||
79 | (((rw) & (1 << BIO_RW_BARRIER)) >> (BIO_RW_BARRIER - 0)) | 79 | (((rw) & (1 << BIO_RW_BARRIER)) >> (BIO_RW_BARRIER - 0)) |
80 | #define trace_sync_bit(rw) \ | 80 | #define trace_sync_bit(rw) \ |
81 | (((rw) & (1 << BIO_RW_SYNC)) >> (BIO_RW_SYNC - 1)) | 81 | (((rw) & (1 << BIO_RW_SYNC)) >> (BIO_RW_SYNC - 1)) |
82 | #define trace_ahead_bit(rw) \ | ||
83 | (((rw) & (1 << BIO_RW_AHEAD)) << (BIO_RW_AHEAD - 0)) | ||
82 | 84 | ||
83 | /* | 85 | /* |
84 | * The worker for the various blk_add_trace*() types. Fills out a | 86 | * The worker for the various blk_add_trace*() types. Fills out a |
@@ -100,6 +102,7 @@ void __blk_add_trace(struct blk_trace *bt, sector_t sector, int bytes, | |||
100 | what |= ddir_act[rw & WRITE]; | 102 | what |= ddir_act[rw & WRITE]; |
101 | what |= bio_act[trace_barrier_bit(rw)]; | 103 | what |= bio_act[trace_barrier_bit(rw)]; |
102 | what |= bio_act[trace_sync_bit(rw)]; | 104 | what |= bio_act[trace_sync_bit(rw)]; |
105 | what |= bio_act[trace_ahead_bit(rw)]; | ||
103 | 106 | ||
104 | pid = tsk->pid; | 107 | pid = tsk->pid; |
105 | if (unlikely(act_log_check(bt, what, sector, pid))) | 108 | if (unlikely(act_log_check(bt, what, sector, pid))) |
diff --git a/include/linux/blktrace_api.h b/include/linux/blktrace_api.h index d95615fc6da5..2346a1db8561 100644 --- a/include/linux/blktrace_api.h +++ b/include/linux/blktrace_api.h | |||
@@ -19,6 +19,7 @@ enum blktrace_cat { | |||
19 | BLK_TC_FS = 1 << 8, /* fs requests */ | 19 | BLK_TC_FS = 1 << 8, /* fs requests */ |
20 | BLK_TC_PC = 1 << 9, /* pc requests */ | 20 | BLK_TC_PC = 1 << 9, /* pc requests */ |
21 | BLK_TC_NOTIFY = 1 << 10, /* special message */ | 21 | BLK_TC_NOTIFY = 1 << 10, /* special message */ |
22 | BLK_TC_AHEAD = 1 << 11, /* readahead */ | ||
22 | 23 | ||
23 | BLK_TC_END = 1 << 15, /* only 16-bits, reminder */ | 24 | BLK_TC_END = 1 << 15, /* only 16-bits, reminder */ |
24 | }; | 25 | }; |