]> pilppa.org Git - linux-2.6-omap-h63xx.git/blobdiff - fs/hfsplus/extents.c
Merge git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux-2.6 into for-linus
[linux-2.6-omap-h63xx.git] / fs / hfsplus / extents.c
index e3ff56a030117325cecc46982258829390d64671..12e899cd78866543edb5bfe6510ce113ced5d721 100644 (file)
@@ -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;
@@ -349,10 +350,9 @@ int hfsplus_file_extend(struct inode *inode)
 
        if (HFSPLUS_SB(sb).alloc_file->i_size * 8 < HFSPLUS_SB(sb).total_blocks - HFSPLUS_SB(sb).free_blocks + 8) {
                // extend alloc file
-               printk("extend alloc file! (%Lu,%u,%u)\n", HFSPLUS_SB(sb).alloc_file->i_size * 8,
+               printk(KERN_ERR "hfs: extend alloc file! (%Lu,%u,%u)\n", HFSPLUS_SB(sb).alloc_file->i_size * 8,
                        HFSPLUS_SB(sb).total_blocks, HFSPLUS_SB(sb).free_blocks);
                return -ENOSPC;
-               //BUG();
        }
 
        down(&HFSPLUS_I(inode).extents_lock);
@@ -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)