Query Regarding the check_node_data

nishanth menon menon.nishanth at gmail.com
Thu Dec 8 17:33:57 EST 2005


Hi All,

One more beginner's query regarding the handling of check_node_data
(fs/jffs2/nodelist.c)

         /* Calculate how many bytes were already checked */
         ofs = ref_offset(ref) + sizeof(struct jffs2_raw_inode);
         len = ofs % c->wbuf_pagesize;
         if (likely(len))
                 len = c->wbuf_pagesize - len;
<snip>
         ofs += len;
         len = tn->csize - len;

<snip>
 #ifndef __ECOS
         /* TODO: instead, incapsulate point() stuff to jffs2_flash_read(),
          * adding and jffs2_flash_read_end() interface. */
         if (c->mtd->point) {
                 err = c->mtd->point(c->mtd, ofs, len, &retlen, &buffer);
                 if (!err && retlen < tn->csize) {
                         JFFS2_WARNING("MTD point returned len too
short: %u instead of %u.\n", retlen, tn->csize);
                         c->mtd->unpoint(c->mtd, buffer, ofs, len);
<snip>
I dont see how this is valid(may be my understanding is faulty here).
Since we resize len (len <=csize), and request for mtd-point for len,
the check for (retlen <tn->csize) will be true and unpoint will be
called(along with the warning)!!

Can some one throw a bit of light at this. I see this code in CVS as
well as the linux git tree too.. So I suspect this as some
understanding error on my part..

Regards,
Nishanth Menon




More information about the linux-mtd mailing list