git: 15def34bd8c3 - stable/13 - Add GB_NOWITNESS flag

From: Konstantin Belousov <kib_at_FreeBSD.org>
Date: Mon, 07 Feb 2022 09:50:57 UTC
The branch stable/13 has been updated by kib:

URL: https://cgit.FreeBSD.org/src/commit/?id=15def34bd8c3703c13b6fd5eb681c10c7e33b304

commit 15def34bd8c3703c13b6fd5eb681c10c7e33b304
Author:     Konstantin Belousov <kib@FreeBSD.org>
AuthorDate: 2022-01-28 04:37:23 +0000
Commit:     Konstantin Belousov <kib@FreeBSD.org>
CommitDate: 2022-02-07 09:38:50 +0000

    Add GB_NOWITNESS flag
    
    (cherry picked from commit c02780b78c7f1df3e682e1a88b380820c288ec04)
---
 sys/kern/vfs_bio.c | 5 ++++-
 sys/sys/buf.h      | 1 +
 2 files changed, 5 insertions(+), 1 deletion(-)

diff --git a/sys/kern/vfs_bio.c b/sys/kern/vfs_bio.c
index 4491033d44eb..3798d9137d3b 100644
--- a/sys/kern/vfs_bio.c
+++ b/sys/kern/vfs_bio.c
@@ -3987,7 +3987,10 @@ loop:
 		 * it must be on a queue.
 		 */
 		lockflags = LK_EXCLUSIVE | LK_INTERLOCK |
-		    ((flags & GB_LOCK_NOWAIT) ? LK_NOWAIT : LK_SLEEPFAIL);
+		    ((flags & GB_LOCK_NOWAIT) != 0 ? LK_NOWAIT : LK_SLEEPFAIL);
+#ifdef WITNESS
+		lockflags |= (flags & GB_NOWITNESS) != 0 ? LK_NOWITNESS : 0;
+#endif
 
 		error = BUF_TIMELOCK(bp, lockflags,
 		    BO_LOCKPTR(bo), "getblk", slpflag, slptimeo);
diff --git a/sys/sys/buf.h b/sys/sys/buf.h
index e1b0450e2613..fcc4a4689130 100644
--- a/sys/sys/buf.h
+++ b/sys/sys/buf.h
@@ -497,6 +497,7 @@ buf_track(struct buf *bp __unused, const char *location __unused)
 #define	GB_CKHASH	0x0020		/* If reading, calc checksum hash */
 #define	GB_NOSPARSE	0x0040		/* Do not instantiate holes */
 #define	GB_CVTENXIO	0x0080		/* Convert errors to ENXIO */
+#define	GB_NOWITNESS	0x0100		/* Do not record for WITNESS */
 
 #ifdef _KERNEL
 extern int	nbuf;			/* The number of buffer headers */