diff --git a/sys/geom/geom_vfs.c b/sys/geom/geom_vfs.c --- a/sys/geom/geom_vfs.c +++ b/sys/geom/geom_vfs.c @@ -124,12 +124,12 @@ mp = cdevp->si_mountpt; if (mp != NULL) { if (bp->b_iocmd == BIO_READ) { - if (LK_HOLDER(bp->b_lock.lk_lock) == LK_KERNPROC) + if (BUF_DISOWNED(bp)) mp->mnt_stat.f_asyncreads++; else mp->mnt_stat.f_syncreads++; } else if (bp->b_iocmd == BIO_WRITE) { - if (LK_HOLDER(bp->b_lock.lk_lock) == LK_KERNPROC) + if (BUF_DISOWNED(bp)) mp->mnt_stat.f_asyncwrites++; else mp->mnt_stat.f_syncwrites++; diff --git a/sys/sys/buf.h b/sys/sys/buf.h --- a/sys/sys/buf.h +++ b/sys/sys/buf.h @@ -341,6 +341,13 @@ */ #define BUF_ISLOCKED(bp) \ lockstatus(&(bp)->b_lock) + +/* + * Check if a buffer lock is currently held by LK_KERNPROC. + */ +#define BUF_DISOWNED(bp) \ + lockmgr_disowned(&(bp)->b_lock) + /* * Free a buffer lock. */