tech-kern archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: uvm_swap v2



> Date: Wed, 1 Jul 2026 22:45:08 +0200
> From: Reinoud Zandijk <reinoud%NetBSD.org@localhost>
> 
> +sw_physio_decrypt_iodone(struct buf *nbp)
>  {
> ...
+	struct buf *bp = nbp->b_private;	/* parent buffer */
> ...
> +	putiobuf(nbp);
> +	biodone(bp);
>  }
> ...
> @@ -1419,40 +1428,50 @@ swstrategy(struct buf *bp)
> ...
> +		nestiobuf_setup(bp, nbp, 0, bp->b_bcount);
> ...
> +		nbp->b_iodone = sw_physio_decrypt_iodone;

This is abuse of the nestiobuf abstraction: it sets up its own
b_iodone and b_private, so this code makes some assumptions about
nestiobuf's internals, namely that nbp->b_private == bp, and that
sw_physio_decrypt_iodone does everything that nestiobuf_setup requires
of nestiobuf_iodone.

I don't really have an opinion about whether it's better to use just a
custom context object like yamt@ did recently, or to use getiobuf with
nestiobuf.  But if you want to use nestiobuf, I suggest you should at
least do:

	/* swstrategy */
+	KASSERT(nbp->b_private == bp);
+	KASSERT(nbp->b_iodone == nestiobuf_iodone);

	/* sw_physio_decrypt_iodone */
-	...whatever else nestiobuf_done already does itself...
-	putiobuf(nbp)
-	biodone(bp);
+	nestiobuf_iodone(nbp);


Home | Main Index | Thread Index | Old Index