aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKonstantin Belousov <kib@FreeBSD.org>2026-04-22 05:09:34 +0000
committerKonstantin Belousov <kib@FreeBSD.org>2026-05-07 11:59:11 +0000
commitce4e8c478a261ce6c7af7d81817f86420c5239b9 (patch)
treef88d8aea8353b505b6fc218860bb2f3fe37a752c
parentef19cae25337e7449f338914650bbfab0fbea99f (diff)
bufspace_wait(): only try to help bufdaemon if there is a chance to help
Only call buf_flush() if there are some dirty buffers belonging to the vnode we are allocating the buffer for. Otherwise the bd dirty queue scan cannot find anything and it makes no sense to spend CPU doing it. Sponsored by: The FreeBSD Foundation MFC after: 1 week
-rw-r--r--sys/kern/vfs_bio.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/sys/kern/vfs_bio.c b/sys/kern/vfs_bio.c
index 8f47a7abbc5e..675f6fb4e526 100644
--- a/sys/kern/vfs_bio.c
+++ b/sys/kern/vfs_bio.c
@@ -727,7 +727,8 @@ bufspace_wait(struct bufdomain *bd, struct vnode *vp, int gbflags,
BD_LOCK(bd);
while (bd->bd_wanted) {
if (vp != NULL && vp->v_type != VCHR &&
- (td->td_pflags & TDP_BUFNEED) == 0) {
+ (td->td_pflags & TDP_BUFNEED) == 0 &&
+ vp->v_bufobj.bo_dirty.bv_cnt > 0) {
BD_UNLOCK(bd);
/*
* getblk() is called with a vnode locked, and