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
This commit is contained in:
Alexander Motin 2022-01-29 21:59:03 -05:00
parent ac678b4aaf
commit 10ae42ccbd
11 changed files with 11 additions and 0 deletions

View file

@ -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);

View file

@ -760,6 +760,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);

View file

@ -2481,6 +2481,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);

View file

@ -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);

View file

@ -3269,6 +3269,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);

View file

@ -828,6 +828,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);

View file

@ -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);

View file

@ -651,6 +651,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);

View file

@ -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);

View file

@ -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);

View file

@ -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);