Re: [PATCH 06/23] md/md-bitmap: add a new sysfs api bitmap_type

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi,

在 2025/05/26 14:32, Christoph Hellwig 写道:
On Sat, May 24, 2025 at 02:13:03PM +0800, Yu Kuai wrote:
+  consistency_policy

.. these doc changes look unrelated, or am I missing something?

The position are moved to the front of the bitmap fields, because now
bitmap/xxx is not always here.

Before:

All md devices contain:
	level
	...
	bitmap/xxx
	bitmap/xxx
	consistency_policy
	uuid

After:
All md devices contain:
	level
	...
	consistency_policy
	uuid
	bitmap_type
		none xxx
		bitmap xxx
If bitmap_type is bitmap, then the md device will also contain:
	bitmap/xxx
	bitmap/xxx


-static void mddev_set_bitmap_ops(struct mddev *mddev, enum md_submodule_id id)
+static bool mddev_set_bitmap_ops(struct mddev *mddev)
  {
  	xa_lock(&md_submodule);
-	mddev->bitmap_ops = xa_load(&md_submodule, id);
+	mddev->bitmap_ops = xa_load(&md_submodule, mddev->bitmap_id);
  	xa_unlock(&md_submodule);
-	if (!mddev->bitmap_ops)
-		pr_warn_once("md: can't find bitmap id %d\n", id);
+
+	if (!mddev->bitmap_ops) {
+		pr_warn_once("md: can't find bitmap id %d\n", mddev->bitmap_id);
+		return false;
+	}
+
+	return true;

This also looks unrelated and like another prep patch?

The new api will set mddev->bitmap_id, and the above change switch to
use mddev->bitmap_id to register bitmap_ops, perhaps I can factor the
change to a new prep patch, like:

md: add a new field mddev->bitmap_id

Before:
mddev_set_bitmap_ops(mddev, ID_BITMAP);

After:
mddev->bitmap_id = ID_BITMAP;
if (!mddev_set_bitmap_ops(mddev))
	return -EINVAL;

Thanks,
Kuai


.






[Index of Archives]     [Linux RAID Wiki]     [ATA RAID]     [Linux SCSI Target Infrastructure]     [Linux Block]     [Linux IDE]     [Linux SCSI]     [Linux Hams]     [Device Mapper]     [Device Mapper Cryptographics]     [Kernel]     [Linux Admin]     [Linux Net]     [GFS]     [RPM]     [git]     [Yosemite Forum]


  Powered by Linux