blktrace: fix wrong calculation of RWBS
[linux-2.6.git] / kernel / trace / blktrace.c
index 108f4f7..9af4143 100644 (file)
@@ -147,8 +147,8 @@ static int act_log_check(struct blk_trace *bt, u32 what, sector_t sector,
 /*
  * Data direction bit lookup
  */
-static u32 ddir_act[2] __read_mostly = { BLK_TC_ACT(BLK_TC_READ),
-                                        BLK_TC_ACT(BLK_TC_WRITE) };
+static const u32 ddir_act[2] = { BLK_TC_ACT(BLK_TC_READ),
+                                BLK_TC_ACT(BLK_TC_WRITE) };
 
 /* The ilog2() calls fall out because they're constant */
 #define MASK_TC_BIT(rw, __name) ((rw & (1 << BIO_RW_ ## __name)) << \
@@ -922,23 +922,24 @@ static void blk_unregister_tracepoints(void)
 static void fill_rwbs(char *rwbs, const struct blk_io_trace *t)
 {
        int i = 0;
+       int tc = t->action >> BLK_TC_SHIFT;
 
-       if (t->action & BLK_TC_DISCARD)
+       if (tc & BLK_TC_DISCARD)
                rwbs[i++] = 'D';
-       else if (t->action & BLK_TC_WRITE)
+       else if (tc & BLK_TC_WRITE)
                rwbs[i++] = 'W';
        else if (t->bytes)
                rwbs[i++] = 'R';
        else
                rwbs[i++] = 'N';
 
-       if (t->action & BLK_TC_AHEAD)
+       if (tc & BLK_TC_AHEAD)
                rwbs[i++] = 'A';
-       if (t->action & BLK_TC_BARRIER)
+       if (tc & BLK_TC_BARRIER)
                rwbs[i++] = 'B';
-       if (t->action & BLK_TC_SYNC)
+       if (tc & BLK_TC_SYNC)
                rwbs[i++] = 'S';
-       if (t->action & BLK_TC_META)
+       if (tc & BLK_TC_META)
                rwbs[i++] = 'M';
 
        rwbs[i] = '\0';
@@ -1116,10 +1117,10 @@ static void blk_tracer_reset(struct trace_array *tr)
        blk_tracer_stop(tr);
 }
 
-static struct {
+static const struct {
        const char *act[2];
        int        (*print)(struct trace_seq *s, const struct trace_entry *ent);
-} what2act[] __read_mostly = {
+} what2act[] = {
        [__BLK_TA_QUEUE]        = {{  "Q", "queue" },      blk_log_generic },
        [__BLK_TA_BACKMERGE]    = {{  "M", "backmerge" },  blk_log_generic },
        [__BLK_TA_FRONTMERGE]   = {{  "F", "frontmerge" }, blk_log_generic },