diff options
Diffstat (limited to 'fs/jfs/jfs_dtree.c')
-rw-r--r-- | fs/jfs/jfs_dtree.c | 199 |
1 files changed, 0 insertions, 199 deletions
diff --git a/fs/jfs/jfs_dtree.c b/fs/jfs/jfs_dtree.c index 8676aee3ae48..73b5fc7eda80 100644 --- a/fs/jfs/jfs_dtree.c +++ b/fs/jfs/jfs_dtree.c | |||
@@ -4554,202 +4554,3 @@ int dtModify(tid_t tid, struct inode *ip, | |||
4554 | 4554 | ||
4555 | return 0; | 4555 | return 0; |
4556 | } | 4556 | } |
4557 | |||
4558 | #ifdef _JFS_DEBUG_DTREE | ||
4559 | /* | ||
4560 | * dtDisplayTree() | ||
4561 | * | ||
4562 | * function: traverse forward | ||
4563 | */ | ||
4564 | int dtDisplayTree(struct inode *ip) | ||
4565 | { | ||
4566 | int rc; | ||
4567 | struct metapage *mp; | ||
4568 | dtpage_t *p; | ||
4569 | s64 bn, pbn; | ||
4570 | int index, lastindex, v, h; | ||
4571 | pxd_t *xd; | ||
4572 | struct btstack btstack; | ||
4573 | struct btframe *btsp; | ||
4574 | struct btframe *parent; | ||
4575 | u8 *stbl; | ||
4576 | int psize = 256; | ||
4577 | |||
4578 | printk("display B+-tree.\n"); | ||
4579 | |||
4580 | /* clear stack */ | ||
4581 | btsp = btstack.stack; | ||
4582 | |||
4583 | /* | ||
4584 | * start with root | ||
4585 | * | ||
4586 | * root resides in the inode | ||
4587 | */ | ||
4588 | bn = 0; | ||
4589 | v = h = 0; | ||
4590 | |||
4591 | /* | ||
4592 | * first access of each page: | ||
4593 | */ | ||
4594 | newPage: | ||
4595 | DT_GETPAGE(ip, bn, mp, psize, p, rc); | ||
4596 | if (rc) | ||
4597 | return rc; | ||
4598 | |||
4599 | /* process entries forward from first index */ | ||
4600 | index = 0; | ||
4601 | lastindex = p->header.nextindex - 1; | ||
4602 | |||
4603 | if (p->header.flag & BT_INTERNAL) { | ||
4604 | /* | ||
4605 | * first access of each internal page | ||
4606 | */ | ||
4607 | printf("internal page "); | ||
4608 | dtDisplayPage(ip, bn, p); | ||
4609 | |||
4610 | goto getChild; | ||
4611 | } else { /* (p->header.flag & BT_LEAF) */ | ||
4612 | |||
4613 | /* | ||
4614 | * first access of each leaf page | ||
4615 | */ | ||
4616 | printf("leaf page "); | ||
4617 | dtDisplayPage(ip, bn, p); | ||
4618 | |||
4619 | /* | ||
4620 | * process leaf page entries | ||
4621 | * | ||
4622 | for ( ; index <= lastindex; index++) | ||
4623 | { | ||
4624 | } | ||
4625 | */ | ||
4626 | |||
4627 | /* unpin the leaf page */ | ||
4628 | DT_PUTPAGE(mp); | ||
4629 | } | ||
4630 | |||
4631 | /* | ||
4632 | * go back up to the parent page | ||
4633 | */ | ||
4634 | getParent: | ||
4635 | /* pop/restore parent entry for the current child page */ | ||
4636 | if ((parent = (btsp == btstack.stack ? NULL : --btsp)) == NULL) | ||
4637 | /* current page must have been root */ | ||
4638 | return; | ||
4639 | |||
4640 | /* | ||
4641 | * parent page scan completed | ||
4642 | */ | ||
4643 | if ((index = parent->index) == (lastindex = parent->lastindex)) { | ||
4644 | /* go back up to the parent page */ | ||
4645 | goto getParent; | ||
4646 | } | ||
4647 | |||
4648 | /* | ||
4649 | * parent page has entries remaining | ||
4650 | */ | ||
4651 | /* get back the parent page */ | ||
4652 | bn = parent->bn; | ||
4653 | /* v = parent->level; */ | ||
4654 | DT_GETPAGE(ip, bn, mp, PSIZE, p, rc); | ||
4655 | if (rc) | ||
4656 | return rc; | ||
4657 | |||
4658 | /* get next parent entry */ | ||
4659 | index++; | ||
4660 | |||
4661 | /* | ||
4662 | * internal page: go down to child page of current entry | ||
4663 | */ | ||
4664 | getChild: | ||
4665 | /* push/save current parent entry for the child page */ | ||
4666 | btsp->bn = pbn = bn; | ||
4667 | btsp->index = index; | ||
4668 | btsp->lastindex = lastindex; | ||
4669 | /* btsp->level = v; */ | ||
4670 | /* btsp->node = h; */ | ||
4671 | ++btsp; | ||
4672 | |||
4673 | /* get current entry for the child page */ | ||
4674 | stbl = DT_GETSTBL(p); | ||
4675 | xd = (pxd_t *) & p->slot[stbl[index]]; | ||
4676 | |||
4677 | /* | ||
4678 | * first access of each internal entry: | ||
4679 | */ | ||
4680 | |||
4681 | /* get child page */ | ||
4682 | bn = addressPXD(xd); | ||
4683 | psize = lengthPXD(xd) << ip->i_ipmnt->i_l2bsize; | ||
4684 | |||
4685 | printk("traverse down 0x%Lx[%d]->0x%Lx\n", pbn, index, bn); | ||
4686 | v++; | ||
4687 | h = index; | ||
4688 | |||
4689 | /* release parent page */ | ||
4690 | DT_PUTPAGE(mp); | ||
4691 | |||
4692 | /* process the child page */ | ||
4693 | goto newPage; | ||
4694 | } | ||
4695 | |||
4696 | |||
4697 | /* | ||
4698 | * dtDisplayPage() | ||
4699 | * | ||
4700 | * function: display page | ||
4701 | */ | ||
4702 | int dtDisplayPage(struct inode *ip, s64 bn, dtpage_t * p) | ||
4703 | { | ||
4704 | int rc; | ||
4705 | struct metapage *mp; | ||
4706 | struct ldtentry *lh; | ||
4707 | struct idtentry *ih; | ||
4708 | pxd_t *xd; | ||
4709 | int i, j; | ||
4710 | u8 *stbl; | ||
4711 | wchar_t name[JFS_NAME_MAX + 1]; | ||
4712 | struct component_name key = { 0, name }; | ||
4713 | int freepage = 0; | ||
4714 | |||
4715 | if (p == NULL) { | ||
4716 | freepage = 1; | ||
4717 | DT_GETPAGE(ip, bn, mp, PSIZE, p, rc); | ||
4718 | if (rc) | ||
4719 | return rc; | ||
4720 | } | ||
4721 | |||
4722 | /* display page control */ | ||
4723 | printk("bn:0x%Lx flag:0x%08x nextindex:%d\n", | ||
4724 | bn, p->header.flag, p->header.nextindex); | ||
4725 | |||
4726 | /* display entries */ | ||
4727 | stbl = DT_GETSTBL(p); | ||
4728 | for (i = 0, j = 1; i < p->header.nextindex; i++, j++) { | ||
4729 | dtGetKey(p, i, &key, JFS_SBI(ip->i_sb)->mntflag); | ||
4730 | key.name[key.namlen] = '\0'; | ||
4731 | if (p->header.flag & BT_LEAF) { | ||
4732 | lh = (struct ldtentry *) & p->slot[stbl[i]]; | ||
4733 | printf("\t[%d] %s:%d", i, key.name, | ||
4734 | le32_to_cpu(lh->inumber)); | ||
4735 | } else { | ||
4736 | ih = (struct idtentry *) & p->slot[stbl[i]]; | ||
4737 | xd = (pxd_t *) ih; | ||
4738 | bn = addressPXD(xd); | ||
4739 | printf("\t[%d] %s:0x%Lx", i, key.name, bn); | ||
4740 | } | ||
4741 | |||
4742 | if (j == 4) { | ||
4743 | printf("\n"); | ||
4744 | j = 0; | ||
4745 | } | ||
4746 | } | ||
4747 | |||
4748 | printf("\n"); | ||
4749 | |||
4750 | if (freepage) | ||
4751 | DT_PUTPAGE(mp); | ||
4752 | |||
4753 | return 0; | ||
4754 | } | ||
4755 | #endif /* _JFS_DEBUG_DTREE */ | ||