git: 5438c482cd6b - stable/13 - GEOM: Set G_CF_DIRECT_SEND/RECEIVE for taste consumers.

From: Alexander Motin <mav_at_FreeBSD.org>
Date: Fri, 11 Feb 2022 01:10:41 UTC
The branch stable/13 has been updated by mav:

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

commit 5438c482cd6bc7145ba66202c4bf19e4ceddfdef
Author:     Alexander Motin <mav@FreeBSD.org>
AuthorDate: 2022-01-30 02:59:03 +0000
Commit:     Alexander Motin <mav@FreeBSD.org>
CommitDate: 2022-02-11 00:50:46 +0000

    GEOM: Set G_CF_DIRECT_SEND/RECEIVE for taste consumers.
    
    All I/O requests through the taste consumers are synchronous, done
    with g_read_data() and without any locks held.  It makes no sense
    to delegate the I/O to g_down/g_up threads.
    
    This removes many of context switches during disk retaste.
    
    MFC after:      2 weeks
    
    (cherry picked from commit 10ae42ccbde4fe7c8c9de3d54f3c0d63457a1a68)
---
 sys/geom/cache/g_cache.c         | 1 +
 sys/geom/concat/g_concat.c       | 1 +
 sys/geom/journal/g_journal.c     | 1 +
 sys/geom/linux_lvm/g_linux_lvm.c | 1 +
 sys/geom/mirror/g_mirror.c       | 1 +
 sys/geom/multipath/g_multipath.c | 1 +
 sys/geom/raid3/g_raid3.c         | 1 +
 sys/geom/shsec/g_shsec.c         | 1 +
 sys/geom/stripe/g_stripe.c       | 1 +
 sys/geom/vinum/geom_vinum.c      | 1 +
 sys/geom/virstor/g_virstor.c     | 1 +
 11 files changed, 11 insertions(+)

diff --git a/sys/geom/cache/g_cache.c b/sys/geom/cache/g_cache.c
index 2caae5ede0f4..86c2a9bb36a2 100644
--- a/sys/geom/cache/g_cache.c
+++ b/sys/geom/cache/g_cache.c
@@ -673,6 +673,7 @@ g_cache_taste(struct g_class *mp, struct g_provider *pp, int flags __unused)
 	gp->orphan = g_cache_orphan;
 	gp->access = g_cache_access;
 	cp = g_new_consumer(gp);
