aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorPaul Clements <paul.clements@steeleye.com>2010-03-08 00:02:37 -0500
committerNeilBrown <neilb@suse.de>2010-05-18 01:27:46 -0400
commit696fcd535b5a8cfc0617e9cf1d9d69a13895cc1e (patch)
treeb9f55833c83a41a6e047f0de82b17d9753ad0542 /drivers
parentee8b81b03dffa1c0075553d01c557714aedb85a1 (diff)
md: expose max value of behind writes counter
Keep track of the maximum number of concurrent write-behind requests for an md array and exposed this number in sysfs at md/bitmap/max_backlog_used Writing any value to this file will clear it. This allows userspace to be involved in tuning bitmap/backlog. Signed-off-by: Paul Clements <paul.clements@steeleye.com> Signed-off-by: NeilBrown <neilb@suse.de>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/md/bitmap.c29
-rw-r--r--drivers/md/bitmap.h1
2 files changed, 29 insertions, 1 deletions
diff --git a/drivers/md/bitmap.c b/drivers/md/bitmap.c
index 26ac8aad0b19..6279393db64d 100644
--- a/drivers/md/bitmap.c
+++ b/drivers/md/bitmap.c
@@ -1292,9 +1292,14 @@ int bitmap_startwrite(struct bitmap *bitmap, sector_t offset, unsigned long sect
1292 if (!bitmap) return 0; 1292 if (!bitmap) return 0;
1293 1293
1294 if (behind) { 1294 if (behind) {
1295 int bw;
1295 atomic_inc(&bitmap->behind_writes); 1296 atomic_inc(&bitmap->behind_writes);
1297 bw = atomic_read(&bitmap->behind_writes);
1298 if (bw > bitmap->behind_writes_used)
1299 bitmap->behind_writes_used = bw;
1300
1296 PRINTK(KERN_DEBUG "inc write-behind count %d/%d\n", 1301 PRINTK(KERN_DEBUG "inc write-behind count %d/%d\n",
1297 atomic_read(&bitmap->behind_writes), bitmap->max_write_behind); 1302 bw, bitmap->max_write_behind);
1298 } 1303 }
1299 1304
1300 while (sectors) { 1305 while (sectors) {
@@ -2006,6 +2011,27 @@ static ssize_t can_clear_store(mddev_t *mddev, const char *buf, size_t len)
2006static struct md_sysfs_entry bitmap_can_clear = 2011static struct md_sysfs_entry bitmap_can_clear =
2007__ATTR(can_clear, S_IRUGO|S_IWUSR, can_clear_show, can_clear_store); 2012__ATTR(can_clear, S_IRUGO|S_IWUSR, can_clear_show, can_clear_store);
2008 2013
2014static ssize_t
2015behind_writes_used_show(mddev_t *mddev, char *page)
2016{
2017 if (mddev->bitmap == NULL)
2018 return sprintf(page, "0\n");
2019 return sprintf(page, "%lu\n",
2020 mddev->bitmap->behind_writes_used);
2021}
2022
2023static ssize_t
2024behind_writes_used_reset(mddev_t *mddev, const char *buf, size_t len)
2025{
2026 if (mddev->bitmap)
2027 mddev->bitmap->behind_writes_used = 0;
2028 return len;
2029}
2030
2031static struct md_sysfs_entry max_backlog_used =
2032__ATTR(max_backlog_used, S_IRUGO | S_IWUSR,
2033 behind_writes_used_show, behind_writes_used_reset);
2034
2009static struct attribute *md_bitmap_attrs[] = { 2035static struct attribute *md_bitmap_attrs[] = {
2010 &bitmap_location.attr, 2036 &bitmap_location.attr,
2011 &bitmap_timeout.attr, 2037 &bitmap_timeout.attr,
@@ -2013,6 +2039,7 @@ static struct attribute *md_bitmap_attrs[] = {
2013 &bitmap_chunksize.attr, 2039 &bitmap_chunksize.attr,
2014 &bitmap_metadata.attr, 2040 &bitmap_metadata.attr,
2015 &bitmap_can_clear.attr, 2041 &bitmap_can_clear.attr,
2042 &max_backlog_used.attr,
2016 NULL 2043 NULL
2017}; 2044};
2018struct attribute_group md_bitmap_group = { 2045struct attribute_group md_bitmap_group = {
diff --git a/drivers/md/bitmap.h b/drivers/md/bitmap.h
index cb821d76d1b4..aa82b7caa85f 100644
--- a/drivers/md/bitmap.h
+++ b/drivers/md/bitmap.h
@@ -227,6 +227,7 @@ struct bitmap {
227 int allclean; 227 int allclean;
228 228
229 atomic_t behind_writes; 229 atomic_t behind_writes;
230 unsigned long behind_writes_used; /* highest actual value at runtime */
230 231
231 /* 232 /*
232 * the bitmap daemon - periodically wakes up and sweeps the bitmap 233 * the bitmap daemon - periodically wakes up and sweeps the bitmap