Fedora kernel-2.6.17-1.2142_FC4 patched with stable patch-2.6.17.4-vs2.0.2-rc26.diff
[linux-2.6.git] / fs / hfsplus / extents.c
index 376498c..1a74800 100644 (file)
 #include <linux/errno.h>
 #include <linux/fs.h>
 #include <linux/pagemap.h>
-#include <linux/version.h>
 
 #include "hfsplus_fs.h"
 #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;
@@ -350,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);
@@ -461,7 +460,9 @@ void hfsplus_file_truncate(struct inode *inode)
                page_cache_release(page);
                mark_inode_dirty(inode);
                return;
-       }
+       } else if (inode->i_size == HFSPLUS_I(inode).phys_size)
+               return;
+
        blk_cnt = (inode->i_size + HFSPLUS_SB(sb).alloc_blksz - 1) >> HFSPLUS_SB(sb).alloc_blksz_shift;
        alloc_cnt = HFSPLUS_I(inode).alloc_blocks;
        if (blk_cnt == alloc_cnt)