On Tue, 23 Jun 2015, Emmanuel Dreyfus wrote: > I note we have this in genfs_do_io(), and I suspect this is the same 2 value: > > if (iowrite) { > mutex_enter(vp->v_interlock); > vp->v_numoutput += 2; > mutex_exit(vp->v_interlock); > } > mbp = ge > > Why the vp->v_numoutput += 2 ?
>From what I recall it's because this is a nested buf. You need one for the biodone of the parent buf, and another for the child. Look at the bottom of the routine you will see: loopdone: if (skipbytes) { UVMHIST_LOG(ubchist, "skipbytes %d", skipbytes, 0,0,0); } nestiobuf_done(mbp, skipbytes, error); if (async) { UVMHIST_LOG(ubchist, "returning 0 (async)", 0,0,0,0); return (0); } UVMHIST_LOG(ubchist, "waiting for mbp %p", mbp,0,0,0); error = biowait(mbp); s = splbio(); (*iodone)(mbp); splx(s); UVMHIST_LOG(ubchist, "returning, error %d", error,0,0,0); return (error); } So nestiobuf_done() will result in a call to biodone(), and there is an additional (*iodone)() call at the end for sync operations which also calls biodone(). For async operations the second biodone() is called by the storage driver when the I/O operation completes. Eduardo