15 struct buffer_head *bh)
22 if (hpfs_sb(s)->sb_chk)
if (
hpfs_stop_cycles(s, a, &c1, &c2,
"hpfs_bplus_lookup"))
return -1;
23 if (bp_internal(btree)) {
29 btree = &anode->
btree;
32 hpfs_error(s,
"sector %08x not found in internal anode %08x", sec, a);
53 hpfs_error(s,
"sector %08x not found in external anode %08x", sec, a);
67 struct buffer_head *bh, *bh1, *bh2;
73 btree = &fnode->
btree;
76 btree = &anode->
btree;
85 if (bp_internal(btree)) {
90 if (hpfs_sb(s)->sb_chk)
91 if (
hpfs_stop_cycles(s, a, &c1, &c2,
"hpfs_add_sector_to_btree #1"))
return -1;
93 btree = &anode->
btree;
98 hpfs_error(s,
"allocated size %08x, trying to add sector %08x, %cnode %08x",
105 le32_add_cpu(&btree->
u.
external[n].length, 1);
112 hpfs_error(s,
"empty file %08x, trying to add sector %08x", node, fsecno);
116 se = !fnod ? node : (node + 16384) & ~16383;
130 if (a == node && fnod) {
135 anode->
btree.n_free_nodes = 40 - anode->
btree.n_used_nodes;
153 btree = &anode->
btree;
162 if ((a == node && fnod) || na == -1)
return se;
165 struct anode *new_anode;
166 if (hpfs_sb(s)->sb_chk)
167 if (
hpfs_stop_cycles(s, up, &c1, &c2,
"hpfs_add_sector_to_btree #2"))
return -1;
168 if (up != node || !fnod) {
170 btree = &anode->
btree;
173 btree = &fnode->
btree;
187 if (up == node && fnod)
205 anode->
btree.n_used_nodes = 1;
206 anode->
btree.n_free_nodes = 59;
231 btree = &anode->
btree;
237 btree = &fnode->
btree;
243 ranode->btree.n_free_nodes = (bp_internal(&ranode->btree) ? 60 : 40) - ranode->btree.n_used_nodes;
244 if (bp_internal(&ranode->btree))
for (n = 0; n < ranode->btree.n_used_nodes; n++) {
278 struct buffer_head *bh;
286 while (bp_internal(btree1)) {
288 if (level) brelse(bh);
289 if (hpfs_sb(s)->sb_chk)
293 btree1 = &anode->
btree;
302 if (hpfs_sb(s)->sb_chk)
309 btree1 = &anode->
btree;
310 }
else btree1 = btree;
320 "reference to anode %08x not found in anode %08x "
321 "(probably bad up pointer)",
322 oano, level ? ano : -1);
332 struct buffer_head *bh;
338 unsigned len,
char *
buf)
340 struct buffer_head *bh;
346 if ((sec = anode_lookup(s, a, pos >> 9)) == -1)
348 }
else sec = a + (pos >> 9);
349 if (hpfs_sb(s)->sb_chk)
if (
hpfs_chk_sectors(s, sec, 1,
"ea #1"))
return -1;
352 l = 0x200 - (pos & 0x1ff);
if (l > len) l = len;
353 memcpy(buf, data + (pos & 0x1ff), l);
355 buf +=
l; pos +=
l; len -=
l;
361 unsigned len,
const char *
buf)
363 struct buffer_head *bh;
369 if ((sec = anode_lookup(s, a, pos >> 9)) == -1)
371 }
else sec = a + (pos >> 9);
372 if (hpfs_sb(s)->sb_chk)
if (
hpfs_chk_sectors(s, sec, 1,
"ea #2"))
return -1;
375 l = 0x200 - (pos & 0x1ff);
if (l > len) l = len;
376 memcpy(data + (pos & 0x1ff), buf, l);
379 buf +=
l; pos +=
l; len -=
l;
387 struct buffer_head *bh;
402 struct buffer_head *bh;
409 btree = &fnode->
btree;
412 btree = &anode->
btree;
426 while (bp_internal(btree)) {
431 hpfs_error(s,
"internal btree %08x doesn't end with -1", node);
446 if (hpfs_sb(s)->sb_chk)
450 btree = &anode->
btree;
459 hpfs_error(s,
"there is an allocation error in file %08x, sector %08x", f, secs);
482 struct buffer_head *bh;
489 ea_end = fnode_end_ea(fnode);
490 for (ea = fnode_ea(fnode); ea < ea_end; ea = next_ea(ea))