linux-raid.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Li Nan <linan666@huaweicloud.com>
To: Yu Kuai <yukuai1@huaweicloud.com>,
	hch@lst.de, corbet@lwn.net, song@kernel.org, yukuai3@huawei.com,
	agk@redhat.com, snitzer@kernel.org, mpatocka@redhat.com,
	xni@redhat.com, hare@suse.de
Cc: linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org,
	linux-raid@vger.kernel.org, dm-devel@lists.linux.dev,
	yi.zhang@huawei.com, yangerkun@huawei.com,
	johnny.chenyi@huawei.com
Subject: Re: [PATCH v5 11/11] md/md-llbitmap: introduce new lockless bitmap
Date: Sun, 3 Aug 2025 17:48:23 +0800	[thread overview]
Message-ID: <e6065ccf-4c74-52d3-9f06-7b7cb6499f4e@huaweicloud.com> (raw)
In-Reply-To: <20250801070346.4127558-12-yukuai1@huaweicloud.com>



在 2025/8/1 15:03, Yu Kuai 写道:
> From: Yu Kuai <yukuai3@huawei.com>
> 
> Redundant data is used to enhance data fault tolerance, and the storage
> method for redundant data vary depending on the RAID levels. And it's
> important to maintain the consistency of redundant data.
> 
> Bitmap is used to record which data blocks have been synchronized and which
> ones need to be resynchronized or recovered. Each bit in the bitmap
> represents a segment of data in the array. When a bit is set, it indicates
> that the multiple redundant copies of that data segment may not be
> consistent. Data synchronization can be performed based on the bitmap after
> power failure or readding a disk. If there is no bitmap, a full disk
> synchronization is required.

This is a large patch, I've found a few minor issues so far.
And I'm still working through it.

[...]

> +	[BitDirty] = {
> +		[BitmapActionStartwrite]	= BitNone,
> +		[BitmapActionStartsync]		= BitNone,
> +		[BitmapActionEndsync]		= BitNone,
> +		[BitmapActionAbortsync]		= BitNone,
> +		[BitmapActionReload]		= BitNeedSync,
> +		[BitmapActionDaemon]		= BitClean,
> +		[BitmapActionDiscard]		= BitUnwritten,
> +		[BitmapActionStale]		= BitNeedSync,
> +	},

Bits becomes BitDirt during degraded remains BitDirty even after recovery 
and re-write. Should we consider adjusting this state transition, or maybe 
trigger the daemon after the recovery is complete?

[...]

> +
> +static int llbitmap_create(struct mddev *mddev)
> +{
> +	struct llbitmap *llbitmap;
> +	int ret;
> +
> +	ret = llbitmap_check_support(mddev);
> +	if (ret)
> +		return ret;
> +
> +	llbitmap = kzalloc(sizeof(*llbitmap), GFP_KERNEL);
> +	if (!llbitmap)
> +		return -ENOMEM;
> +
> +	llbitmap->mddev = mddev;
> +	llbitmap->io_size = bdev_logical_block_size(mddev->gendisk->part0);
> +	llbitmap->blocks_per_page = PAGE_SIZE / llbitmap->io_size;

logical_block_size can > PAGE_SIZE, blocks_per_page is set to 0 which can
cause issues in later computations.

-- 
Thanks,
Nan


  reply	other threads:[~2025-08-03  9:48 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-08-01  7:03 [PATCH v5 00/11] md/llbitmap: md/md-llbitmap: introduce a new lockless bitmap Yu Kuai
2025-08-01  7:03 ` [PATCH v5 01/11] md: add a new parameter 'offset' to md_super_write() Yu Kuai
2025-08-01  7:03 ` [PATCH v5 02/11] md: factor out a helper raid_is_456() Yu Kuai
2025-08-01  7:03 ` [PATCH v5 03/11] md/md-bitmap: support discard for bitmap ops Yu Kuai
2025-08-01  7:03 ` [PATCH v5 04/11] md: add a new mddev field 'bitmap_id' Yu Kuai
2025-08-01  7:03 ` [PATCH v5 05/11] md/md-bitmap: add a new sysfs api bitmap_type Yu Kuai
2025-08-01  7:03 ` [PATCH v5 06/11] md/md-bitmap: delay registration of bitmap_ops until creating bitmap Yu Kuai
2025-08-01  7:03 ` [PATCH v5 07/11] md/md-bitmap: add a new method skip_sync_blocks() in bitmap_operations Yu Kuai
2025-08-01  7:03 ` [PATCH v5 08/11] md/md-bitmap: add a new method blocks_synced() " Yu Kuai
2025-08-04  9:15   ` Xiao Ni
2025-08-05  1:15     ` Yu Kuai
2025-08-01  7:03 ` [PATCH v5 09/11] md: add a new recovery_flag MD_RECOVERY_LAZY_RECOVER Yu Kuai
2025-08-01  7:03 ` [PATCH v5 10/11] md/md-bitmap: make method bitmap_ops->daemon_work optional Yu Kuai
2025-08-01  7:03 ` [PATCH v5 11/11] md/md-llbitmap: introduce new lockless bitmap Yu Kuai
2025-08-03  9:48   ` Li Nan [this message]
2025-08-03 10:33     ` Yu Kuai
2025-08-07  3:57   ` Xiao Ni
2025-08-08  6:17     ` Yu Kuai

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=e6065ccf-4c74-52d3-9f06-7b7cb6499f4e@huaweicloud.com \
    --to=linan666@huaweicloud.com \
    --cc=agk@redhat.com \
    --cc=corbet@lwn.net \
    --cc=dm-devel@lists.linux.dev \
    --cc=hare@suse.de \
    --cc=hch@lst.de \
    --cc=johnny.chenyi@huawei.com \
    --cc=linux-doc@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-raid@vger.kernel.org \
    --cc=mpatocka@redhat.com \
    --cc=snitzer@kernel.org \
    --cc=song@kernel.org \
    --cc=xni@redhat.com \
    --cc=yangerkun@huawei.com \
    --cc=yi.zhang@huawei.com \
    --cc=yukuai1@huaweicloud.com \
    --cc=yukuai3@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).