• Home
  • Raw
  • Download

Lines Matching refs:btree

15 		   struct bplus_header *btree, unsigned sec,  in hpfs_bplus_lookup()  argument
24 if (bp_internal(btree)) { in hpfs_bplus_lookup()
25 for (i = 0; i < btree->n_used_nodes; i++) in hpfs_bplus_lookup()
26 if (le32_to_cpu(btree->u.internal[i].file_secno) > sec) { in hpfs_bplus_lookup()
27 a = le32_to_cpu(btree->u.internal[i].down); in hpfs_bplus_lookup()
30 btree = &anode->btree; in hpfs_bplus_lookup()
37 for (i = 0; i < btree->n_used_nodes; i++) in hpfs_bplus_lookup()
38 if (le32_to_cpu(btree->u.external[i].file_secno) <= sec && in hpfs_bplus_lookup()
39 … le32_to_cpu(btree->u.external[i].file_secno) + le32_to_cpu(btree->u.external[i].length) > sec) { in hpfs_bplus_lookup()
40 …a = le32_to_cpu(btree->u.external[i].disk_secno) + sec - le32_to_cpu(btree->u.external[i].file_sec… in hpfs_bplus_lookup()
47 hpfs_inode->i_file_sec = le32_to_cpu(btree->u.external[i].file_secno); in hpfs_bplus_lookup()
48 hpfs_inode->i_disk_sec = le32_to_cpu(btree->u.external[i].disk_secno); in hpfs_bplus_lookup()
49 hpfs_inode->i_n_secs = le32_to_cpu(btree->u.external[i].length); in hpfs_bplus_lookup()
63 struct bplus_header *btree; in hpfs_add_sector_to_btree() local
74 btree = &fnode->btree; in hpfs_add_sector_to_btree()
77 btree = &anode->btree; in hpfs_add_sector_to_btree()
81 if ((n = btree->n_used_nodes - 1) < -!!fnod) { in hpfs_add_sector_to_btree()
86 if (bp_internal(btree)) { in hpfs_add_sector_to_btree()
87 a = le32_to_cpu(btree->u.internal[n].down); in hpfs_add_sector_to_btree()
88 btree->u.internal[n].file_secno = cpu_to_le32(-1); in hpfs_add_sector_to_btree()
94 btree = &anode->btree; in hpfs_add_sector_to_btree()
98 …if (le32_to_cpu(btree->u.external[n].file_secno) + le32_to_cpu(btree->u.external[n].length) != fse… in hpfs_add_sector_to_btree()
100 le32_to_cpu(btree->u.external[n].file_secno) + le32_to_cpu(btree->u.external[n].length), fsecno, in hpfs_add_sector_to_btree()
105 …if (hpfs_alloc_if_possible(s, se = le32_to_cpu(btree->u.external[n].disk_secno) + le32_to_cpu(btre… in hpfs_add_sector_to_btree()
106 le32_add_cpu(&btree->u.external[n].length, 1); in hpfs_add_sector_to_btree()
123 …fs = n < 0 ? 0 : le32_to_cpu(btree->u.external[n].file_secno) + le32_to_cpu(btree->u.external[n].l… in hpfs_add_sector_to_btree()
124 if (!btree->n_free_nodes) { in hpfs_add_sector_to_btree()
133 anode->btree.flags |= BP_fnode_parent; in hpfs_add_sector_to_btree()
134 anode->btree.n_used_nodes = btree->n_used_nodes; in hpfs_add_sector_to_btree()
135 anode->btree.first_free = btree->first_free; in hpfs_add_sector_to_btree()
136 anode->btree.n_free_nodes = 40 - anode->btree.n_used_nodes; in hpfs_add_sector_to_btree()
137 memcpy(&anode->u, &btree->u, btree->n_used_nodes * 12); in hpfs_add_sector_to_btree()
138 btree->flags |= BP_internal; in hpfs_add_sector_to_btree()
139 btree->n_free_nodes = 11; in hpfs_add_sector_to_btree()
140 btree->n_used_nodes = 1; in hpfs_add_sector_to_btree()
141 btree->first_free = cpu_to_le16((char *)&(btree->u.internal[1]) - (char *)btree); in hpfs_add_sector_to_btree()
142 btree->u.internal[0].file_secno = cpu_to_le32(-1); in hpfs_add_sector_to_btree()
143 btree->u.internal[0].down = cpu_to_le32(na); in hpfs_add_sector_to_btree()
154 btree = &anode->btree; in hpfs_add_sector_to_btree()
156 btree->n_free_nodes--; n = btree->n_used_nodes++; in hpfs_add_sector_to_btree()
157 le16_add_cpu(&btree->first_free, 12); in hpfs_add_sector_to_btree()
158 btree->u.external[n].disk_secno = cpu_to_le32(se); in hpfs_add_sector_to_btree()
159 btree->u.external[n].file_secno = cpu_to_le32(fs); in hpfs_add_sector_to_btree()
160 btree->u.external[n].length = cpu_to_le32(1); in hpfs_add_sector_to_btree()
171 btree = &anode->btree; in hpfs_add_sector_to_btree()
174 btree = &fnode->btree; in hpfs_add_sector_to_btree()
176 if (btree->n_free_nodes) { in hpfs_add_sector_to_btree()
177 btree->n_free_nodes--; n = btree->n_used_nodes++; in hpfs_add_sector_to_btree()
178 le16_add_cpu(&btree->first_free, 8); in hpfs_add_sector_to_btree()
179 btree->u.internal[n].file_secno = cpu_to_le32(-1); in hpfs_add_sector_to_btree()
180 btree->u.internal[n].down = cpu_to_le32(na); in hpfs_add_sector_to_btree()
181 btree->u.internal[n-1].file_secno = cpu_to_le32(fs); in hpfs_add_sector_to_btree()
189 anode->btree.flags |= BP_fnode_parent; in hpfs_add_sector_to_btree()
191 anode->btree.flags &= ~BP_fnode_parent; in hpfs_add_sector_to_btree()
198 btree->u.internal[btree->n_used_nodes - 1].file_secno = cpu_to_le32(/*fs*/-1); in hpfs_add_sector_to_btree()
205 anode->btree.flags |= BP_internal; in hpfs_add_sector_to_btree()
206 anode->btree.n_used_nodes = 1; in hpfs_add_sector_to_btree()
207 anode->btree.n_free_nodes = 59; in hpfs_add_sector_to_btree()
208 anode->btree.first_free = cpu_to_le16(16); in hpfs_add_sector_to_btree()
209 anode->btree.u.internal[0].down = cpu_to_le32(a); in hpfs_add_sector_to_btree()
210 anode->btree.u.internal[0].file_secno = cpu_to_le32(-1); in hpfs_add_sector_to_btree()
223 anode->btree.flags |= BP_fnode_parent; in hpfs_add_sector_to_btree()
232 btree = &anode->btree; in hpfs_add_sector_to_btree()
238 btree = &fnode->btree; in hpfs_add_sector_to_btree()
241 memcpy(&ranode->btree, btree, le16_to_cpu(btree->first_free)); in hpfs_add_sector_to_btree()
243 ranode->btree.flags |= BP_fnode_parent; in hpfs_add_sector_to_btree()
244 ranode->btree.n_free_nodes = (bp_internal(&ranode->btree) ? 60 : 40) - ranode->btree.n_used_nodes; in hpfs_add_sector_to_btree()
245 if (bp_internal(&ranode->btree)) for (n = 0; n < ranode->btree.n_used_nodes; n++) { in hpfs_add_sector_to_btree()
249 unode->btree.flags &= ~BP_fnode_parent; in hpfs_add_sector_to_btree()
254 btree->flags |= BP_internal; in hpfs_add_sector_to_btree()
255 btree->n_free_nodes = fnod ? 10 : 58; in hpfs_add_sector_to_btree()
256 btree->n_used_nodes = 2; in hpfs_add_sector_to_btree()
257 btree->first_free = cpu_to_le16((char *)&btree->u.internal[2] - (char *)btree); in hpfs_add_sector_to_btree()
258 btree->u.internal[0].file_secno = cpu_to_le32(fs); in hpfs_add_sector_to_btree()
259 btree->u.internal[0].down = cpu_to_le32(ra); in hpfs_add_sector_to_btree()
260 btree->u.internal[1].file_secno = cpu_to_le32(-1); in hpfs_add_sector_to_btree()
261 btree->u.internal[1].down = cpu_to_le32(na); in hpfs_add_sector_to_btree()
274 void hpfs_remove_btree(struct super_block *s, struct bplus_header *btree) in hpfs_remove_btree() argument
276 struct bplus_header *btree1 = btree; in hpfs_remove_btree()
294 btree1 = &anode->btree; in hpfs_remove_btree()
310 btree1 = &anode->btree; in hpfs_remove_btree()
311 } else btree1 = btree; in hpfs_remove_btree()
335 return hpfs_bplus_lookup(s, NULL, &anode->btree, sec, bh); in anode_lookup()
391 hpfs_remove_btree(s, &anode->btree); in hpfs_ea_remove()
404 struct bplus_header *btree; in hpfs_truncate_btree() local
410 btree = &fnode->btree; in hpfs_truncate_btree()
413 btree = &anode->btree; in hpfs_truncate_btree()
416 hpfs_remove_btree(s, btree); in hpfs_truncate_btree()
418 btree->n_free_nodes = 8; in hpfs_truncate_btree()
419 btree->n_used_nodes = 0; in hpfs_truncate_btree()
420 btree->first_free = cpu_to_le16(8); in hpfs_truncate_btree()
421 btree->flags &= ~BP_internal; in hpfs_truncate_btree()
427 while (bp_internal(btree)) { in hpfs_truncate_btree()
428 nodes = btree->n_used_nodes + btree->n_free_nodes; in hpfs_truncate_btree()
429 for (i = 0; i < btree->n_used_nodes; i++) in hpfs_truncate_btree()
430 if (le32_to_cpu(btree->u.internal[i].file_secno) >= secs) goto f; in hpfs_truncate_btree()
435 for (j = i + 1; j < btree->n_used_nodes; j++) in hpfs_truncate_btree()
436 hpfs_ea_remove(s, le32_to_cpu(btree->u.internal[j].down), 1, 0); in hpfs_truncate_btree()
437 btree->n_used_nodes = i + 1; in hpfs_truncate_btree()
438 btree->n_free_nodes = nodes - btree->n_used_nodes; in hpfs_truncate_btree()
439 btree->first_free = cpu_to_le16(8 + 8 * btree->n_used_nodes); in hpfs_truncate_btree()
441 if (btree->u.internal[i].file_secno == cpu_to_le32(secs)) { in hpfs_truncate_btree()
445 node = le32_to_cpu(btree->u.internal[i].down); in hpfs_truncate_btree()
451 btree = &anode->btree; in hpfs_truncate_btree()
453 nodes = btree->n_used_nodes + btree->n_free_nodes; in hpfs_truncate_btree()
454 for (i = 0; i < btree->n_used_nodes; i++) in hpfs_truncate_btree()
455 …if (le32_to_cpu(btree->u.external[i].file_secno) + le32_to_cpu(btree->u.external[i].length) >= sec… in hpfs_truncate_btree()
459 if (secs <= le32_to_cpu(btree->u.external[i].file_secno)) { in hpfs_truncate_btree()
463 …else if (le32_to_cpu(btree->u.external[i].file_secno) + le32_to_cpu(btree->u.external[i].length) >… in hpfs_truncate_btree()
464 hpfs_free_sectors(s, le32_to_cpu(btree->u.external[i].disk_secno) + secs - in hpfs_truncate_btree()
465 le32_to_cpu(btree->u.external[i].file_secno), le32_to_cpu(btree->u.external[i].length) in hpfs_truncate_btree()
466 - secs + le32_to_cpu(btree->u.external[i].file_secno)); /* I hope gcc optimizes this :-) */ in hpfs_truncate_btree()
467 btree->u.external[i].length = cpu_to_le32(secs - le32_to_cpu(btree->u.external[i].file_secno)); in hpfs_truncate_btree()
469 for (j = i + 1; j < btree->n_used_nodes; j++) in hpfs_truncate_btree()
470 …hpfs_free_sectors(s, le32_to_cpu(btree->u.external[j].disk_secno), le32_to_cpu(btree->u.external[j… in hpfs_truncate_btree()
471 btree->n_used_nodes = i + 1; in hpfs_truncate_btree()
472 btree->n_free_nodes = nodes - btree->n_used_nodes; in hpfs_truncate_btree()
473 btree->first_free = cpu_to_le16(8 + 12 * btree->n_used_nodes); in hpfs_truncate_btree()
488 if (!fnode_is_dir(fnode)) hpfs_remove_btree(s, &fnode->btree); in hpfs_remove_fnode()