X-Git-Url: https://err.no/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=fs%2Fhfsplus%2Fextents.c;h=12e899cd78866543edb5bfe6510ce113ced5d721;hb=13a6ddb08e58a1bd344da7898c4e2f13bdf18c2f;hp=c95559f69bcbd02037aab15f6450579a579ce7fb;hpb=634725a92938b0f282b17cec0b007dca77adebd2;p=linux-2.6 diff --git a/fs/hfsplus/extents.c b/fs/hfsplus/extents.c index c95559f69b..12e899cd78 100644 --- a/fs/hfsplus/extents.c +++ b/fs/hfsplus/extents.c @@ -16,7 +16,8 @@ #include "hfsplus_raw.h" /* Compare two extents keys, returns 0 on same, pos/neg for difference */ -int hfsplus_ext_cmp_key(hfsplus_btree_key *k1, hfsplus_btree_key *k2) +int hfsplus_ext_cmp_key(const hfsplus_btree_key *k1, + const hfsplus_btree_key *k2) { __be32 k1id, k2id; __be32 k1s, k2s; @@ -442,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)