summaryrefslogtreecommitdiffstats
path: root/sys/kern/subr_sfbuf.c
diff options
context:
space:
mode:
Diffstat (limited to 'sys/kern/subr_sfbuf.c')
-rw-r--r--sys/kern/subr_sfbuf.c16
1 files changed, 16 insertions, 0 deletions
diff --git a/sys/kern/subr_sfbuf.c b/sys/kern/subr_sfbuf.c
index e4309d1..1950f69 100644
--- a/sys/kern/subr_sfbuf.c
+++ b/sys/kern/subr_sfbuf.c
@@ -201,6 +201,22 @@ sf_buf_free(struct sf_buf *sf)
mtx_unlock(&sf_buf_lock);
}
+void
+sf_buf_ref(struct sf_buf *sf)
+{
+
+#ifdef SFBUF_OPTIONAL_DIRECT_MAP
+ if (SFBUF_OPTIONAL_DIRECT_MAP)
+ return;
+#endif
+
+ KASSERT(sf->ref_count > 0, ("%s: sf %p not allocated", __func__, sf));
+
+ mtx_lock(&sf_buf_lock);
+ sf->ref_count++;
+ mtx_unlock(&sf_buf_lock);
+}
+
#ifdef SFBUF_PROCESS_PAGE
/*
* Run callback function on sf_buf that holds a certain page.
OpenPOWER on IntegriCloud