diff options
-rw-r--r-- | fs/libfs.c | 22 | ||||
-rw-r--r-- | include/linux/fs.h | 2 |
2 files changed, 6 insertions, 18 deletions
diff --git a/fs/libfs.c b/fs/libfs.c index cd88abdcb436..9e50bcf55857 100644 --- a/fs/libfs.c +++ b/fs/libfs.c | |||
@@ -338,28 +338,14 @@ int simple_readpage(struct file *file, struct page *page) | |||
338 | return 0; | 338 | return 0; |
339 | } | 339 | } |
340 | 340 | ||
341 | int simple_prepare_write(struct file *file, struct page *page, | ||
342 | unsigned from, unsigned to) | ||
343 | { | ||
344 | if (!PageUptodate(page)) { | ||
345 | if (to - from != PAGE_CACHE_SIZE) | ||
346 | zero_user_segments(page, | ||
347 | 0, from, | ||
348 | to, PAGE_CACHE_SIZE); | ||
349 | } | ||
350 | return 0; | ||
351 | } | ||
352 | |||
353 | int simple_write_begin(struct file *file, struct address_space *mapping, | 341 | int simple_write_begin(struct file *file, struct address_space *mapping, |
354 | loff_t pos, unsigned len, unsigned flags, | 342 | loff_t pos, unsigned len, unsigned flags, |
355 | struct page **pagep, void **fsdata) | 343 | struct page **pagep, void **fsdata) |
356 | { | 344 | { |
357 | struct page *page; | 345 | struct page *page; |
358 | pgoff_t index; | 346 | pgoff_t index; |
359 | unsigned from; | ||
360 | 347 | ||
361 | index = pos >> PAGE_CACHE_SHIFT; | 348 | index = pos >> PAGE_CACHE_SHIFT; |
362 | from = pos & (PAGE_CACHE_SIZE - 1); | ||
363 | 349 | ||
364 | page = grab_cache_page_write_begin(mapping, index, flags); | 350 | page = grab_cache_page_write_begin(mapping, index, flags); |
365 | if (!page) | 351 | if (!page) |
@@ -367,7 +353,12 @@ int simple_write_begin(struct file *file, struct address_space *mapping, | |||
367 | 353 | ||
368 | *pagep = page; | 354 | *pagep = page; |
369 | 355 | ||
370 | return simple_prepare_write(file, page, from, from+len); | 356 | if (!PageUptodate(page) && (len != PAGE_CACHE_SIZE)) { |
357 | unsigned from = pos & (PAGE_CACHE_SIZE - 1); | ||
358 | |||
359 | zero_user_segments(page, 0, from, from + len, PAGE_CACHE_SIZE); | ||
360 | } | ||
361 | return 0; | ||
371 | } | 362 | } |
372 | 363 | ||
373 | /** | 364 | /** |
@@ -864,7 +855,6 @@ EXPORT_SYMBOL(simple_getattr); | |||
864 | EXPORT_SYMBOL(simple_link); | 855 | EXPORT_SYMBOL(simple_link); |
865 | EXPORT_SYMBOL(simple_lookup); | 856 | EXPORT_SYMBOL(simple_lookup); |
866 | EXPORT_SYMBOL(simple_pin_fs); | 857 | EXPORT_SYMBOL(simple_pin_fs); |
867 | EXPORT_UNUSED_SYMBOL(simple_prepare_write); | ||
868 | EXPORT_SYMBOL(simple_readpage); | 858 | EXPORT_SYMBOL(simple_readpage); |
869 | EXPORT_SYMBOL(simple_release_fs); | 859 | EXPORT_SYMBOL(simple_release_fs); |
870 | EXPORT_SYMBOL(simple_rename); | 860 | EXPORT_SYMBOL(simple_rename); |
diff --git a/include/linux/fs.h b/include/linux/fs.h index ebb1cd5bc241..2b124c825e38 100644 --- a/include/linux/fs.h +++ b/include/linux/fs.h | |||
@@ -2340,8 +2340,6 @@ extern int simple_rename(struct inode *, struct dentry *, struct inode *, struct | |||
2340 | extern int simple_sync_file(struct file *, struct dentry *, int); | 2340 | extern int simple_sync_file(struct file *, struct dentry *, int); |
2341 | extern int simple_empty(struct dentry *); | 2341 | extern int simple_empty(struct dentry *); |
2342 | extern int simple_readpage(struct file *file, struct page *page); | 2342 | extern int simple_readpage(struct file *file, struct page *page); |
2343 | extern int simple_prepare_write(struct file *file, struct page *page, | ||
2344 | unsigned offset, unsigned to); | ||
2345 | extern int simple_write_begin(struct file *file, struct address_space *mapping, | 2343 | extern int simple_write_begin(struct file *file, struct address_space *mapping, |
2346 | loff_t pos, unsigned len, unsigned flags, | 2344 | loff_t pos, unsigned len, unsigned flags, |
2347 | struct page **pagep, void **fsdata); | 2345 | struct page **pagep, void **fsdata); |