1753797 Members
7626 Online
108805 Solutions
New Discussion

buf->b_pcnt field

 
Kallol Biswas
Occasional Contributor

buf->b_pcnt field

Hello,
I have partly decoded biodone() routine, it appears to be that a wakeup is called in the routine when *buf->b_pcnt <= 0, the comment
in buf.h says, "int *b_pcnt; /* decr in biodone(), wakeup on < 0
*/"

Please see the next few lines of assemble and my C source code reconstruction.

%r3 contains bp

(kwdb 0:0) q4 fields -hex struct buf |grep b_pcnt
0X108 0 8 0 * b_pcnt

%r26 (arg0) contains bp

0x12fef8 : ldd 0x108(%r3),%r26

call get_sleep_lock(bp)

0x12fefc : call 0x153470

//store the return value of the call in the stack

0x12ff00 : ldo -0x30(%sp),%ret1
0x12ff04 : std %ret0,-0xa0(%sp)

%r3 contains bp

load bp->b_pcnt to %r22

0x12ff08 : ldd 0x108(%r3),%r22

load *bp->b_pcnt to %rp

0x12ff0c : ldw 0(%r22),%rp

(*bp->b_pcnt)--;

0x12ff10 : ldo -1(%rp),%r1
0x12ff14 : stw %r1,0(%r22)

if ((*bp->b_pcnt) > 0) {
jump to biodone+0x200
}
0x12ff18 : cmpb,<,n %r0,%r1,0x12ff90

load %r26 with bp->b_pcnt

0x12ff1c : ldd 0x108(%r3),%r26

call wakeup (bp->b_pcnt);

0x12ff20 : call 0x153aa0

0x12ff24 : ldo -0x30(%sp),%ret1

bp->b_pcnt = NULL;

0x12ff28 : std %r0,0x108(%r3)
...........

QUESTION:: Where can I get more information on
bp->b_pcnt? Looks like that the IOs are related together if b_pcnt is set. For the last IO issue an wakeup. Anyway, who issues this type of IOs?

Kallol