git: 6ab67f3b20ac - stable/11 - Export sbuf_drain to orchestrate lock and drain action
Richard Scheffenegger
rscheff at FreeBSD.org
Fri Apr 16 19:40:59 UTC 2021
The branch stable/11 has been updated by rscheff:
URL: https://cgit.FreeBSD.org/src/commit/?id=6ab67f3b20ac44e9e9741bd0bdf557c3aa118d32
commit 6ab67f3b20ac44e9e9741bd0bdf557c3aa118d32
Author: Richard Scheffenegger <rscheff at FreeBSD.org>
AuthorDate: 2021-03-31 16:25:53 +0000
Commit: Richard Scheffenegger <rscheff at FreeBSD.org>
CommitDate: 2021-04-16 19:37:02 +0000
Export sbuf_drain to orchestrate lock and drain action
While exporting large amounts of data to a sysctl
request, datastructures may need to be locked.
Exporting the sbuf_drain function allows the
coordination between drain events and held
locks, to avoid stalls.
PR: 254333
Reviewed By: jhb
MFC after: 2 weeks
Sponsored by: NetApp, Inc.
Differential Revision: https://reviews.freebsd.org/D29481
(cherry picked from commit c804c8f2c58ba42d476de07fbceff9ac4dd95f0e)
---
sys/kern/subr_sbuf.c | 2 +-
sys/sys/sbuf.h | 1 +
2 files changed, 2 insertions(+), 1 deletion(-)
diff --git a/sys/kern/subr_sbuf.c b/sys/kern/subr_sbuf.c
index d7465f9dd758..164209988670 100644
--- a/sys/kern/subr_sbuf.c
+++ b/sys/kern/subr_sbuf.c
@@ -355,7 +355,7 @@ sbuf_set_drain(struct sbuf *s, sbuf_drain_func *func, void *ctx)
/*
* Call the drain and process the return.
*/
-static int
+int
sbuf_drain(struct sbuf *s)
{
int len;
diff --git a/sys/sys/sbuf.h b/sys/sys/sbuf.h
index c05bafd1e598..be574fe7910b 100644
--- a/sys/sys/sbuf.h
+++ b/sys/sys/sbuf.h
@@ -88,6 +88,7 @@ int sbuf_vprintf(struct sbuf *, const char *, __va_list)
__printflike(2, 0);
int sbuf_putc(struct sbuf *, int);
void sbuf_set_drain(struct sbuf *, sbuf_drain_func *, void *);
+int sbuf_drain(struct sbuf *);
int sbuf_trim(struct sbuf *);
int sbuf_error(const struct sbuf *);
int sbuf_finish(struct sbuf *);
More information about the dev-commits-src-all
mailing list