mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Eric Biggers <ebiggers@kernel.org>
To: Hongyu Jin <hongyu.jin.cn@gmail.com>
Cc: agk@redhat.com, snitzer@kernel.org, mpatocka@redhat.com,
	zhiguo.niu@unisoc.com, ke.wang@unisoc.com, yibin.ding@unisoc.com,
	hongyu.jin@unisoc.com, linux-kernel@vger.kernel.org,
	dm-devel@lists.linux.dev
Subject: Re: [PATCH v2] dm verity: Inherit I/O priority from data I/O when read FEC and hash from disk
Date: Thu, 7 Dec 2023 17:54:03 -0800	[thread overview]
Message-ID: <20231208015403.GB1160@sol.localdomain> (raw)
In-Reply-To: <20231206113935.9705-1-hongyu.jin.cn@gmail.com>

On Wed, Dec 06, 2023 at 07:39:35PM +0800, Hongyu Jin wrote:
> From: Hongyu Jin <hongyu.jin@unisoc.com>
> 
> when read FEC and hash from disk, I/O priority are inconsistent
>  with data block and blocked by other I/O with low I/O priority.
> 
> Add dm_bufio_prefetch_by_ioprio() and dm_bufio_read_by_ioprio(),
> can pecific I/O priority for some I/O.
> Make I/O for FEC and hash has same I/O priority with data I/O.
> 
> Co-developed-by: Yibin Ding <yibin.ding@unisoc.com>
> Signed-off-by: Yibin Ding <yibin.ding@unisoc.com>
> Signed-off-by: Hongyu Jin <hongyu.jin@unisoc.com>
> 
> ---
> Changes in v2:
>   - Add ioprio field in struct dm_io_region
>   - Initial struct dm_io_region::ioprio to IOPRIO_DEFAULT
>   - Add two interface
> ---
>  drivers/md/dm-bufio.c           | 50 ++++++++++++++++++++++-----------
>  drivers/md/dm-integrity.c       |  5 ++++
>  drivers/md/dm-io.c              |  1 +
>  drivers/md/dm-log.c             |  1 +
>  drivers/md/dm-raid1.c           |  2 ++
>  drivers/md/dm-snap-persistent.c |  2 ++
>  drivers/md/dm-verity-fec.c      |  3 +-
>  drivers/md/dm-verity-target.c   | 10 +++++--
>  drivers/md/dm-writecache.c      |  4 +++
>  include/linux/dm-bufio.h        |  6 ++++
>  include/linux/dm-io.h           |  2 ++
>  11 files changed, 66 insertions(+), 20 deletions(-)

Changing so many things in one patch should be avoided if possible.  Is there a
way to split this patch up?  Maybe first add ioprio support to dm-io, then add
ioprio support to dm-bufio, then make dm-verity set the correct ioprio?

>  void *dm_bufio_read(struct dm_bufio_client *c, sector_t block,
>  		    struct dm_buffer **bp)
> +{
> +	return dm_bufio_read_by_ioprio(c, block, bp, IOPRIO_DEFAULT);
> +}
> +EXPORT_SYMBOL_GPL(dm_bufio_read);
> +
> +void *dm_bufio_read_by_ioprio(struct dm_bufio_client *c, sector_t block,
> +		    struct dm_buffer **bp, unsigned short ioprio)
>  {
>  	if (WARN_ON_ONCE(dm_bufio_in_request()))
>  		return ERR_PTR(-EINVAL);
>  
> -	return new_read(c, block, NF_READ, bp);
> +	return new_read(c, block, NF_READ, bp, ioprio);
>  }
> -EXPORT_SYMBOL_GPL(dm_bufio_read);
> +EXPORT_SYMBOL_GPL(dm_bufio_read_by_ioprio);
>  
>  void *dm_bufio_new(struct dm_bufio_client *c, sector_t block,
>  		   struct dm_buffer **bp)
> @@ -1909,12 +1918,19 @@ void *dm_bufio_new(struct dm_bufio_client *c, sector_t block,
>  	if (WARN_ON_ONCE(dm_bufio_in_request()))
>  		return ERR_PTR(-EINVAL);
>  
> -	return new_read(c, block, NF_FRESH, bp);
> +	return new_read(c, block, NF_FRESH, bp, IOPRIO_DEFAULT);
>  }
>  EXPORT_SYMBOL_GPL(dm_bufio_new);
>  
>  void dm_bufio_prefetch(struct dm_bufio_client *c,
>  		       sector_t block, unsigned int n_blocks)
> +{
> +	return dm_bufio_prefetch_by_ioprio(c, block, n_blocks, IOPRIO_DEFAULT);
> +}
> +EXPORT_SYMBOL_GPL(dm_bufio_prefetch);
> +
> +void dm_bufio_prefetch_by_ioprio(struct dm_bufio_client *c,
> +		       sector_t block, unsigned int n_blocks, unsigned short ioprio)