+	cp->flags |= G_CF_DIRECT_SEND | G_CF_DIRECT_RECEIVE;
 	error = g_attach(cp, pp);
 	if (error == 0) {
 		error = g_cache_read_metadata(cp, &md);
diff --git a/sys/geom/concat/g_concat.c b/sys/geom/concat/g_concat.c
index dfa7b97a1806..6db293b07146 100644
--- a/sys/geom/concat/g_concat.c
+++ b/sys/geom/concat/g_concat.c
@@ -718,6 +718,7 @@ g_concat_taste(struct g_class *mp, struct g_provider *pp, int flags __unused)
 	gp->access = g_concat_access;
 	gp->orphan = g_concat_orphan;
 	cp = g_new_consumer(gp);
+	cp->flags |= G_CF_DIRECT_SEND | G_CF_DIRECT_RECEIVE;
 	error = g_attach(cp, pp);
 	if (error == 0) {
 		error = g_concat_read_metadata(cp, &md);
diff --git a/sys/geom/journal/g_journal.c b/sys/geom/journal/g_journal.c
index e57d58d6f7ca..eba0f0dcab34 100644
--- a/sys/geom/journal/g_journal.c
+++ b/sys/geom/journal/g_journal.c
@@ -2483,6 +2483,7 @@ g_journal_taste(struct g_class *mp, struct g_provider *pp, int flags __unused)
 	/* This orphan function should be never called. */
 	gp->orphan = g_journal_taste_orphan;
 	cp = g_new_consumer(gp);
+	cp->flags |= G_CF_DIRECT_SEND | G_CF_DIRECT_RECEIVE;
 	error = g_attach(cp, pp);
 	if (error == 0) {
 		error = g_journal_metadata_read(cp, &md);
diff --git a/sys/geom/linux_lvm/g_linux_lvm.c b/sys/geom/linux_lvm/g_linux_lvm.c
index b835baecc93d..f17827757139 100644
--- a/sys/geom/linux_lvm/g_linux_lvm.c
+++ b/sys/geom/linux_lvm/g_linux_lvm.c
@@ -543,6 +543,7 @@ g_llvm_taste(struct g_class *mp, struct g_provider *pp, int flags __unused)
 	/* This orphan function should be never called. */
 	gp->orphan = g_llvm_taste_orphan;
 	cp = g_new_consumer(gp);
+	cp->flags |= G_CF_DIRECT_SEND | G_CF_DIRECT_RECEIVE;
 	error = g_attach(cp, pp);
 	if (error == 0) {
 		error = g_llvm_read_label(cp, &ll);
diff --git a/sys/geom/mirror/g_mirror.c b/sys/geom/mirror/g_mirror.c
index c0641d15673e..455aae4bebf8 100644
--- a/sys/geom/mirror/g_mirror.c
+++ b/sys/geom/mirror/g_mirror.c
@@ -3259,6 +3259,7 @@ g_mirror_taste(struct g_class *mp, struct g_provider *pp, int flags __unused)
 	 */
 	gp->orphan = g_mirror_taste_orphan;
 	cp = g_new_consumer(gp);
+	cp->flags |= G_CF_DIRECT_SEND | G_CF_DIRECT_RECEIVE;
 	error = g_attach(cp, pp);
 	if (error == 0) {
 		error = g_mirror_read_metadata(cp, &md);
diff --git a/sys/geom/multipath/g_multipath.c b/sys/geom/multipath/g_multipath.c
index 120fced0a8f1..a721b0bc4459 100644
--- a/sys/geom/multipath/g_multipath.c
+++ b/sys/geom/multipath/g_multipath.c
@@ -829,6 +829,7 @@ g_multipath_taste(struct g_class *mp, struct g_provider *pp, int flags __unused)
 	gp->access = g_multipath_access;
 	gp->orphan = g_multipath_orphan;
 	cp = g_new_consumer(gp);
+	cp->flags |= G_CF_DIRECT_SEND | G_CF_DIRECT_RECEIVE;
 	error = g_attach(cp, pp);
 	if (error == 0) {
 		error = g_multipath_read_metadata(cp, &md);
diff --git a/sys/geom/raid3/g_raid3.c b/sys/geom/raid3/g_raid3.c
index 159eff990892..27925b5e49f3 100644
--- a/sys/geom/raid3/g_raid3.c
+++ b/sys/geom/raid3/g_raid3.c
@@ -3310,6 +3310,7 @@ g_raid3_taste(struct g_class *mp, struct g_provider *pp, int flags __unused)
 	/* This orphan function should be never called. */
 	gp->orphan = g_raid3_taste_orphan;
 	cp = g_new_consumer(gp);
+	cp->flags |= G_CF_DIRECT_SEND | G_CF_DIRECT_RECEIVE;
 	error = g_attach(cp, pp);
 	if (error == 0) {
 		error = g_raid3_read_metadata(cp, &md);
diff --git a/sys/geom/shsec/g_shsec.c b/sys/geom/shsec/g_shsec.c
index 2b9e127ce350..5ca00b64219d 100644
--- a/sys/geom/shsec/g_shsec.c
+++ b/sys/geom/shsec/g_shsec.c
@@ -653,6 +653,7 @@ g_shsec_taste(struct g_class *mp, struct g_provider *pp, int flags __unused)
 	gp->access = g_shsec_access;
 	gp->orphan = g_shsec_orphan;
 	cp = g_new_consumer(gp);
+	cp->flags |= G_CF_DIRECT_SEND | G_CF_DIRECT_RECEIVE;
 	error = g_attach(cp, pp);
 	if (error == 0) {
 		error = g_shsec_read_metadata(cp, &md);
diff --git a/sys/geom/stripe/g_stripe.c b/sys/geom/stripe/g_stripe.c
index 9b4df1b8dba6..3ae6a0e3f871 100644
--- a/sys/geom/stripe/g_stripe.c
+++ b/sys/geom/stripe/g_stripe.c
@@ -954,6 +954,7 @@ g_stripe_taste(struct g_class *mp, struct g_provider *pp, int flags __unused)
 	gp->access = g_stripe_access;
 	gp->orphan = g_stripe_orphan;
 	cp = g_new_consumer(gp);
+	cp->flags |= G_CF_DIRECT_SEND | G_CF_DIRECT_RECEIVE;
 	error = g_attach(cp, pp);
 	if (error == 0) {
 		error = g_stripe_read_metadata(cp, &md);
diff --git a/sys/geom/vinum/geom_vinum.c b/sys/geom/vinum/geom_vinum.c
index 0c60a051619f..86f5c9f08e1f 100644
--- a/sys/geom/vinum/geom_vinum.c
+++ b/sys/geom/vinum/geom_vinum.c
@@ -599,6 +599,7 @@ gv_taste(struct g_class *mp, struct g_provider *pp, int flags __unused)
 	sc = gp->softc;
 
 	cp = g_new_consumer(gp);
+	cp->flags |= G_CF_DIRECT_SEND | G_CF_DIRECT_RECEIVE;
 	if (g_attach(cp, pp) != 0) {
 		g_destroy_consumer(cp);
 		return (NULL);
diff --git a/sys/geom/virstor/g_virstor.c b/sys/geom/virstor/g_virstor.c
index e27d92b509d4..8e4725997ab2 100644
--- a/sys/geom/virstor/g_virstor.c
+++ b/sys/geom/virstor/g_virstor.c
@@ -780,6 +780,7 @@ g_virstor_taste(struct g_class *mp, struct g_provider *pp, int flags)
 	gp->orphan = (void *)invalid_call;	/* I really want these to fail. */
 
 	cp = g_new_consumer(gp);
+	cp->flags |= G_CF_DIRECT_SEND | G_CF_DIRECT_RECEIVE;
 	error = g_attach(cp, pp);
 	if (error == 0) {
 		error = read_metadata(cp, &md);