Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

I am trying to understand the Linux block layer so I am writing a blog about it: http://www.linuxintro.org/wiki/blktrAce. When calling blktrace like this:

blktrace -d /dev/sdg -o - | blkparse -i -

I see e.g. the output

8,96   4      695   430.080106382  2356  I   N 0 (00 ..) [kworker/4:2]
8,96   3       29   430.082179440    53  D   N 0 (00 ..) [ksoftirqd/3]

I do not understand what this means. According to the man page of blkparse, there is an RWBS field (containing R for read, W for write, B for barrier, D for discard or S for sync). With some experimenting I found out it is the 7th column. However it contains N. What does that mean? Where can I find the info what it means?

share|improve this question

2 Answers 2

blkparse documentation looks outdated and is missing to document this flag.

Its source code is lacking comments however, from this function it looks like N means the operation is neither a read, a write, a discard, or anything expected by the code, perhaps N is simply used for None.

share|improve this answer

It appears that there are additional undocumented flags in the RWBS field and that the 'B' for barrier is deprecated. N probably means notify although as jlliagre says it is denotes anything that is not discard, read or write.

D - discard
W - write
R - read
N - None of the above 

F - FUA
A - readahead
S - sync
M - metadata



static inline void fill_rwbs(char *rwbs, struct blk_io_trace *t)
{
    int w = t->action & BLK_TC_ACT(BLK_TC_WRITE);
    int a = t->action & BLK_TC_ACT(BLK_TC_AHEAD);
    int s = t->action & BLK_TC_ACT(BLK_TC_SYNC);
    int m = t->action & BLK_TC_ACT(BLK_TC_META);
    int d = t->action & BLK_TC_ACT(BLK_TC_DISCARD);
    int f = t->action & BLK_TC_ACT(BLK_TC_FLUSH);
    int u = t->action & BLK_TC_ACT(BLK_TC_FUA);
    int i = 0;

    if (f)
            rwbs[i++] = 'F'; /* flush */

    if (d)
            rwbs[i++] = 'D';
    else if (w)
            rwbs[i++] = 'W';
    else if (t->bytes)
            rwbs[i++] = 'R';
    else
            rwbs[i++] = 'N';

    if (u)
            rwbs[i++] = 'F'; /* fua */
    if (a)
            rwbs[i++] = 'A';
    if (s)
            rwbs[i++] = 'S';
    if (m)
            rwbs[i++] = 'M';

    rwbs[i] = '\0';
}
share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.