public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Jaegeuk Kim <jaegeuk@kernel.org>
To: Yangtao Li <frank.li@vivo.com>
Cc: chao@kernel.org, linux-f2fs-devel@lists.sourceforge.net,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH v4 2/2] f2fs: clean up parameters of iostat_update_and_unbind_ctx()
Date: Thu, 2 Feb 2023 13:35:00 -0800	[thread overview]
Message-ID: <Y9wshEwTfCAwEb/4@google.com> (raw)
In-Reply-To: <20230201104703.31008-2-frank.li@vivo.com>

I combined two patches into one w/ Chao's reviewed-by.
Let me know if you have other concern.

On 02/01, Yangtao Li wrote:
> From: Chao Yu <chao@kernel.org>
> 
> Parsing sync/rw type from bio inside iostat_update_and_unbind_ctx()
> to avoid unnecessary parameters.
> 
> Signed-off-by: Chao Yu <chao@kernel.org>
> [Yangtao: remove lat_type check]
> Signed-off-by: Yangtao Li <frank.li@vivo.com>
> ---
> change:
> -remove lat_type check
>  fs/f2fs/data.c   |  4 ++--
>  fs/f2fs/iostat.c | 19 ++++++++++---------
>  fs/f2fs/iostat.h |  4 ++--
>  3 files changed, 14 insertions(+), 13 deletions(-)
> 
> diff --git a/fs/f2fs/data.c b/fs/f2fs/data.c
> index 86fc28adc970..82e326c0e11d 100644
> --- a/fs/f2fs/data.c
> +++ b/fs/f2fs/data.c
> @@ -292,7 +292,7 @@ static void f2fs_read_end_io(struct bio *bio)
>  	struct bio_post_read_ctx *ctx;
>  	bool intask = in_task();
>  
> -	iostat_update_and_unbind_ctx(bio, READ_IO);
> +	iostat_update_and_unbind_ctx(bio);
>  	ctx = bio->bi_private;
>  
>  	if (time_to_inject(sbi, FAULT_READ_IO))
> @@ -330,7 +330,7 @@ static void f2fs_write_end_io(struct bio *bio)
>  	struct bio_vec *bvec;
>  	struct bvec_iter_all iter_all;
>  
> -	iostat_update_and_unbind_ctx(bio, bio->bi_opf & REQ_SYNC ? WRITE_SYNC_IO : WRITE_ASYNC_IO);
> +	iostat_update_and_unbind_ctx(bio);
>  	sbi = bio->bi_private;
>  
>  	if (time_to_inject(sbi, FAULT_WRITE_IO))
> diff --git a/fs/f2fs/iostat.c b/fs/f2fs/iostat.c
> index c767a2e7d5a9..3d5bfb1ad585 100644
> --- a/fs/f2fs/iostat.c
> +++ b/fs/f2fs/iostat.c
> @@ -228,11 +228,6 @@ static inline void __update_iostat_latency(struct bio_iostat_ctx *iostat_ctx,
>  		return;
>  	}
>  
> -	if (lat_type >= MAX_IO_TYPE) {
> -		f2fs_warn(sbi, "%s: %d over MAX_IO_TYPE", __func__, lat_type);
> -		return;
> -	}
> -
>  	spin_lock_irqsave(&sbi->iostat_lat_lock, flags);
>  	io_lat->sum_lat[lat_type][page_type] += ts_diff;
>  	io_lat->bio_cnt[lat_type][page_type]++;
> @@ -241,14 +236,20 @@ static inline void __update_iostat_latency(struct bio_iostat_ctx *iostat_ctx,
>  	spin_unlock_irqrestore(&sbi->iostat_lat_lock, flags);
>  }
>  
> -void iostat_update_and_unbind_ctx(struct bio *bio, enum iostat_lat_type lat_type)
> +void iostat_update_and_unbind_ctx(struct bio *bio)
>  {
>  	struct bio_iostat_ctx *iostat_ctx = bio->bi_private;
> +	enum iostat_lat_type lat_type;
>  
> -	if (lat_type == READ_IO)
> -		bio->bi_private = iostat_ctx->post_read_ctx;
> -	else
> +	if (op_is_write(bio_op(bio))) {
> +		lat_type = bio->bi_opf & REQ_SYNC ?
> +				WRITE_SYNC_IO : WRITE_ASYNC_IO;
>  		bio->bi_private = iostat_ctx->sbi;
> +	} else {
> +		lat_type = READ_IO;
> +		bio->bi_private = iostat_ctx->post_read_ctx;
> +	}
> +
>  	__update_iostat_latency(iostat_ctx, lat_type);
>  	mempool_free(iostat_ctx, bio_iostat_ctx_pool);
>  }
> diff --git a/fs/f2fs/iostat.h b/fs/f2fs/iostat.h
> index 1f827a2fe6b2..eb99d05cf272 100644
> --- a/fs/f2fs/iostat.h
> +++ b/fs/f2fs/iostat.h
> @@ -58,7 +58,7 @@ static inline struct bio_post_read_ctx *get_post_read_ctx(struct bio *bio)
>  	return iostat_ctx->post_read_ctx;
>  }
>  
> -extern void iostat_update_and_unbind_ctx(struct bio *bio, enum iostat_lat_type type);
> +extern void iostat_update_and_unbind_ctx(struct bio *bio);
>  extern void iostat_alloc_and_bind_ctx(struct f2fs_sb_info *sbi,
>  		struct bio *bio, struct bio_post_read_ctx *ctx);
>  extern int f2fs_init_iostat_processing(void);
> @@ -68,7 +68,7 @@ extern void f2fs_destroy_iostat(struct f2fs_sb_info *sbi);
>  #else
>  static inline void f2fs_update_iostat(struct f2fs_sb_info *sbi, struct inode *inode,
>  		enum iostat_type type, unsigned long long io_bytes) {}
> -static inline void iostat_update_and_unbind_ctx(struct bio *bio, enum iostat_lat_type type) {}
> +static inline void iostat_update_and_unbind_ctx(struct bio *bio) {}
>  static inline void iostat_alloc_and_bind_ctx(struct f2fs_sb_info *sbi,
>  		struct bio *bio, struct bio_post_read_ctx *ctx) {}
>  static inline void iostat_update_submit_ctx(struct bio *bio,
> -- 
> 2.25.1

  reply	other threads:[~2023-02-02 21:35 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-02-01 10:47 [PATCH v4 1/2] f2fs: use iostat_lat_type directly as a parameter in the iostat_update_and_unbind_ctx() Yangtao Li
2023-02-01 10:47 ` [PATCH v4 2/2] f2fs: clean up parameters of iostat_update_and_unbind_ctx() Yangtao Li
2023-02-02 21:35   ` Jaegeuk Kim [this message]
2023-02-02  7:48 ` [PATCH v4 1/2] f2fs: use iostat_lat_type directly as a parameter in the iostat_update_and_unbind_ctx() 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=Y9wshEwTfCAwEb/4@google.com \
    --to=jaegeuk@kernel.org \
    --cc=chao@kernel.org \
    --cc=frank.li@vivo.com \
    --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