Commit 7903d9eed82db81c15ee8b4114187dfdcad7650f
Committed by
Linus Torvalds
1 parent
d7777a25a0
Exists in
master
and in
7 other branches
hfs: 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>
Showing 2 changed files with 19 additions and 18 deletions Side-by-side Diff
fs/hfs/extent.c
... | ... | @@ -464,23 +464,20 @@ |
464 | 464 | (long long)HFS_I(inode)->phys_size, inode->i_size); |
465 | 465 | if (inode->i_size > HFS_I(inode)->phys_size) { |
466 | 466 | struct address_space *mapping = inode->i_mapping; |
467 | + void *fsdata; | |
467 | 468 | struct page *page; |
468 | 469 | int res; |
469 | 470 | |
471 | + /* XXX: Can use generic_cont_expand? */ | |
470 | 472 | size = inode->i_size - 1; |
471 | - page = grab_cache_page(mapping, size >> PAGE_CACHE_SHIFT); | |
472 | - if (!page) | |
473 | - return; | |
474 | - size &= PAGE_CACHE_SIZE - 1; | |
475 | - size++; | |
476 | - res = mapping->a_ops->prepare_write(NULL, page, size, size); | |
477 | - if (!res) | |
478 | - res = mapping->a_ops->commit_write(NULL, page, size, size); | |
473 | + res = pagecache_write_begin(NULL, mapping, size+1, 0, | |
474 | + AOP_FLAG_UNINTERRUPTIBLE, &page, &fsdata); | |
475 | + if (!res) { | |
476 | + res = pagecache_write_end(NULL, mapping, size+1, 0, 0, | |
477 | + page, fsdata); | |
478 | + } | |
479 | 479 | if (res) |
480 | 480 | inode->i_size = HFS_I(inode)->phys_size; |
481 | - unlock_page(page); | |
482 | - page_cache_release(page); | |
483 | - mark_inode_dirty(inode); | |
484 | 481 | return; |
485 | 482 | } else if (inode->i_size == HFS_I(inode)->phys_size) |
486 | 483 | return; |
fs/hfs/inode.c
... | ... | @@ -35,10 +35,14 @@ |
35 | 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, | |
41 | - &HFS_I(page->mapping->host)->phys_size); | |
42 | + *pagep = NULL; | |
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 | 48 | static sector_t hfs_bmap(struct address_space *mapping, sector_t block) |
... | ... | @@ -119,8 +123,8 @@ |
119 | 123 | .readpage = hfs_readpage, |
120 | 124 | .writepage = hfs_writepage, |
121 | 125 | .sync_page = block_sync_page, |
122 | - .prepare_write = hfs_prepare_write, | |
123 | - .commit_write = generic_commit_write, | |
126 | + .write_begin = hfs_write_begin, | |
127 | + .write_end = generic_write_end, | |
124 | 128 | .bmap = hfs_bmap, |
125 | 129 | .releasepage = hfs_releasepage, |
126 | 130 | }; |
... | ... | @@ -129,8 +133,8 @@ |
129 | 133 | .readpage = hfs_readpage, |
130 | 134 | .writepage = hfs_writepage, |
131 | 135 | .sync_page = block_sync_page, |
132 | - .prepare_write = hfs_prepare_write, | |
133 | - .commit_write = generic_commit_write, | |
136 | + .write_begin = hfs_write_begin, | |
137 | + .write_end = generic_write_end, | |
134 | 138 | .bmap = hfs_bmap, |
135 | 139 | .direct_IO = hfs_direct_IO, |
136 | 140 | .writepages = hfs_writepages, |