# Count the number of buffers in the buffer cache for which
# bp->b_flags & $bufcount_match is non-0.
# @(#)bdump 8.1 (Berkeley) %G%
set $bufcount_match=0x020000
set $bp = bufhash[$i].b_forw
while ($bp != bufhash[$i].b_back)
if ($bp->b_flags & $bufcount_match)
# printf "bucket: %d cumulative %d\n", $i, $num
printf "Number of buffers with flags & %x in hash table: %d\n", $bufcount_match, $num
# Dump the entire buffer cache.
set $bp = bufhash[$i].b_forw
while ($bp != bufhash[$i].b_back)
printf "bp=0x%x flags=0x%x vp=0x%x lblkno=0x%x blkno=0x%x\n", $bp, $bp->b_flags, $bp->b_vp, $bp->b_lblkno, $bp->b_blkno
printf "Number of buffers in hash table: %d\n", $num
# Dump the buffers in a particular hashbucket.
# usage: dumpbucket bucketnumber
set $bp = bufhash[$arg0].b_forw
while ($bp != bufhash[$arg0].b_back)
printf "bp=0x%x flags=0x%x vp=0x%x lblkno=0x%x blkno=0x%x\n", $bp, $bp->b_flags, $bp->b_vp, $bp->b_lblkno, $bp->b_blkno
printf "Number of buffers in bucket %d: %d\n", $arg0, $num
# Dump the buffers on the empty and age queues
set $bp = (struct buf *)bufqueues[$i].qe_next
printf "bp=0x%x flags=0x%x vp=0x%x lbn=%d size=0x%x\n", $bp, $bp->b_flags, $bp->b_vp, $bp->b_lblkno, $bp->b_bufsize
set $bp = (struct buf *)$bp->b_freelist.qe_next
printf "Number of buffers in free lists: %d\n", $num
set $bp = (struct buf *)$arg0
printf "bp=0x%x flags=0x%x bn=0x%x lbn=%d count=%d size=%d\n", $bp, $bp->b_flags, $bp->b_blkno, $bp->b_lblkno, $bp->b_bcount, $bp->b_bufsize
set $bp = (struct buf *)$bp->b_vnbufs.qe_next
printf "Queue %d\n", $arg0
set $bp = (struct buf *)bufqueues[$arg0].qe_next
printf "bp=0x%x flags=0x%x vp=0x%x lbn=%d size=0x%x\n", $bp, $bp->b_flags, $bp->b_vp, $bp->b_lblkno, $bp->b_bufsize
set $bp = (struct buf *)$bp->b_freelist.qe_next
printf "Number of buffers on queue %d: %d\n", $arg0, $num