linux-raid.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Himanshu Madhani <himanshu.madhani@oracle.com>
To: Christoph Hellwig <hch@lst.de>
Cc: Song Liu <song@kernel.org>,
	"linux-raid@vger.kernel.org" <linux-raid@vger.kernel.org>,
	"linux-block@vger.kernel.org" <linux-block@vger.kernel.org>,
	"linux-fsdevel@vger.kernel.org" <linux-fsdevel@vger.kernel.org>
Subject: Re: [PATCH 04/11] md-bitmap: split file writes into a separate helper
Date: Thu, 15 Jun 2023 18:13:44 +0000	[thread overview]
Message-ID: <DDCBAAEC-DA33-451B-BCE3-CC627559AC4B@oracle.com> (raw)
In-Reply-To: <20230615064840.629492-5-hch@lst.de>



> On Jun 14, 2023, at 11:48 PM, Christoph Hellwig <hch@lst.de> wrote:
> 
> Split the file write code out of write_page into a separate helper.
> 
> Signed-off-by: Christoph Hellwig <hch@lst.de>
> ---
> drivers/md/md-bitmap.c | 48 +++++++++++++++++++++---------------------
> 1 file changed, 24 insertions(+), 24 deletions(-)
> 
> diff --git a/drivers/md/md-bitmap.c b/drivers/md/md-bitmap.c
> index e4b466522d4e74..46fbcfc9d1fcac 100644
> --- a/drivers/md/md-bitmap.c
> +++ b/drivers/md/md-bitmap.c
> @@ -296,33 +296,22 @@ static void write_sb_page(struct bitmap *bitmap, struct page *page, int wait)
> }
> 
> static void md_bitmap_file_kick(struct bitmap *bitmap);
> -/*
> - * write out a page to a file
> - */
> -static void write_page(struct bitmap *bitmap, struct page *page, int wait)
> -{
> - struct buffer_head *bh;
> 
> - if (bitmap->storage.file == NULL) {
> - write_sb_page(bitmap, page, wait);
> - } else {
> -
> - bh = page_buffers(page);
> -
> - while (bh && bh->b_blocknr) {
> - atomic_inc(&bitmap->pending_writes);
> - set_buffer_locked(bh);
> - set_buffer_mapped(bh);
> - submit_bh(REQ_OP_WRITE | REQ_SYNC, bh);
> - bh = bh->b_this_page;
> - }
> +static void write_file_page(struct bitmap *bitmap, struct page *page, int wait)
> +{
> + struct buffer_head *bh = page_buffers(page);
> 
> - if (wait)
> - wait_event(bitmap->write_wait,
> -   atomic_read(&bitmap->pending_writes)==0);
> + while (bh && bh->b_blocknr) {
> + atomic_inc(&bitmap->pending_writes);
> + set_buffer_locked(bh);
> + set_buffer_mapped(bh);
> + submit_bh(REQ_OP_WRITE | REQ_SYNC, bh);
> + bh = bh->b_this_page;
> }
> - if (test_bit(BITMAP_WRITE_ERROR, &bitmap->flags))
> - md_bitmap_file_kick(bitmap);
> +
> + if (wait)
> + wait_event(bitmap->write_wait,
> +   atomic_read(&bitmap->pending_writes) == 0);
> }
> 
> static void end_bitmap_write(struct buffer_head *bh, int uptodate)
> @@ -429,6 +418,17 @@ static int read_page(struct file *file, unsigned long index,
>  * bitmap file superblock operations
>  */
> 
> +/*
> + * write out a page to a file
> + */
> +static void write_page(struct bitmap *bitmap, struct page *page, int wait)
> +{
> + if (bitmap->storage.file)
> + write_file_page(bitmap, page, wait);
> + else
> + write_sb_page(bitmap, page, wait);
> +}
> +
> /*
>  * md_bitmap_wait_writes() should be called before writing any bitmap
>  * blocks, to ensure previous writes, particularly from
> -- 
> 2.39.2
> 

Reviewed-by: Himanshu Madhani <himanshu.madhani@oracle.com>

-- 
Himanshu Madhani Oracle Linux Engineering


  parent reply	other threads:[~2023-06-15 18:14 UTC|newest]

Thread overview: 43+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-06-15  6:48 deprecate md bitmap file support Christoph Hellwig
2023-06-15  6:48 ` [PATCH 01/11] md-bitmap: set BITMAP_WRITE_ERROR in write_sb_page Christoph Hellwig
2023-06-15  6:56   ` Hannes Reinecke
2023-06-15 14:22   ` Johannes Thumshirn
2023-06-15 17:05   ` Himanshu Madhani
2023-06-15  6:48 ` [PATCH 02/11] md-bitmap: initialize variables at declaration time in md_bitmap_file_unmap Christoph Hellwig
2023-06-15  6:56   ` Hannes Reinecke
2023-06-15 14:23   ` Johannes Thumshirn
2023-06-15 17:05   ` Himanshu Madhani
2023-06-15  6:48 ` [PATCH 03/11] md-bitmap: use %pD to print the file name in md_bitmap_file_kick Christoph Hellwig
2023-06-15  6:58   ` Hannes Reinecke
2023-06-15 14:24   ` Johannes Thumshirn
2023-06-15 18:12   ` Himanshu Madhani
2023-06-15  6:48 ` [PATCH 04/11] md-bitmap: split file writes into a separate helper Christoph Hellwig
2023-06-15  6:59   ` Hannes Reinecke
2023-06-15 14:26   ` Johannes Thumshirn
2023-06-15 18:13   ` Himanshu Madhani [this message]
2023-06-15  6:48 ` [PATCH 05/11] md-bitmap: rename read_page to read_file_page Christoph Hellwig
2023-06-15  6:59   ` Hannes Reinecke
2023-06-15 14:38   ` Johannes Thumshirn
2023-06-15 18:14   ` Himanshu Madhani
2023-06-15  6:48 ` [PATCH 06/11] md-bitmap: refactor md_bitmap_init_from_disk Christoph Hellwig
2023-06-15 21:59   ` kernel test robot
2023-06-16  6:53     ` Song Liu
2023-06-16  7:01       ` Christoph Hellwig
2023-06-15  6:48 ` [PATCH 07/11] md-bitmap: cleanup read_sb_page Christoph Hellwig
2023-06-15  8:24   ` Hannes Reinecke
2023-06-15 14:42   ` Johannes Thumshirn
2023-06-15 18:30   ` Himanshu Madhani
2023-06-15  6:48 ` [PATCH 08/11] md-bitmap: account for mddev->bitmap_info.offset in read_sb_page Christoph Hellwig
2023-06-15  8:25   ` Hannes Reinecke
2023-06-15 18:38   ` Himanshu Madhani
2023-06-15  6:48 ` [PATCH 09/11] md-bitmap: don't use ->index for pages backing the bitmap file Christoph Hellwig
2023-06-15  8:37   ` Hannes Reinecke
2023-06-15  6:48 ` [PATCH 10/11] md: make bitmap file support optional Christoph Hellwig
2023-06-15  8:37   ` Hannes Reinecke
2023-06-15 19:37   ` Himanshu Madhani
2023-06-15  6:48 ` [PATCH 11/11] md: deprecate bitmap file support Christoph Hellwig
2023-06-15  8:38   ` Hannes Reinecke
2023-06-15 19:37   ` Himanshu Madhani
2023-06-15 19:37     ` Himanshu Madhani
2023-06-15  8:05 ` deprecate md " Mariusz Tkaczyk
2023-06-16  7:01   ` Christoph Hellwig

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=DDCBAAEC-DA33-451B-BCE3-CC627559AC4B@oracle.com \
    --to=himanshu.madhani@oracle.com \
    --cc=hch@lst.de \
    --cc=linux-block@vger.kernel.org \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-raid@vger.kernel.org \
    --cc=song@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;
as well as URLs for NNTP newsgroup(s).