Index | Thread | Search

From:
Jonathan Gray <jsg@jsg.id.au>
Subject:
remove bufq_switch()
To:
tech@openbsd.org
Date:
Sat, 6 Jul 2024 15:27:36 +1000

Download raw body.

Thread
  • Jonathan Gray:

    remove bufq_switch()

remove bufq_switch(), never used

diff --git share/man/man9/bufq_init.9 share/man/man9/bufq_init.9
index 7e22116df77..0897a88f54c 100644
--- share/man/man9/bufq_init.9
+++ share/man/man9/bufq_init.9
@@ -19,7 +19,6 @@
 .Os
 .Sh NAME
 .Nm bufq_init ,
-.Nm bufq_switch ,
 .Nm bufq_destroy ,
 .Nm bufq_queue ,
 .Nm bufq_dequeue ,
@@ -34,8 +33,6 @@
 .In sys/buf.h
 .Ft int
 .Fn bufq_init "struct bufq *bufq" "int type"
-.Ft int
-.Fn bufq_switch "struct bufq *bufq" "int type"
 .Ft void
 .Fn bufq_destroy "struct bufq *bufq"
 .Ft void
@@ -62,18 +59,10 @@ by the
 .Fa type
 argument.
 .Pp
-.Fn bufq_switch
-can be used to change the scheduler currently used by
-.Fa bufq
-to the algorithm specified by
-.Fa type .
-.Pp
 The
 .Fa type
 argument to
 .Fn bufq_init
-and
-.Fn bufq_switch
 can be one of the following scheduling algorithms:
 .Pp
 .Bl -tag -offset indent -width BUFQ_DEFAULT -compact
@@ -117,8 +106,7 @@ marks them as failed with an
 error, and returns them to the block layer via
 .Xr biodone 9 .
 .Sh CONTEXT
-.Fn bufq_init ,
-.Fn bufq_switch ,
+.Fn bufq_init
 and
 .Fn bufq_destroy
 can be called during autoconf, or from process context.
@@ -131,8 +119,6 @@ and
 can be called during autoconf, from process context, or from interrupt context.
 .Sh RETURN VALUES
 .Fn bufq_init
-and
-.Fn bufq_switch
 will return 0 on success, or an error code as per
 .Xr errno 2 .
 .Pp
diff --git sys/kern/kern_bufq.c sys/kern/kern_bufq.c
index 6bc42e2c874..b74d1e24f4d 100644
--- sys/kern/kern_bufq.c
+++ sys/kern/kern_bufq.c
@@ -111,47 +111,6 @@ bufq_init(struct bufq *bq, int type)
 	return (0);
 }
 
-int
-bufq_switch(struct bufq *bq, int type)
-{
-	void		*data;
-	void		*odata;
-	int		otype;
-	struct buf	*bp;
-	int		ret;
-
-	mtx_enter(&bq->bufq_mtx);
-	ret = (bq->bufq_type == type);
-	mtx_leave(&bq->bufq_mtx);
-	if (ret)
-		return (0);
-
-	data = bufq_impls[type].impl_create();
-	if (data == NULL)
-		return (ENOMEM);
-
-	mtx_enter(&bq->bufq_mtx);
-	if (bq->bufq_type != type) { /* might have changed during create */
-		odata = bq->bufq_data;
-		otype = bq->bufq_type;
-
-		while ((bp = bufq_impls[otype].impl_dequeue(odata)) != NULL)
-			bufq_impls[type].impl_queue(data, bp);
-
-		bq->bufq_data = data;
-		bq->bufq_type = type;
-		bq->bufq_impl = &bufq_impls[type];
-	} else {
-		otype = type;
-		odata = data;
-	}
-	mtx_leave(&bq->bufq_mtx);
-
-	bufq_impls[otype].impl_destroy(odata);
-
-	return (0);
-}
-
 void
 bufq_destroy(struct bufq *bq)
 {
diff --git sys/sys/buf.h sys/sys/buf.h
index c7feb84cab1..2ecf26e8965 100644
--- sys/sys/buf.h
+++ sys/sys/buf.h
@@ -84,7 +84,6 @@ struct bufq {
 };
 
 int		 bufq_init(struct bufq *, int);
-int		 bufq_switch(struct bufq *, int);
 void		 bufq_destroy(struct bufq *);
 
 void		 bufq_queue(struct bufq *, struct buf *);