Why the alignemt to 4 bytes is necessary in jffs2_commit_write function

akorolev alexey.korolev at intel.com
Wed Jul 11 12:25:22 EDT 2007


Hi All

I'm currently working on JFFS2 improving. I faced some issues with 
understanding why we need to align start offset to 4 bytes in 
jffs2_commit_write function?
Here is the part of this code:
=========================

    unsigned aligned_start = start & ~3;
    .........................................
    /* Adjust writtenlen for the padding we did, so we don't confuse our 
caller */
    if (writtenlen < (start&3))
        writtenlen = 0;
    else
        writtenlen -= (start&3);

===========================
What does the padding mean here?
If I properly understand the aligned_start is not related to offset of 
the fragment it is just offset within the file.  (Frag offset is aligned)
File offset is not necessary to keep aligned - so why not to kick off 
it. (I tried and didn't find anything wrong in tests).

Thanks,
Alexey



More information about the linux-mtd mailing list