• Home
  • History
  • Annotate
  • Raw
  • Download
  • only in /netgear-R7000-V1.0.7.12_1.2.5/components/opensource/linux/linux-2.6.36/fs/hfsplus_journal/

Lines Matching refs:tree

22 	struct hfs_btree *tree;
29 tree = kzalloc(sizeof(*tree), GFP_KERNEL);
30 if (!tree)
33 mutex_init(&tree->tree_lock);
34 spin_lock_init(&tree->hash_lock);
35 tree->sb = sb;
36 tree->cnid = id;
40 tree->inode = inode;
42 if (!HFSPLUS_I(tree->inode).first_blocks) {
48 mapping = tree->inode->i_mapping;
55 tree->root = be32_to_cpu(head->root);
56 tree->leaf_count = be32_to_cpu(head->leaf_count);
57 tree->leaf_head = be32_to_cpu(head->leaf_head);
58 tree->leaf_tail = be32_to_cpu(head->leaf_tail);
59 tree->node_count = be32_to_cpu(head->node_count);
60 tree->free_nodes = be32_to_cpu(head->free_nodes);
61 tree->attributes = be32_to_cpu(head->attributes);
62 tree->node_size = be16_to_cpu(head->node_size);
63 tree->max_key_len = be16_to_cpu(head->max_key_len);
64 tree->depth = be16_to_cpu(head->depth);
66 /* Verify the tree and set the correct compare function */
69 if (tree->max_key_len != HFSPLUS_EXT_KEYLEN - sizeof(u16)) {
71 tree->max_key_len);
74 if (tree->attributes & HFS_TREE_VARIDXKEYS) {
79 tree->keycmp = hfsplus_ext_cmp_key;
82 if (tree->max_key_len != HFSPLUS_CAT_KEYLEN - sizeof(u16)) {
84 tree->max_key_len);
87 if (!(tree->attributes & HFS_TREE_VARIDXKEYS)) {
94 tree->keycmp = hfsplus_cat_bin_cmp_key;
96 tree->keycmp = hfsplus_cat_case_cmp_key;
105 if (!(tree->attributes & HFS_TREE_BIGKEYS)) {
110 size = tree->node_size;
113 if (!tree->node_count)
115 tree->node_size_shift = ffs(size) - 1;
117 tree->pages_per_bnode = (tree->node_size + PAGE_CACHE_SIZE - 1) >> PAGE_CACHE_SHIFT;
118 hfsplus_pages_per_bnode=tree->pages_per_bnode;
121 return tree;
124 tree->inode->i_mapping->a_ops = &hfsplus_aops;
127 iput(tree->inode);
129 kfree(tree);
134 void hfs_btree_close(struct hfs_btree *tree)
139 if (!tree)
143 while ((node = tree->node_hash[i])) {
144 tree->node_hash[i] = node->next_hash;
147 node->tree->cnid, node->this, atomic_read(&node->refcnt));
149 tree->node_hash_cnt--;
152 iput(tree->inode);
153 kfree(tree);
156 int hfs_btree_write(hfsplus_handle_t *hfsplus_handle,struct hfs_btree *tree)
162 node = hfs_bnode_find(hfsplus_handle, tree, 0);
170 head->root = cpu_to_be32(tree->root);
171 head->leaf_count = cpu_to_be32(tree->leaf_count);
172 head->leaf_head = cpu_to_be32(tree->leaf_head);
173 head->leaf_tail = cpu_to_be32(tree->leaf_tail);
174 head->node_count = cpu_to_be32(tree->node_count);
175 head->free_nodes = cpu_to_be32(tree->free_nodes);
176 head->attributes = cpu_to_be32(tree->attributes);
177 head->depth = cpu_to_be16(tree->depth);
187 struct hfs_btree *tree = prev->tree;
192 node = hfs_bnode_create(hfsplus_handle, tree, idx);
196 tree->free_nodes--;
203 hfs_bnode_clear(hfsplus_handle, node, 0, tree->node_size);
212 hfs_bnode_write_u16(hfsplus_handle, node, tree->node_size - 2, 14);
213 hfs_bnode_write_u16(hfsplus_handle, node, tree->node_size - 4, tree->node_size - 6);
218 struct hfs_bnode *hfs_bmap_alloc(hfsplus_handle_t *hfsplus_handle, struct hfs_btree *tree)
229 while (!tree->free_nodes) {
230 struct inode *inode = tree->inode;
239 HFSPLUS_SB(tree->sb).alloc_blksz_shift;
241 HFSPLUS_SB(tree->sb).fs_shift;
249 count = inode->i_size >> tree->node_size_shift;
250 tree->free_nodes = count - tree->node_count;
251 tree->node_count = count;
255 node = hfs_bnode_find(hfsplus_handle, tree, nidx);
277 tree->free_nodes--;
278 if (hfsplus_journalled_mark_inode_dirty(__FUNCTION__, hfsplus_handle, tree->inode))
281 return hfs_bnode_create(hfsplus_handle, tree, idx);
299 next_node = hfs_bnode_find(hfsplus_handle, tree, nidx);
316 struct hfs_btree *tree;
324 tree = node->tree;
326 node = hfs_bnode_find(hfsplus_handle, tree, 0);
341 node = hfs_bnode_find(hfsplus_handle, tree, i);
368 tree->free_nodes++;
369 if (hfsplus_journalled_mark_inode_dirty(__FUNCTION__, hfsplus_handle, tree->inode))