linux-ext4.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Christoph Hellwig <hch@infradead.org>
To: "zhangyi (F)" <yi.zhang@huawei.com>
Cc: linux-ext4@vger.kernel.org, tytso@mit.edu, jack@suse.cz,
	adilger.kernel@dilger.ca, zhangxiaoxu5@huawei.com
Subject: Re: [PATCH 02/10] fs: pick out ll_rw_one_block() helper function
Date: Wed, 27 May 2020 22:07:57 -0700	[thread overview]
Message-ID: <20200528050757.GA14198@infradead.org> (raw)
In-Reply-To: <20200526071754.33819-3-yi.zhang@huawei.com>

On Tue, May 26, 2020 at 03:17:46PM +0800, zhangyi (F) wrote:
> Pick out ll_rw_one_block() helper function from ll_rw_block() for
> submitting one locked buffer for reading/writing.

That should probably read factor out instead of pick out.

> 
> Signed-off-by: zhangyi (F) <yi.zhang@huawei.com>
> ---
>  fs/buffer.c                 | 41 ++++++++++++++++++++++---------------
>  include/linux/buffer_head.h |  1 +
>  2 files changed, 26 insertions(+), 16 deletions(-)
> 
> diff --git a/fs/buffer.c b/fs/buffer.c
> index a60f60396cfa..3a2226f88b2d 100644
> --- a/fs/buffer.c
> +++ b/fs/buffer.c
> @@ -3081,6 +3081,29 @@ int submit_bh(int op, int op_flags, struct buffer_head *bh)
>  }
>  EXPORT_SYMBOL(submit_bh);
>  
> +void ll_rw_one_block(int op, int op_flags, struct buffer_head *bh)
> +{
> +	BUG_ON(!buffer_locked(bh));
> +
> +	if (op == WRITE) {
> +		if (test_clear_buffer_dirty(bh)) {
> +			bh->b_end_io = end_buffer_write_sync;
> +			get_bh(bh);
> +			submit_bh(op, op_flags, bh);
> +			return;
> +		}
> +	} else {
> +		if (!buffer_uptodate(bh)) {
> +			bh->b_end_io = end_buffer_read_sync;
> +			get_bh(bh);
> +			submit_bh(op, op_flags, bh);
> +			return;
> +		}
> +	}
> +	unlock_buffer(bh);
> +}
> +EXPORT_SYMBOL(ll_rw_one_block);

I don't think you want separate read and write sides.  In fact I'm not
sure you want the helper at all.  At this point just open coding it
rather than adding more overhead to core code might be a better idea.

  reply	other threads:[~2020-05-28  5:08 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-05-26  7:17 [PATCH 00/10] ext4: fix inconsistency since reading old metadata from disk zhangyi (F)
2020-05-26  7:17 ` [PATCH 01/10] ext4: move inode eio simulation behind io completeion zhangyi (F)
2020-05-26  7:17 ` [PATCH 02/10] fs: pick out ll_rw_one_block() helper function zhangyi (F)
2020-05-28  5:07   ` Christoph Hellwig [this message]
2020-05-28 13:23     ` zhangyi (F)
2020-05-26  7:17 ` [PATCH 03/10] ext4: add ext4_sb_getblk*() wrapper functions zhangyi (F)
2020-05-26  7:17 ` [PATCH 04/10] ext4: replace sb_getblk() with ext4_sb_getblk_locked() zhangyi (F)
2020-05-26  7:17 ` [PATCH 05/10] ext4: replace sb_bread*() with ext4_sb_bread*() zhangyi (F)
2020-05-26  7:17 ` [PATCH 06/10] ext4: replace sb_getblk() with ext4_sb_getblk() zhangyi (F)
2020-05-26  7:17 ` [PATCH 07/10] ext4: switch to use ext4_sb_getblk_locked() in ext4_getblk() zhangyi (F)
2020-05-26  7:17 ` [PATCH 08/10] ext4: replace sb_breadahead() with ext4_sb_breadahead() zhangyi (F)
2020-05-26  7:17 ` [PATCH 09/10] ext4: abort the filesystem while freeing the write error io buffer zhangyi (F)
2020-05-26  7:17 ` [PATCH 10/10] ext4: remove unused parameter in jbd2_journal_try_to_free_buffers() zhangyi (F)
2020-06-08  3:32 ` [PATCH 00/10] ext4: fix inconsistency since reading old metadata from disk zhangyi (F)
2020-06-08  8:20 ` Jan Kara
2020-06-08 14:39   ` zhangyi (F)
2020-06-09 12:19     ` Jan Kara
2020-06-10  8:55       ` zhangyi (F)
2020-06-10  9:57         ` Jan Kara
2020-06-10 15:45           ` Theodore Y. Ts'o
2020-06-10 16:27             ` Jan Kara
2020-06-11  2:12               ` zhangyi (F)
2020-06-11  8:21                 ` Jan Kara
2020-06-11 16:55                   ` Theodore Y. Ts'o
2020-06-12 11:13                     ` zhangyi (F)

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=20200528050757.GA14198@infradead.org \
    --to=hch@infradead.org \
    --cc=adilger.kernel@dilger.ca \
    --cc=jack@suse.cz \
    --cc=linux-ext4@vger.kernel.org \
    --cc=tytso@mit.edu \
    --cc=yi.zhang@huawei.com \
    --cc=zhangxiaoxu5@huawei.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;
as well as URLs for NNTP newsgroup(s).