mirror of
https://github.com/freebsd/freebsd-src
synced 2024-10-06 16:40:47 +00:00
buf: define and use BUF_DISOWNED
Implement an API where previously code was directly reaching into the buf's internal lock. Reviewed by: mckusick, imp, kib, markj Sponsored by: Dell EMC Isilon Differential Revision: https://reviews.freebsd.org/D45249
This commit is contained in:
parent
b92cd6b294
commit
bd56aad33c
|
@ -124,12 +124,12 @@ g_vfs_done(struct bio *bip)
|
|||
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++;
|
||||
|
|
|
@ -341,6 +341,13 @@ struct buf {
|
|||
*/
|
||||
#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.
|
||||
*/
|
||||
|
|
Loading…
Reference in a new issue