[lkml]   [2000]   [Sep]   [3]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
Messages in this thread
Hi !

I've read the discussion about the truncate() problem and tried to
understand ;) However, there's somethign I don't catch in your code (typo
? bug ? misunderstanding on my side ?)

Linus wrote:

There's a really simple way to avoid this: compare the thing you're going
to zero out against zero before you memset() it to zero. If it was already
zero, you just unlock the page and release.

Your code does:

>+ kaddr = (char*)kmap(page);
>+ err = 0;
>+ if (!mem_is_zero(kaddr+offset, length))
>+ goto unmap;
>+ memset(kaddr+offset, 0, length);
>+ flush_dcache_page(page);
>+ __block_commit_write(inode, page, offset, offset+length);
>+ kunmap(page);

Which seem to be the the opposite of what Linus says: You memset() the
page when it's _already_ zero and exit when it's not.

To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to
Please read the FAQ at

 \ /
  Last update: 2005-03-22 12:38    [W:0.118 / U:0.368 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site