@@ -401,6 +401,11 @@ All md devices contain:
once the array becomes non-degraded, and this fact has been
recorded in the metadata.
+ bitmap/flush_threshold
+ The number of outstanding dirty chunks that are allowed to be pending
+ before unplugging the bitmap queue. The default behavior is to always
+ unplugging the queue when requested.
+
consistency_policy
This indicates how the array maintains consistency in case of unexpected
shutdown. It can be:
@@ -2652,6 +2652,38 @@ static struct md_sysfs_entry max_backlog_used =
__ATTR(max_backlog_used, S_IRUGO | S_IWUSR,
behind_writes_used_show, behind_writes_used_reset);
+static ssize_t
+bitmap_flush_threshold_show(struct mddev *mddev, char *page)
+{
+ ssize_t ret;
+ spin_lock(&mddev->lock);
+ if (mddev->bitmap == NULL)
+ ret = sprintf(page, "0\n");
+ else
+ ret = sprintf(page, "%u\n",
+ mddev->bitmap_info.flush_threshold);
+ spin_unlock(&mddev->lock);
+ return ret;
+}
+
+static ssize_t
+bitmap_flush_threshold_store(struct mddev *mddev, const char *buf, size_t len)
+{
+ unsigned int thresh;
+ int ret;
+ if (!mddev->bitmap)
+ return -ENOENT;
+ ret = kstrtouint(buf, 10, &thresh);
+ if (ret)
+ return ret;
+ mddev->bitmap_info.flush_threshold = thresh;
+ return len;
+}
+
+static struct md_sysfs_entry bitmap_flush_threshold =
+__ATTR(flush_threshold, S_IRUGO | S_IWUSR,
+ bitmap_flush_threshold_show, bitmap_flush_threshold_store);
+
static struct attribute *md_bitmap_attrs[] = {
&bitmap_location.attr,
&bitmap_space.attr,
@@ -2661,6 +2693,7 @@ static struct attribute *md_bitmap_attrs[] = {
&bitmap_metadata.attr,
&bitmap_can_clear.attr,
&max_backlog_used.attr,
+ &bitmap_flush_threshold.attr,
NULL
};
const struct attribute_group md_bitmap_group = {
Adds a sysfs interface in the bitmap device for setting the chunk flush threshold. This is an unsigned integer value which defines the amount of dirty chunks allowed to be pending between bitmap flushes. Signed-off-by: Jonathan Derrick <jonathan.derrick@linux.dev> --- Documentation/admin-guide/md.rst | 5 +++++ drivers/md/md-bitmap.c | 33 ++++++++++++++++++++++++++++++++ 2 files changed, 38 insertions(+)