diff options
author | NeilBrown <neilb@suse.de> | 2012-03-18 21:46:40 -0400 |
---|---|---|
committer | NeilBrown <neilb@suse.de> | 2012-03-18 21:46:40 -0400 |
commit | 57148964d946614ffc6621539096ded1e7d896ab (patch) | |
tree | d4bdadf58d740fcdb3c65063a5706cc3902f2b9b /drivers/md/bitmap.c | |
parent | 4ba97dff719b4cbeb7a4f6beddd2feb7404102d8 (diff) |
md/bitmap: move printing of bitmap status to bitmap.c
The part of /proc/mdstat which describes the bitmap should really
be generated by code in bitmap.c. So move it there.
Signed-off-by: NeilBrown <neilb@suse.de>
Diffstat (limited to 'drivers/md/bitmap.c')
-rw-r--r-- | drivers/md/bitmap.c | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/drivers/md/bitmap.c b/drivers/md/bitmap.c index 2c5dbc6248d3..04df18e8885f 100644 --- a/drivers/md/bitmap.c +++ b/drivers/md/bitmap.c | |||
@@ -26,6 +26,7 @@ | |||
26 | #include <linux/file.h> | 26 | #include <linux/file.h> |
27 | #include <linux/mount.h> | 27 | #include <linux/mount.h> |
28 | #include <linux/buffer_head.h> | 28 | #include <linux/buffer_head.h> |
29 | #include <linux/seq_file.h> | ||
29 | #include "md.h" | 30 | #include "md.h" |
30 | #include "bitmap.h" | 31 | #include "bitmap.h" |
31 | 32 | ||
@@ -1836,6 +1837,33 @@ out: | |||
1836 | } | 1837 | } |
1837 | EXPORT_SYMBOL_GPL(bitmap_load); | 1838 | EXPORT_SYMBOL_GPL(bitmap_load); |
1838 | 1839 | ||
1840 | void bitmap_status(struct seq_file *seq, struct bitmap *bitmap) | ||
1841 | { | ||
1842 | unsigned long chunk_kb; | ||
1843 | unsigned long flags; | ||
1844 | |||
1845 | if (!bitmap) | ||
1846 | return; | ||
1847 | |||
1848 | spin_lock_irqsave(&bitmap->lock, flags); | ||
1849 | chunk_kb = bitmap->mddev->bitmap_info.chunksize >> 10; | ||
1850 | seq_printf(seq, "bitmap: %lu/%lu pages [%luKB], " | ||
1851 | "%lu%s chunk", | ||
1852 | bitmap->pages - bitmap->missing_pages, | ||
1853 | bitmap->pages, | ||
1854 | (bitmap->pages - bitmap->missing_pages) | ||
1855 | << (PAGE_SHIFT - 10), | ||
1856 | chunk_kb ? chunk_kb : bitmap->mddev->bitmap_info.chunksize, | ||
1857 | chunk_kb ? "KB" : "B"); | ||
1858 | if (bitmap->file) { | ||
1859 | seq_printf(seq, ", file: "); | ||
1860 | seq_path(seq, &bitmap->file->f_path, " \t\n"); | ||
1861 | } | ||
1862 | |||
1863 | seq_printf(seq, "\n"); | ||
1864 | spin_unlock_irqrestore(&bitmap->lock, flags); | ||
1865 | } | ||
1866 | |||
1839 | static ssize_t | 1867 | static ssize_t |
1840 | location_show(struct mddev *mddev, char *page) | 1868 | location_show(struct mddev *mddev, char *page) |
1841 | { | 1869 | { |