aboutsummaryrefslogtreecommitdiffstats
path: root/fs/hfsplus/extents.c
diff options
context:
space:
mode:
Diffstat (limited to 'fs/hfsplus/extents.c')
-rw-r--r--fs/hfsplus/extents.c21
1 files changed, 9 insertions, 12 deletions
diff --git a/fs/hfsplus/extents.c b/fs/hfsplus/extents.c
index 1a7480089e82..12e899cd7886 100644
--- a/fs/hfsplus/extents.c
+++ b/fs/hfsplus/extents.c
@@ -443,21 +443,18 @@ void hfsplus_file_truncate(struct inode *inode)
443 if (inode->i_size > HFSPLUS_I(inode).phys_size) { 443 if (inode->i_size > HFSPLUS_I(inode).phys_size) {
444 struct address_space *mapping = inode->i_mapping; 444 struct address_space *mapping = inode->i_mapping;
445 struct page *page; 445 struct page *page;
446 u32 size = inode->i_size - 1; 446 void *fsdata;
447 u32 size = inode->i_size;
447 int res; 448 int res;
448 449
449 page = grab_cache_page(mapping, size >> PAGE_CACHE_SHIFT); 450 res = pagecache_write_begin(NULL, mapping, size, 0,
450 if (!page) 451 AOP_FLAG_UNINTERRUPTIBLE,
451 return; 452 &page, &fsdata);
452 size &= PAGE_CACHE_SIZE - 1;
453 size++;
454 res = mapping->a_ops->prepare_write(NULL, page, size, size);
455 if (!res)
456 res = mapping->a_ops->commit_write(NULL, page, size, size);
457 if (res) 453 if (res)
458 inode->i_size = HFSPLUS_I(inode).phys_size; 454 return;
459 unlock_page(page); 455 res = pagecache_write_end(NULL, mapping, size, 0, 0, page, fsdata);
460 page_cache_release(page); 456 if (res < 0)
457 return;
461 mark_inode_dirty(inode); 458 mark_inode_dirty(inode);
462 return; 459 return;
463 } else if (inode->i_size == HFSPLUS_I(inode).phys_size) 460 } else if (inode->i_size == HFSPLUS_I(inode).phys_size)