Re: [PATCH] block: split out a new blk_plug.h helper

From: Damien Le Moal

Date: Mon Jul 06 2026 - 04:00:35 EST


On 7/6/26 1:11 PM, Christoph Hellwig wrote:
> blkdev.h gets included in various places outside the block layer just
> for struct blk_plug and related plugging functions.
>
> Split blk_plug into a separate helper to reduce the amount of code
> that needs to get rebuilt when blkdev.h changes and to slightly
> reduce compile times.
>
> In io_uring this requires pulling in a few other headers explicitly that
> previously were implicitly included through blkdev.h.
>
> Signed-off-by: Christoph Hellwig <hch@xxxxxx>

A couple of nits below (not entirely sure if they make sense).
But otherwise looks OK to me.

Reviewed-by: Damien Le Moal <dlemoal@xxxxxxxxxx>

> diff --git a/include/linux/blk_plug.h b/include/linux/blk_plug.h
> new file mode 100644
> index 000000000000..2ac1265662ad
> --- /dev/null
> +++ b/include/linux/blk_plug.h
> @@ -0,0 +1,95 @@
> +/* SPDX-License-Identifier: GPL-2.0 */
> +#ifndef _LINUX_BLK_PLUG_H
> +#define _LINUX_BLK_PLUG_H
> +
> +#include <linux/sched.h>

struct blk_plug_cb has a list_head. So maybe also add

#include <linux/types.h>

?

> +
> +struct blk_plug_cb;

Maybe add "struct request;" here too ?

> +typedef void (*blk_plug_cb_fn)(struct blk_plug_cb *cb, bool from_schedule);
> +
> +struct rq_list {
> + struct request *head;
> + struct request *tail;
> +};


--
Damien Le Moal
Western Digital Research