I think it would be cleaner to just add the ioprio parameter to dm_bufio_read()
and dm_bufio_prefetch(), instead of adding new functions.

> diff --git a/drivers/md/dm-verity-target.c b/drivers/md/dm-verity-target.c
> index 26adcfea0302..5945ac1dfdff 100644
> --- a/drivers/md/dm-verity-target.c
> +++ b/drivers/md/dm-verity-target.c
> @@ -51,6 +51,7 @@ static DEFINE_STATIC_KEY_FALSE(use_tasklet_enabled);
>  struct dm_verity_prefetch_work {
>  	struct work_struct work;
>  	struct dm_verity *v;
> +	struct dm_verity_io *io;
>  	sector_t block;
>  	unsigned int n_blocks;
>  };

Isn't it possible for 'io' to complete and be freed while the prefetch work is
still running?

- Eric

  reply	other threads:[~2023-12-08  1:54 UTC|newest]

Thread overview: 68+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-11-28  9:44 [PATCH] dm: increase the io priority of the kworker-kverityd process Yunlong Xing
2023-11-28 14:07 ` Mikulas Patocka
2023-12-06 11:39   ` [PATCH v2] dm verity: Inherit I/O priority from data I/O when read FEC and hash from disk Hongyu Jin
2023-12-08  1:54     ` Eric Biggers [this message]
2023-12-08 20:34       ` Eric Wheeler
2023-12-11  8:59         ` [PATCH v3 0/5] Fix I/O priority lost in device-mapper Hongyu Jin
2023-12-11  8:59           ` [PATCH v3 1/5] block: Optimize bio io priority setting Hongyu Jin
2023-12-11 21:12             ` Mike Snitzer
2023-12-11  8:59           ` [PATCH v3 2/5] dm: Support I/O priority for dm_io() Hongyu Jin
2023-12-11  8:59           ` [PATCH v3 3/5] dm-bufio: Support I/O priority Hongyu Jin
2023-12-11  8:59           ` [PATCH v3 4/5] dm verity: Fix I/O priority lost when read FEC and hash Hongyu Jin
2023-12-11  9:00           ` [PATCH v3 5/5] dm-crypt: Fix lost ioprio when queuing write bios Hongyu Jin
2023-12-11 20:32             ` Eric Wheeler
2023-12-11 22:15             ` Mike Snitzer
2023-12-12 11:11               ` [PATCH v4 0/5] Fix I/O priority lost in device-mapper Hongyu Jin
2023-12-12 11:11                 ` [PATCH v4 1/5] block: Fix bio IO priority setting Hongyu Jin
2023-12-12 13:13                   ` Christoph Hellwig
2023-12-12 18:02                     ` Mike Snitzer
2023-12-12 11:11                 ` [PATCH v4 2/5] dm: Support I/O priority for dm_io() Hongyu Jin
2023-12-13  4:57                   ` Eric Biggers
2023-12-12 11:11                 ` [PATCH v4 3/5] dm-bufio: Support I/O priority Hongyu Jin
2023-12-13  5:00                   ` Eric Biggers
2023-12-12 11:11                 ` [PATCH v4 4/5] dm verity: Fix I/O priority lost when read FEC and hash Hongyu Jin
2023-12-12 11:11                 ` [PATCH v4 5/5] dm-crypt: Fix lost ioprio when queuing write bios Hongyu Jin
2023-12-13  4:45                 ` [PATCH v4 0/5] Fix I/O priority lost in device-mapper Eric Biggers
2023-12-13  9:24                   ` Henry King
2023-12-13 10:42                     ` Hongyu Jin
2023-12-13 10:42                       ` [PATCH v5 1/5] block: Fix bio IO priority setting Hongyu Jin
2023-12-13 16:58                         ` Mike Snitzer
2023-12-18  1:24                           ` Henry King
2023-12-18  1:27                             ` [PATCH v5 RESEND 0/5] Fix I/O priority lost in device-mapper Hongyu Jin
2023-12-18  1:27                               ` [PATCH v5 RESEND 1/5] block: Fix bio IO priority setting Hongyu Jin
2023-12-18  1:27                               ` [PATCH v5 RESEND 2/5] dm: Support I/O priority for dm_io() Hongyu Jin
2023-12-19 22:46                                 ` Eric Biggers
2023-12-18  1:27                               ` [PATCH v5 RESEND 3/5] dm-bufio: Support I/O priority Hongyu Jin
2023-12-19 22:46                                 ` Eric Biggers
2023-12-18  1:27                               ` [PATCH v5 RESEND 4/5] dm verity: Fix I/O priority lost when read FEC and hash Hongyu Jin
2023-12-19 22:48                                 ` Eric Biggers
2023-12-20  1:14                                   ` Hongyu Jin
2023-12-18  1:27                               ` [PATCH v5 RESEND 5/5] dm-crypt: Fix lost ioprio when queuing write bios Hongyu Jin
2023-12-19 22:50                                 ` Eric Biggers
2023-12-19  0:46                               ` [PATCH v5 RESEND 0/5] Fix I/O priority lost in device-mapper Eric Biggers
2023-12-13 10:42                       ` [PATCH v5 2/5] dm: Support I/O priority for dm_io() Hongyu Jin
2023-12-13 10:42                       ` [PATCH v5 3/5] dm-bufio: Support I/O priority Hongyu Jin
2023-12-13 10:42                       ` [PATCH v5 4/5] dm verity: Fix I/O priority lost when read FEC and hash Hongyu Jin
2023-12-13 10:42                       ` [PATCH v5 5/5] dm-crypt: Fix lost ioprio when queuing write bios Hongyu Jin
2023-12-20 10:03                         ` [PATCH v6 0/5] Fix I/O priority lost in device-mapper Hongyu Jin
2023-12-20 10:03                           ` [PATCH v6 1/5] block: Fix bio IO priority setting Hongyu Jin
2023-12-20 10:03                           ` [PATCH v6 2/5] dm: Support I/O priority for dm_io() Hongyu Jin
2023-12-20 10:03                           ` [PATCH v6 3/5] dm-bufio: Support I/O priority Hongyu Jin
2023-12-20 10:03                           ` [PATCH v6 4/5] dm verity: Fix I/O priority lost when read FEC and hash Hongyu Jin
2023-12-20 18:32                             ` Eric Biggers
2023-12-20 10:03                           ` [PATCH v6 5/5] dm-crypt: Fix lost ioprio when queuing write bios Hongyu Jin
2023-12-21 10:31                             ` [PATCH v7 0/5] Fix I/O priority lost in device-mapper Hongyu Jin
2023-12-21 10:31                               ` [PATCH v7 1/5] block: Fix bio IO priority setting Hongyu Jin
2023-12-21 10:31                               ` [PATCH v7 2/5] dm: Support I/O priority for dm_io() Hongyu Jin
2023-12-21 10:31                               ` [PATCH v7 3/5] dm-bufio: Support I/O priority Hongyu Jin
2023-12-21 10:31                               ` [PATCH v7 4/5] dm verity: Fix I/O priority lost when read FEC and hash Hongyu Jin
2023-12-21 10:31                               ` [PATCH v7 5/5] dm-crypt: Fix lost ioprio when queuing write bios Hongyu Jin
2024-01-24  5:35                                 ` [PATCH v8 0/5] Fix I/O priority lost in device-mapper Hongyu Jin
2024-01-24  5:35                                   ` [PATCH v8 1/5] block: Fix bio IO priority setting Hongyu Jin
2024-01-24  5:35                                   ` [PATCH v8 2/5] dm: Support I/O priority for dm_io() Hongyu Jin
2024-01-24  5:35                                   ` [PATCH v8 3/5] dm-bufio: Support I/O priority Hongyu Jin
2024-01-24  5:35                                   ` [PATCH v8 4/5] dm verity: Fix I/O priority lost when read FEC and hash Hongyu Jin
2024-01-24  5:35                                   ` [PATCH v8 5/5] dm-crypt: Fix lost ioprio when queuing write bios Hongyu Jin
2024-01-29 16:30                                   ` [PATCH v8 0/5] Fix I/O priority lost in device-mapper Mike Snitzer
2024-01-29 19:29                                   ` Mikulas Patocka
2023-12-23 15:41                               ` [PATCH v7 " Eric Biggers

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20231208015403.GB1160@sol.localdomain \
    --to=ebiggers@kernel.org \
    --cc=agk@redhat.com \
    --cc=dm-devel@lists.linux.dev \
    --cc=hongyu.jin.cn@gmail.com \
    --cc=hongyu.jin@unisoc.com \
    --cc=ke.wang@unisoc.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mpatocka@redhat.com \
    --cc=snitzer@kernel.org \
    --cc=yibin.ding@unisoc.com \
    --cc=zhiguo.niu@unisoc.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®