Of course, this is a worst case estimate since many of these blocks may already be in memory and unnecessary to read from disk. So, it is a really easy question as to how much is written, but a very hard question as to how much is read!
In practice, in a mounted filesystem, many of these reads are from the page cache and not from disk, because the blocks are accessed frequently enough that they're never flushed. So the answer above is likely more than ever happens in a realistic running system!
int first_thirteen; int *single_indirection; int **double_indirection;Please interpret each of these ints as a physical offset of a block on disk.
first_thirteenthe 15th block is block 15-13=2 of the single indirection pointer. Thus an expression for it is
(This might seem counter-intuitive until you consider the following: Counting from 0, blocks 0-12 are in first_thirteen and block 13 (from 0) is not.
double_indirection.(presuming that we fetch
double_indirectioninto the page cache before computing
As long as one is writing only, or reading only what one has already written, the journal suffices and the disk can stay powered off. But if you try to read something that is not in the journal, then the disk has to be spun up and you don't save power while doing the read.