Lines Matching refs:bn

51 void hfs_bnode_delete(struct hfs_bnode *bn)  in hfs_bnode_delete()  argument
57 if (bn->next) { in hfs_bnode_delete()
58 bn->next->prev = bn->prev; in hfs_bnode_delete()
60 if (bn->prev) { in hfs_bnode_delete()
61 bn->prev->next = bn->next; in hfs_bnode_delete()
64 if (bhash(bn->tree, bn->node) == bn) { in hfs_bnode_delete()
65 bhash(bn->tree, bn->node) = bn->next; in hfs_bnode_delete()
68 hfs_buffer_put(bn->buf); /* safe: checks for NULL argument */ in hfs_bnode_delete()
69 HFS_DELETE(bn); in hfs_bnode_delete()
206 struct hfs_bnode *bn = bnr->bn; in hfs_bnode_lock() local
208 if ((lock_type == bnr->lock_type) || !bn) { in hfs_bnode_lock()
213 hfs_bnode_commit(bnr->bn); in hfs_bnode_lock()
233 while (bn->lock || waitqueue_active(&bn->wqueue)) { in hfs_bnode_lock()
234 hfs_sleep_on(&bn->rqueue); in hfs_bnode_lock()
236 ++bn->count; in hfs_bnode_lock()
255 while (bn->resrv) { in hfs_bnode_lock()
256 hfs_sleep_on(&bn->rqueue); in hfs_bnode_lock()
258 bn->resrv = 1; in hfs_bnode_lock()
259 ++bn->count; in hfs_bnode_lock()
263 bn->lock = 0; in hfs_bnode_lock()
264 hfs_wake_up(&bn->rqueue); in hfs_bnode_lock()
276 while (bn->resrv) { in hfs_bnode_lock()
277 hfs_sleep_on(&bn->rqueue); in hfs_bnode_lock()
279 bn->resrv = 1; in hfs_bnode_lock()
280 ++bn->count; in hfs_bnode_lock()
282 while (bn->count > 1) { in hfs_bnode_lock()
283 hfs_sleep_on(&bn->wqueue); in hfs_bnode_lock()
285 bn->lock = 1; in hfs_bnode_lock()
304 if (bn->count == 2) { in hfs_bnode_lock()
305 hfs_wake_up(&bn->wqueue); in hfs_bnode_lock()
314 bn->lock = 0; in hfs_bnode_lock()
334 bn->resrv = 0; in hfs_bnode_lock()
335 hfs_wake_up(&bn->rqueue); in hfs_bnode_lock()
338 --bn->count; in hfs_bnode_lock()
378 struct hfs_bnode *bn; in hfs_bnode_relse() local
380 if (!bnr || !(bn = bnr->bn)) { in hfs_bnode_relse()
387 if ((bn->count > 1) || (waitqueue_active(&bn->rqueue)) || (bn->sticky != HFS_NOT_STICKY)) { in hfs_bnode_relse()
392 hfs_bnode_commit(bn); in hfs_bnode_relse()
394 hfs_bnode_delete(bn); in hfs_bnode_relse()
397 bnr->bn = NULL; in hfs_bnode_relse()
435 struct hfs_bnode *bn; in hfs_bnode_find() local
440 bnr.bn = NULL; in hfs_bnode_find()
451 bn = &tree->head; in hfs_bnode_find()
454 bn = tree->root; in hfs_bnode_find()
460 bn = bhash(tree, node); in hfs_bnode_find()
461 while (bn && (bn->magic == HFS_BNODE_MAGIC)) { in hfs_bnode_find()
462 if (bn->node == node) { in hfs_bnode_find()
465 bn = bn->next; in hfs_bnode_find()
477 bn = empty; in hfs_bnode_find()
478 hfs_bnode_read(bn, tree, node, HFS_NOT_STICKY); in hfs_bnode_find()
483 if (bn->magic != HFS_BNODE_MAGIC) { in hfs_bnode_find()
501 bnr.bn = bn; in hfs_bnode_find()
505 if (!hfs_buffer_ok(bn->buf)) { in hfs_bnode_find()
510 if (!bnr.bn) { in hfs_bnode_find()
513 hfs_warn("hfs_bnode_find: use %d(%d) lvl %d [%d]\n", bn->count, in hfs_bnode_find()
514 bn->buf->b_count, bn->ndNHeight, bnode_count); in hfs_bnode_find()
516 bn->ndBLink, bn->ndFLink, bn->ndNRecs); in hfs_bnode_find()
528 void hfs_bnode_commit(struct hfs_bnode *bn) in hfs_bnode_commit() argument
530 if (hfs_buffer_ok(bn->buf)) { in hfs_bnode_commit()
532 nd = (struct NodeDescriptor *)hfs_buffer_data(bn->buf); in hfs_bnode_commit()
534 hfs_put_hl(bn->ndFLink, nd->ndFLink); in hfs_bnode_commit()
535 hfs_put_hl(bn->ndBLink, nd->ndBLink); in hfs_bnode_commit()
536 nd->ndType = bn->ndType; in hfs_bnode_commit()
537 nd->ndNHeight = bn->ndNHeight; in hfs_bnode_commit()
538 hfs_put_hs(bn->ndNRecs, nd->ndNRecs); in hfs_bnode_commit()
539 hfs_buffer_dirty(bn->buf); in hfs_bnode_commit()
542 hfs_mdb_dirty(bn->tree->sys_mdb); in hfs_bnode_commit()