[PATCH] libfs a_ops correctnes
simple_prepare_write() currently memsets the entire page. It only needs to clear the parts which are outside the to-be-written region. This change makes no difference to performance - that memset was just a cache preload for the copy_from_user() in generic_file_write(). But it's more correct. Also, mark the page dirty in simple_commit_write(), not in simple_prepare_write(). Because the page's contents are changed after prepare_write(). This doesn't matter in practice, but it is setting a bad example. Also, add a flush_dcache_page() to simple_prepare_write(). Again, not really needed because the page cannot be mapped into pagetables if it is not uptodate. But it is example code and should not be missing such things.
Showing
Please register or sign in to comment