aboutsummaryrefslogtreecommitdiffstats
path: root/fs/smbfs
diff options
context:
space:
mode:
Diffstat (limited to 'fs/smbfs')
-rw-r--r--fs/smbfs/file.c32
1 files changed, 24 insertions, 8 deletions
diff --git a/fs/smbfs/file.c b/fs/smbfs/file.c
index c5d78a7e492b..f5d14cebc75a 100644
--- a/fs/smbfs/file.c
+++ b/fs/smbfs/file.c
@@ -292,29 +292,45 @@ out:
292 * If the writer ends up delaying the write, the writer needs to 292 * If the writer ends up delaying the write, the writer needs to
293 * increment the page use counts until he is done with the page. 293 * increment the page use counts until he is done with the page.
294 */ 294 */
295static int smb_prepare_write(struct file *file, struct page *page, 295static int smb_write_begin(struct file *file, struct address_space *mapping,
296 unsigned offset, unsigned to) 296 loff_t pos, unsigned len, unsigned flags,
297 struct page **pagep, void **fsdata)
297{ 298{
299 pgoff_t index = pos >> PAGE_CACHE_SHIFT;
300 *pagep = __grab_cache_page(mapping, index);
301 if (!*pagep)
302 return -ENOMEM;
298 return 0; 303 return 0;
299} 304}
300 305
301static int smb_commit_write(struct file *file, struct page *page, 306static int smb_write_end(struct file *file, struct address_space *mapping,
302 unsigned offset, unsigned to) 307 loff_t pos, unsigned len, unsigned copied,
308 struct page *page, void *fsdata)
303{ 309{
304 int status; 310 int status;
311 unsigned offset = pos & (PAGE_CACHE_SIZE - 1);
305 312
306 status = -EFAULT;
307 lock_kernel(); 313 lock_kernel();
308 status = smb_updatepage(file, page, offset, to-offset); 314 status = smb_updatepage(file, page, offset, copied);
309 unlock_kernel(); 315 unlock_kernel();
316
317 if (!status) {
318 if (!PageUptodate(page) && copied == PAGE_CACHE_SIZE)
319 SetPageUptodate(page);
320 status = copied;
321 }
322
323 unlock_page(page);
324 page_cache_release(page);
325
310 return status; 326 return status;
311} 327}
312 328
313const struct address_space_operations smb_file_aops = { 329const struct address_space_operations smb_file_aops = {
314 .readpage = smb_readpage, 330 .readpage = smb_readpage,
315 .writepage = smb_writepage, 331 .writepage = smb_writepage,
316 .prepare_write = smb_prepare_write, 332 .write_begin = smb_write_begin,
317 .commit_write = smb_commit_write 333 .write_end = smb_write_end,
318}; 334};
319 335
320/* 336/*