Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 31 Mar 2021 17:18:14 GMT
From:      Richard Scheffenegger <rscheff@FreeBSD.org>
To:        src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org
Subject:   git: c804c8f2c58b - main - Export sbuf_drain to orchestrate lock and drain action
Message-ID:  <202103311718.12VHIE2N095769@gitrepo.freebsd.org>

next in thread | raw e-mail | index | archive | help
The branch main has been updated by rscheff:

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

commit c804c8f2c58ba42d476de07fbceff9ac4dd95f0e
Author:     Richard Scheffenegger <rscheff@FreeBSD.org>
AuthorDate: 2021-03-31 16:25:53 +0000
Commit:     Richard Scheffenegger <rscheff@FreeBSD.org>
CommitDate: 2021-03-31 17:17:37 +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
---
 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 20a831aa75b2..66822115dbcb 100644
--- a/sys/kern/subr_sbuf.c
+++ b/sys/kern/subr_sbuf.c
@@ -383,7 +383,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 10b59f360cd0..d87e3917b84c 100644
--- a/sys/sys/sbuf.h
+++ b/sys/sys/sbuf.h
@@ -95,6 +95,7 @@ int		 sbuf_vprintf(struct sbuf *, const char *, __va_list)
 int		 sbuf_nl_terminate(struct sbuf *);
 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 *);



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202103311718.12VHIE2N095769>