Nick Piggin <npiggin@xxxxxxx> writes:
status = __block_prepare_write(inode, new_page, zerofrom,
PAGE_CACHE_SIZE, get_block);
if (status)
@@ -2110,7 +2111,7 @@
memset(kaddr+zerofrom, 0, PAGE_CACHE_SIZE-zerofrom);
flush_dcache_page(new_page);
kunmap_atomic(kaddr, KM_USER0);
- generic_commit_write(NULL, new_page, zerofrom, PAGE_CACHE_SIZE);
+ __block_commit_write(inode, new_page, zerofrom, PAGE_CACHE_SIZE);
Whatever function this is doesn't need to update i_size?
Yes, it is the code in cont_prepare_write that is expanding a hole
at the end of file.
We can do this now because fat_commit_write is now changed to call
generic_commit_write in the case of a non-zero length.
I think it is an improvement because now the file will not get
arbitrarily extended in the case of a write failure somewhere down
the track.
Ah, unfortunately we can't this. If we don't update ->i_size before
page_cache_release, pdflush will think these pages is outside ->i_size
and just clean the page without writing it.