Index | Thread | Search

From:
"Theo de Raadt" <deraadt@openbsd.org>
Subject:
Re: dead code tells no tales, 8/16
To:
Miod Vallat <miod@online.fr>
Cc:
tech@openbsd.org
Date:
Sun, 20 Sep 2026 20:52:09 -0600

Download raw body.

Thread
ok deraadt

Miod Vallat <miod@online.fr> wrote:

> bufcache_getcleanbuf() is only used by the hibernate code and thus does
> not need to grow the installation media kernels. Also, it is not used
> outside of vfs_bio.c and may not deserve a public declaration either.
> 
> Index: sys/kern/vfs_bio.c
> ===================================================================
> RCS file: /OpenBSD/src/sys/kern/vfs_bio.c,v
> diff -u -p -u -p -r1.219 vfs_bio.c
> --- sys/kern/vfs_bio.c	12 Jun 2026 06:34:19 -0000	1.219
> +++ sys/kern/vfs_bio.c	20 Sep 2026 16:47:44 -0000
> @@ -1304,6 +1304,7 @@ bufcache_adjust(void)
>  		continue;
>  }
>  
> +#ifdef HIBERNATE
>  /*
>   * Get a clean buffer from the cache. if "discard" is set do not promote
>   * previously warm buffers as normal, because we are tossing everything
> @@ -1349,6 +1350,7 @@ bufcache_getcleanbuf(int discard)
>  	}
>  	return bp;
>  }
> +#endif	/* HIBERNATE */
>  
>  
>  void
> Index: sys/sys/buf.h
> ===================================================================
> RCS file: /OpenBSD/src/sys/sys/buf.h,v
> diff -u -p -u -p -r1.123 buf.h
> --- sys/sys/buf.h	3 Aug 2026 03:27:45 -0000	1.123
> +++ sys/sys/buf.h	20 Sep 2026 16:47:44 -0000
> @@ -260,7 +260,6 @@ struct buf *incore(struct vnode *, daddr
>  void bufcache_take(struct buf *);
>  void bufcache_release(struct buf *);
>  
> -struct buf *bufcache_getcleanbuf(int);
>  struct buf *bufcache_getdirtybuf(void);
>  
>  /*
>