diff options
Diffstat (limited to 'drivers/md/bitmap.c')
-rw-r--r-- | drivers/md/bitmap.c | 29 |
1 files changed, 28 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) | |||
2006 | static struct md_sysfs_entry bitmap_can_clear = | 2011 | static 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 | ||
2014 | static ssize_t | ||
2015 | behind_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 | |||
2023 | static ssize_t | ||
2024 | behind_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 | |||
2031 | static 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 | |||
2009 | static struct attribute *md_bitmap_attrs[] = { | 2035 | static 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 | }; |
2018 | struct attribute_group md_bitmap_group = { | 2045 | struct attribute_group md_bitmap_group = { |