Messages in this thread |  | | From | Benjamin Herrenschmidt <> | Date | Sun, 3 Sep 2000 13:27:56 +0200 |
| |
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); >+unmap: >+ 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.
Ben. - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org Please read the FAQ at http://www.tux.org/lkml/
|  |