diff options
Diffstat (limited to 'fs/hfs')
-rw-r--r-- | fs/hfs/extent.c | 19 | ||||
-rw-r--r-- | fs/hfs/inode.c | 18 |
2 files changed, 19 insertions, 18 deletions
diff --git a/fs/hfs/extent.c b/fs/hfs/extent.c index 5ea6b3d45eaa..c176f67ba0a5 100644 --- a/fs/hfs/extent.c +++ b/fs/hfs/extent.c | |||
@@ -464,23 +464,20 @@ void hfs_file_truncate(struct inode *inode) | |||
464 | (long long)HFS_I(inode)->phys_size, inode->i_size); | 464 | (long long)HFS_I(inode)->phys_size, inode->i_size); |
465 | if (inode->i_size > HFS_I(inode)->phys_size) { | 465 | if (inode->i_size > HFS_I(inode)->phys_size) { |
466 | struct address_space *mapping = inode->i_mapping; | 466 | struct address_space *mapping = inode->i_mapping; |
467 | void *fsdata; | ||
467 | struct page *page; | 468 | struct page *page; |
468 | int res; | 469 | int res; |
469 | 470 | ||
471 | /* XXX: Can use generic_cont_expand? */ | ||
470 | size = inode->i_size - 1; | 472 | size = inode->i_size - 1; |
471 | page = grab_cache_page(mapping, size >> PAGE_CACHE_SHIFT); | 473 | res = pagecache_write_begin(NULL, mapping, size+1, 0, |
472 | if (!page) | 474 | AOP_FLAG_UNINTERRUPTIBLE, &page, &fsdata); |
473 | return; | 475 | if (!res) { |
474 | size &= PAGE_CACHE_SIZE - 1; | 476 | res = pagecache_write_end(NULL, mapping, size+1, 0, 0, |
475 | size++; | 477 | page, fsdata); |
476 | res = mapping->a_ops->prepare_write(NULL, page, size, size); | 478 | } |
477 | if (!res) | ||
478 | res = mapping->a_ops->commit_write(NULL, page, size, size); | ||
479 | if (res) | 479 | if (res) |
480 | inode->i_size = HFS_I(inode)->phys_size; | 480 | inode->i_size = HFS_I(inode)->phys_size; |
481 | unlock_page(page); | ||
482 | page_cache_release(page); | ||
483 | mark_inode_dirty(inode); | ||
484 | return; | 481 | return; |
485 | } else if (inode->i_size == HFS_I(inode)->phys_size) | 482 | } else if (inode->i_size == HFS_I(inode)->phys_size) |
486 | return; | 483 | return; |
diff --git a/fs/hfs/inode.c b/fs/hfs/inode.c index bc835f272a6e..97f8446c4ff4 100644 --- a/fs/hfs/inode.c +++ b/fs/hfs/inode.c | |||
@@ -35,10 +35,14 @@ static int hfs_readpage(struct file *file, struct page *page) | |||
35 | return block_read_full_page(page, hfs_get_block); | 35 | return block_read_full_page(page, hfs_get_block); |
36 | } | 36 | } |
37 | 37 | ||
38 | static int hfs_prepare_write(struct file *file, struct page *page, unsigned from, unsigned to) | 38 | static int hfs_write_begin(struct file *file, struct address_space *mapping, |
39 | loff_t pos, unsigned len, unsigned flags, | ||
40 | struct page **pagep, void **fsdata) | ||
39 | { | 41 | { |
40 | return cont_prepare_write(page, from, to, hfs_get_block, | 42 | *pagep = NULL; |
41 | &HFS_I(page->mapping->host)->phys_size); | 43 | return cont_write_begin(file, mapping, pos, len, flags, pagep, fsdata, |
44 | hfs_get_block, | ||
45 | &HFS_I(mapping->host)->phys_size); | ||
42 | } | 46 | } |
43 | 47 | ||
44 | static sector_t hfs_bmap(struct address_space *mapping, sector_t block) | 48 | static sector_t hfs_bmap(struct address_space *mapping, sector_t block) |
@@ -119,8 +123,8 @@ const struct address_space_operations hfs_btree_aops = { | |||
119 | .readpage = hfs_readpage, | 123 | .readpage = hfs_readpage, |
120 | .writepage = hfs_writepage, | 124 | .writepage = hfs_writepage, |
121 | .sync_page = block_sync_page, | 125 | .sync_page = block_sync_page, |
122 | .prepare_write = hfs_prepare_write, | 126 | .write_begin = hfs_write_begin, |
123 | .commit_write = generic_commit_write, | 127 | .write_end = generic_write_end, |
124 | .bmap = hfs_bmap, | 128 | .bmap = hfs_bmap, |
125 | .releasepage = hfs_releasepage, | 129 | .releasepage = hfs_releasepage, |
126 | }; | 130 | }; |
@@ -129,8 +133,8 @@ const struct address_space_operations hfs_aops = { | |||
129 | .readpage = hfs_readpage, | 133 | .readpage = hfs_readpage, |
130 | .writepage = hfs_writepage, | 134 | .writepage = hfs_writepage, |
131 | .sync_page = block_sync_page, | 135 | .sync_page = block_sync_page, |
132 | .prepare_write = hfs_prepare_write, | 136 | .write_begin = hfs_write_begin, |
133 | .commit_write = generic_commit_write, | 137 | .write_end = generic_write_end, |
134 | .bmap = hfs_bmap, | 138 | .bmap = hfs_bmap, |
135 | .direct_IO = hfs_direct_IO, | 139 | .direct_IO = hfs_direct_IO, |
136 | .writepages = hfs_writepages, | 140 | .writepages = hfs_writepages, |