Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 292800
b: refs/heads/master
c: 5714896
h: refs/heads/master
v: v3
  • Loading branch information
NeilBrown committed Mar 19, 2012
1 parent 84fcff6 commit c8dfbeb
Show file tree
Hide file tree
Showing 4 changed files with 31 additions and 23 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 4ba97dff719b4cbeb7a4f6beddd2feb7404102d8
refs/heads/master: 57148964d946614ffc6621539096ded1e7d896ab
28 changes: 28 additions & 0 deletions trunk/drivers/md/bitmap.c
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
#include <linux/file.h>
#include <linux/mount.h>
#include <linux/buffer_head.h>
#include <linux/seq_file.h>
#include "md.h"
#include "bitmap.h"

Expand Down Expand Up @@ -1836,6 +1837,33 @@ int bitmap_load(struct mddev *mddev)
}
EXPORT_SYMBOL_GPL(bitmap_load);

void bitmap_status(struct seq_file *seq, struct bitmap *bitmap)
{
unsigned long chunk_kb;
unsigned long flags;

if (!bitmap)
return;

spin_lock_irqsave(&bitmap->lock, flags);
chunk_kb = bitmap->mddev->bitmap_info.chunksize >> 10;
seq_printf(seq, "bitmap: %lu/%lu pages [%luKB], "
"%lu%s chunk",
bitmap->pages - bitmap->missing_pages,
bitmap->pages,
(bitmap->pages - bitmap->missing_pages)
<< (PAGE_SHIFT - 10),
chunk_kb ? chunk_kb : bitmap->mddev->bitmap_info.chunksize,
chunk_kb ? "KB" : "B");
if (bitmap->file) {
seq_printf(seq, ", file: ");
seq_path(seq, &bitmap->file->f_path, " \t\n");
}

seq_printf(seq, "\n");
spin_unlock_irqrestore(&bitmap->lock, flags);
}

static ssize_t
location_show(struct mddev *mddev, char *page)
{
Expand Down
1 change: 1 addition & 0 deletions trunk/drivers/md/bitmap.h
Original file line number Diff line number Diff line change
Expand Up @@ -227,6 +227,7 @@ void bitmap_destroy(struct mddev *mddev);

void bitmap_print_sb(struct bitmap *bitmap);
void bitmap_update_sb(struct bitmap *bitmap);
void bitmap_status(struct seq_file *seq, struct bitmap *bitmap);

int bitmap_setallbits(struct bitmap *bitmap);
void bitmap_write_all(struct bitmap *bitmap);
Expand Down
23 changes: 1 addition & 22 deletions trunk/drivers/md/md.c
Original file line number Diff line number Diff line change
Expand Up @@ -6725,7 +6725,6 @@ static int md_seq_show(struct seq_file *seq, void *v)
struct mddev *mddev = v;
sector_t sectors;
struct md_rdev *rdev;
struct bitmap *bitmap;

if (v == (void*)1) {
struct md_personality *pers;
Expand Down Expand Up @@ -6813,27 +6812,7 @@ static int md_seq_show(struct seq_file *seq, void *v)
} else
seq_printf(seq, "\n ");

if ((bitmap = mddev->bitmap)) {
unsigned long chunk_kb;
unsigned long flags;
spin_lock_irqsave(&bitmap->lock, flags);
chunk_kb = mddev->bitmap_info.chunksize >> 10;
seq_printf(seq, "bitmap: %lu/%lu pages [%luKB], "
"%lu%s chunk",
bitmap->pages - bitmap->missing_pages,
bitmap->pages,
(bitmap->pages - bitmap->missing_pages)
<< (PAGE_SHIFT - 10),
chunk_kb ? chunk_kb : mddev->bitmap_info.chunksize,
chunk_kb ? "KB" : "B");
if (bitmap->file) {
seq_printf(seq, ", file: ");
seq_path(seq, &bitmap->file->f_path, " \t\n");
}

seq_printf(seq, "\n");
spin_unlock_irqrestore(&bitmap->lock, flags);
}
bitmap_status(seq, mddev->bitmap);

seq_printf(seq, "\n");
}
Expand Down

0 comments on commit c8dfbeb

Please sign in to comment.