diff options
author | Nick Piggin <npiggin@suse.de> | 2007-10-16 04:25:09 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@woody.linux-foundation.org> | 2007-10-16 12:42:56 -0400 |
commit | 7c0efc627738c840a685ea0f2c23d09aad7d5d3b (patch) | |
tree | e51573472f37260d57541bb4456ae1a948307cc7 /fs/hfsplus | |
parent | 7903d9eed82db81c15ee8b4114187dfdcad7650f (diff) |
hfsplus: convert to new aops
Signed-off-by: Nick Piggin <npiggin@suse.de>
Cc: Roman Zippel <zippel@linux-m68k.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'fs/hfsplus')
-rw-r--r-- | fs/hfsplus/extents.c | 21 | ||||
-rw-r--r-- | fs/hfsplus/inode.c | 18 |
2 files changed, 20 insertions, 19 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) |
diff --git a/fs/hfsplus/inode.c b/fs/hfsplus/inode.c index 6f7c662174db..37744cf3706a 100644 --- a/fs/hfsplus/inode.c +++ b/fs/hfsplus/inode.c | |||
@@ -27,10 +27,14 @@ static int hfsplus_writepage(struct page *page, struct writeback_control *wbc) | |||
27 | return block_write_full_page(page, hfsplus_get_block, wbc); | 27 | return block_write_full_page(page, hfsplus_get_block, wbc); |
28 | } | 28 | } |
29 | 29 | ||
30 | static int hfsplus_prepare_write(struct file *file, struct page *page, unsigned from, unsigned to) | 30 | static int hfsplus_write_begin(struct file *file, struct address_space *mapping, |
31 | loff_t pos, unsigned len, unsigned flags, | ||
32 | struct page **pagep, void **fsdata) | ||
31 | { | 33 | { |
32 | return cont_prepare_write(page, from, to, hfsplus_get_block, | 34 | *pagep = NULL; |
33 | &HFSPLUS_I(page->mapping->host).phys_size); | 35 | return cont_write_begin(file, mapping, pos, len, flags, pagep, fsdata, |
36 | hfsplus_get_block, | ||
37 | &HFSPLUS_I(mapping->host).phys_size); | ||
34 | } | 38 | } |
35 | 39 | ||
36 | static sector_t hfsplus_bmap(struct address_space *mapping, sector_t block) | 40 | static sector_t hfsplus_bmap(struct address_space *mapping, sector_t block) |
@@ -114,8 +118,8 @@ const struct address_space_operations hfsplus_btree_aops = { | |||
114 | .readpage = hfsplus_readpage, | 118 | .readpage = hfsplus_readpage, |
115 | .writepage = hfsplus_writepage, | 119 | .writepage = hfsplus_writepage, |
116 | .sync_page = block_sync_page, | 120 | .sync_page = block_sync_page, |
117 | .prepare_write = hfsplus_prepare_write, | 121 | .write_begin = hfsplus_write_begin, |
118 | .commit_write = generic_commit_write, | 122 | .write_end = generic_write_end, |
119 | .bmap = hfsplus_bmap, | 123 | .bmap = hfsplus_bmap, |
120 | .releasepage = hfsplus_releasepage, | 124 | .releasepage = hfsplus_releasepage, |
121 | }; | 125 | }; |
@@ -124,8 +128,8 @@ const struct address_space_operations hfsplus_aops = { | |||
124 | .readpage = hfsplus_readpage, | 128 | .readpage = hfsplus_readpage, |
125 | .writepage = hfsplus_writepage, | 129 | .writepage = hfsplus_writepage, |
126 | .sync_page = block_sync_page, | 130 | .sync_page = block_sync_page, |
127 | .prepare_write = hfsplus_prepare_write, | 131 | .write_begin = hfsplus_write_begin, |
128 | .commit_write = generic_commit_write, | 132 | .write_end = generic_write_end, |
129 | .bmap = hfsplus_bmap, | 133 | .bmap = hfsplus_bmap, |
130 | .direct_IO = hfsplus_direct_IO, | 134 | .direct_IO = hfsplus_direct_IO, |
131 | .writepages = hfsplus_writepages, | 135 | .writepages = hfsplus_writepages, |