basic modification from way back
[powerpc.git] / fs / hfsplus / btree.c
index effa899..90ebab7 100644 (file)
@@ -10,6 +10,7 @@
 
 #include <linux/slab.h>
 #include <linux/pagemap.h>
+#include <linux/log2.h>
 
 #include "hfsplus_fs.h"
 #include "hfsplus_raw.h"
@@ -24,10 +25,9 @@ struct hfs_btree *hfs_btree_open(struct super_block *sb, u32 id)
        struct page *page;
        unsigned int size;
 
-       tree = kmalloc(sizeof(*tree), GFP_KERNEL);
+       tree = kzalloc(sizeof(*tree), GFP_KERNEL);
        if (!tree)
                return NULL;
-       memset(tree, 0, sizeof(*tree));
 
        init_MUTEX(&tree->tree_lock);
        spin_lock_init(&tree->hash_lock);
@@ -38,7 +38,7 @@ struct hfs_btree *hfs_btree_open(struct super_block *sb, u32 id)
                goto free_tree;
 
        mapping = tree->inode->i_mapping;
-       page = read_cache_page(mapping, 0, (filler_t *)mapping->a_ops->readpage, NULL);
+       page = read_mapping_page(mapping, 0, NULL);
        if (IS_ERR(page))
                goto free_tree;
 
@@ -70,7 +70,7 @@ struct hfs_btree *hfs_btree_open(struct super_block *sb, u32 id)
        }
 
        size = tree->node_size;
-       if (!size || size & (size - 1))
+       if (!is_power_of_2(size))
                goto fail_page;
        if (!tree->node_count)
                goto fail_page;