X-Git-Url: https://err.no/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=fs%2Fhfsplus%2Fextents.c;h=12e899cd78866543edb5bfe6510ce113ced5d721;hb=37969581301e50872a1ae84dc73962b5f7ee6b76;hp=1a7480089e82ef918cb71c91a52c4e86b214c2df;hpb=cf9e50a920be24b734fb91f19b8844f8509cb981;p=linux-2.6 diff --git a/fs/hfsplus/extents.c b/fs/hfsplus/extents.c index 1a7480089e..12e899cd78 100644 --- a/fs/hfsplus/extents.c +++ b/fs/hfsplus/extents.c @@ -443,21 +443,18 @@ void hfsplus_file_truncate(struct inode *inode) if (inode->i_size > HFSPLUS_I(inode).phys_size) { struct address_space *mapping = inode->i_mapping; struct page *page; - u32 size = inode->i_size - 1; + void *fsdata; + u32 size = inode->i_size; int res; - page = grab_cache_page(mapping, size >> PAGE_CACHE_SHIFT); - if (!page) - return; - size &= PAGE_CACHE_SIZE - 1; - size++; - res = mapping->a_ops->prepare_write(NULL, page, size, size); - if (!res) - res = mapping->a_ops->commit_write(NULL, page, size, size); + res = pagecache_write_begin(NULL, mapping, size, 0, + AOP_FLAG_UNINTERRUPTIBLE, + &page, &fsdata); if (res) - inode->i_size = HFSPLUS_I(inode).phys_size; - unlock_page(page); - page_cache_release(page); + return; + res = pagecache_write_end(NULL, mapping, size, 0, 0, page, fsdata); + if (res < 0) + return; mark_inode_dirty(inode); return; } else if (inode->i_size == HFSPLUS_I(inode).phys_size)