mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Chao Yu <chao@kernel.org>
To: Jaegeuk Kim <jaegeuk@kernel.org>,
	linux-kernel@vger.kernel.org,
	linux-f2fs-devel@lists.sourceforge.net
Subject: Re: [f2fs-dev] [PATCH 2/2] f2fs: keep io_flags to avoid IO split due to different op_flags in two fio holders
Date: Sun, 17 Apr 2022 14:55:12 +0800	[thread overview]
Message-ID: <d22c42f8-525a-a0a6-2fef-a43b2fc3a2c7@kernel.org> (raw)
In-Reply-To: <20220413154920.2024872-2-jaegeuk@kernel.org>

On 2022/4/13 23:49, Jaegeuk Kim wrote:
> Let's attach io_flags to bio only, so that we can merge IOs given original
> io_flags only.
> 
> Fixes: 64bf0eef0171 ("f2fs: pass the bio operation to bio_alloc_bioset")

Nice catch.

Wasn't this bug introduced by:

commit da9953b729c1 ("f2fs: introduce sysfs/data_io_flag to attach REQ_META/FUA")

static void __attach_data_io_flag(struct f2fs_io_info *fio)
{
...
        if ((1 << fio->temp) & meta_flag)
                fio->op_flags |= REQ_META;
        if ((1 << fio->temp) & fua_flag)
                fio->op_flags |= REQ_FUA;
...

Thanks,

> Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
> ---
>   fs/f2fs/data.c | 33 +++++++++++++++++++++------------
>   1 file changed, 21 insertions(+), 12 deletions(-)
> 
> diff --git a/fs/f2fs/data.c b/fs/f2fs/data.c
> index acc523f893ba..fcf0daa386de 100644
> --- a/fs/f2fs/data.c
> +++ b/fs/f2fs/data.c
> @@ -387,11 +387,23 @@ int f2fs_target_device_index(struct f2fs_sb_info *sbi, block_t blkaddr)
>   	return 0;
>   }
>   
> -static void __attach_io_flag(struct f2fs_io_info *fio, unsigned int io_flag)
> +static unsigned int f2fs_io_flags(struct f2fs_io_info *fio)
>   {
>   	unsigned int temp_mask = (1 << NR_TEMP_TYPE) - 1;
> -	unsigned int fua_flag = io_flag & temp_mask;
> -	unsigned int meta_flag = (io_flag >> NR_TEMP_TYPE) & temp_mask;
> +	unsigned int fua_flag, meta_flag, io_flag;
> +	unsigned int op_flags = 0;
> +
> +	if (fio->op != REQ_OP_WRITE)
> +		return 0;
> +	if (fio->type == DATA)
> +		io_flag = fio->sbi->data_io_flag;
> +	else if (fio->type == NODE)
> +		io_flag = fio->sbi->node_io_flag;
> +	else
> +		return 0;
> +
> +	fua_flag = io_flag & temp_mask;
> +	meta_flag = (io_flag >> NR_TEMP_TYPE) & temp_mask;
>   
>   	/*
>   	 * data/node io flag bits per temp:
> @@ -400,9 +412,10 @@ static void __attach_io_flag(struct f2fs_io_info *fio, unsigned int io_flag)
>   	 * Cold | Warm | Hot | Cold | Warm | Hot |
>   	 */
>   	if ((1 << fio->temp) & meta_flag)
> -		fio->op_flags |= REQ_META;
> +		op_flags |= REQ_META;
>   	if ((1 << fio->temp) & fua_flag)
> -		fio->op_flags |= REQ_FUA;
> +		op_flags |= REQ_FUA;
> +	return op_flags;
>   }
>   
>   static struct bio *__bio_alloc(struct f2fs_io_info *fio, int npages)
> @@ -412,14 +425,10 @@ static struct bio *__bio_alloc(struct f2fs_io_info *fio, int npages)
>   	sector_t sector;
>   	struct bio *bio;
>   
> -	if (fio->type == DATA)
> -		__attach_io_flag(fio, sbi->data_io_flag);
> -	else if (fio->type == NODE)
> -		__attach_io_flag(fio, sbi->node_io_flag);
> -
>   	bdev = f2fs_target_device(sbi, fio->new_blkaddr, &sector);
> -	bio = bio_alloc_bioset(bdev, npages, fio->op | fio->op_flags, GFP_NOIO,
> -			       &f2fs_bioset);
> +	bio = bio_alloc_bioset(bdev, npages,
> +				fio->op | fio->op_flags | f2fs_io_flags(fio),
> +				GFP_NOIO, &f2fs_bioset);
>   	bio->bi_iter.bi_sector = sector;
>   	if (is_read_io(fio->op)) {
>   		bio->bi_end_io = f2fs_read_end_io;

  reply	other threads:[~2022-04-17  6:55 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-04-13 15:49 [PATCH 1/2] f2fs: remove obsolete whint_mode Jaegeuk Kim
2022-04-13 15:49 ` [PATCH 2/2] f2fs: keep io_flags to avoid IO split due to different op_flags in two fio holders Jaegeuk Kim
2022-04-17  6:55   ` Chao Yu [this message]
2022-04-19 22:47     ` [f2fs-dev] " Jaegeuk Kim
2022-04-20  2:45       ` Chao Yu
2022-04-17  6:32 ` [f2fs-dev] [PATCH 1/2] f2fs: remove obsolete whint_mode Chao Yu

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=d22c42f8-525a-a0a6-2fef-a43b2fc3a2c7@kernel.org \
    --to=chao@kernel.org \
    --cc=jaegeuk@kernel.org \
    --cc=linux-f2fs-devel@lists.sourceforge.net \
    --cc=linux-kernel@vger.kernel.org \
    /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

Powered by JetHome