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 | |
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')
-rw-r--r-- | drivers/md/bitmap.c | 28 | ||||
-rw-r--r-- | drivers/md/bitmap.h | 1 | ||||
-rw-r--r-- | drivers/md/md.c | 23 |
3 files changed, 30 insertions, 22 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 | { |
diff --git a/drivers/md/bitmap.h b/drivers/md/bitmap.h index 557e3e8ea73b..e196e6a560e8 100644 --- a/drivers/md/bitmap.h +++ b/drivers/md/bitmap.h | |||
@@ -227,6 +227,7 @@ void bitmap_destroy(struct mddev *mddev); | |||
227 | 227 | ||
228 | void bitmap_print_sb(struct bitmap *bitmap); | 228 | void bitmap_print_sb(struct bitmap *bitmap); |
229 | void bitmap_update_sb(struct bitmap *bitmap); | 229 | void bitmap_update_sb(struct bitmap *bitmap); |
230 | void bitmap_status(struct seq_file *seq, struct bitmap *bitmap); | ||
230 | 231 | ||
231 | int bitmap_setallbits(struct bitmap *bitmap); | 232 | int bitmap_setallbits(struct bitmap *bitmap); |
232 | void bitmap_write_all(struct bitmap *bitmap); | 233 | void bitmap_write_all(struct bitmap *bitmap); |
diff --git a/drivers/md/md.c b/drivers/md/md.c index 4566b61373d5..26591cc8ee87 100644 --- a/drivers/md/md.c +++ b/drivers/md/md.c | |||
@@ -6725,7 +6725,6 @@ static int md_seq_show(struct seq_file *seq, void *v) | |||
6725 | struct mddev *mddev = v; | 6725 | struct mddev *mddev = v; |
6726 | sector_t sectors; | 6726 | sector_t sectors; |
6727 | struct md_rdev *rdev; | 6727 | struct md_rdev *rdev; |
6728 | struct bitmap *bitmap; | ||
6729 | 6728 | ||
6730 | if (v == (void*)1) { | 6729 | if (v == (void*)1) { |
6731 | struct md_personality *pers; | 6730 | struct md_personality *pers; |
@@ -6813,27 +6812,7 @@ static int md_seq_show(struct seq_file *seq, void *v) | |||
6813 | } else | 6812 | } else |
6814 | seq_printf(seq, "\n "); | 6813 | seq_printf(seq, "\n "); |
6815 | 6814 | ||
6816 | if ((bitmap = mddev->bitmap)) { | 6815 | bitmap_status(seq, mddev->bitmap); |
6817 | unsigned long chunk_kb; | ||
6818 | unsigned long flags; | ||
6819 | spin_lock_irqsave(&bitmap->lock, flags); | ||
6820 | chunk_kb = mddev->bitmap_info.chunksize >> 10; | ||
6821 | seq_printf(seq, "bitmap: %lu/%lu pages [%luKB], " | ||
6822 | "%lu%s chunk", | ||
6823 | bitmap->pages - bitmap->missing_pages, | ||
6824 | bitmap->pages, | ||
6825 | (bitmap->pages - bitmap->missing_pages) | ||
6826 | << (PAGE_SHIFT - 10), | ||
6827 | chunk_kb ? chunk_kb : mddev->bitmap_info.chunksize, | ||
6828 | chunk_kb ? "KB" : "B"); | ||
6829 | if (bitmap->file) { | ||
6830 | seq_printf(seq, ", file: "); | ||
6831 | seq_path(seq, &bitmap->file->f_path, " \t\n"); | ||
6832 | } | ||
6833 | |||
6834 | seq_printf(seq, "\n"); | ||
6835 | spin_unlock_irqrestore(&bitmap->lock, flags); | ||
6836 | } | ||
6837 | 6816 | ||
6838 | seq_printf(seq, "\n"); | 6817 | seq_printf(seq, "\n"); |
6839 | } | 6818 | } |