Skip to contentSkip to conversation

Introduction

PATCH New NeilBrown 1 participant 6 messages Sep 2, 2005 MD RAID

lore
Share & tools
lore

NeilBrown

author
#0 lore raw

PATCH 1/1 Introduction

5 patches for md in 2.5.13-mm1.
The first you may already have of linux-kernel.

The remainder are little bug fixes and some enhancments to the content of /proc/mdstat. All are suitable for early dispatch to Linus.

Thanks,
NeilBrown

[PATCH md 001 of 5] drivers/md/raid1.c: make a function static
[PATCH md 002 of 5] Choose better default offset for bitmap.
[PATCH md 003 of 5] Use queue_hardsect_size instead of block_size for md superblock size calc. [PATCH md 004 of 5] Add information about superblock version to /proc/mdstat [PATCH md 005 of 5] Report spare drives in /proc/mdstat

author
#1 lore raw

PATCH 1/1 drivers/md/raid1.c: make a function static

This patch makes a needlessly global function static.

### Diffstat output

 ./drivers/md/raid1.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/md/raid1.c renamed from drivers/md/raid1.c~current~ +1 -1
diff ./drivers/md/raid1.c~current~ ./drivers/md/raid1.c
@@ -1703,7 +1703,7 @@ static int raid1_reshape(mddev_t *mddev,
 	return 0;
 }
 
-void raid1_quiesce(mddev_t *mddev, int state)
+static void raid1_quiesce(mddev_t *mddev, int state)
 {
 	conf_t *conf = mddev_to_conf(mddev);
 
author
#2 lore raw

PATCH 1/1 Choose better default offset for bitmap.

In reply to NeilBrown

On reflection, a better default location for hot-adding bitmaps with version-1 superblocks is immediately after the superblock. There might not be much room there, but there is usually atleast 3k, and that is a good start.

### Diffstat output

 ./drivers/md/md.c |    3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/md/md.c renamed from drivers/md/md.c~current~ +1 -2
diff ./drivers/md/md.c~current~ ./drivers/md/md.c
@@ -957,8 +957,7 @@ static int super_1_validate(mddev_t *mdd
 		mddev->events = le64_to_cpu(sb->events);
 		mddev->bitmap_offset = 0;
 		mddev->default_bitmap_offset = 0;
-		if (mddev->minor_version == 0)
-			mddev->default_bitmap_offset = -(64*1024)/512;
+		mddev->default_bitmap_offset = 1024;
 		
 		mddev->recovery_cp = le64_to_cpu(sb->resync_offset);
 		memcpy(mddev->uuid, sb->set_uuid, 16);
author
#3 lore raw

PATCH 1/1 Use queue_hardsect_size instead of block_size for md superblock size calc.

In reply to NeilBrown

Doh. I want the physical hard-sector-size, not the current block size...

### Diffstat output

 ./drivers/md/md.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/md/md.c renamed from drivers/md/md.c~current~ +1 -1
diff ./drivers/md/md.c~current~ ./drivers/md/md.c
@@ -898,7 +898,7 @@ static int super_1_load(mdk_rdev_t *rdev
 	rdev->data_offset = le64_to_cpu(sb->data_offset);
 
 	rdev->sb_size = le32_to_cpu(sb->max_dev) * 2 + 256;
-	bmask = block_size(rdev->bdev)-1;
+	bmask = queue_hardsect_size(rdev->bdev->bd_disk->queue)-1;
 	if (rdev->sb_size & bmask)
 		rdev-> sb_size = (rdev->sb_size | bmask)+1;
 
author
#4 lore raw

PATCH 1/1 Add information about superblock version to /proc/mdstat

In reply to NeilBrown

Leave it unchanged if the original (0.90) is used, incase it might be a compatability problem.

### Diffstat output

 ./drivers/md/md.c |    9 +++++++++
 1 file changed, 9 insertions(+)
drivers/md/md.c renamed from drivers/md/md.c~current~ +9 -0
diff ./drivers/md/md.c~current~ ./drivers/md/md.c
@@ -3346,6 +3346,15 @@ static int md_seq_show(struct seq_file *
 				seq_printf(seq, "\n      %llu blocks",
 					(unsigned long long)size);
 		}
+		if (mddev->persistent) {
+			if (mddev->major_version != 0 ||
+			    mddev->minor_version != 90) {
+				seq_printf(seq," super %d.%d",
+					   mddev->major_version,
+					   mddev->minor_version);
+			}
+		} else
+			seq_printf(seq, " super non-persistent");
 
 		if (mddev->pers) {
 			mddev->pers->status (seq, mddev);
author
#5 lore raw

PATCH 1/1 Report spare drives in /proc/mdstat

In reply to NeilBrown

Just like failed drives have (F), so spare drives now have (S).

### Diffstat output

 ./drivers/md/md.c |    3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/md/md.c renamed from drivers/md/md.c~current~ +2 -1
diff ./drivers/md/md.c~current~ ./drivers/md/md.c
@@ -3334,7 +3334,8 @@ static int md_seq_show(struct seq_file *
 			if (rdev->faulty) {
 				seq_printf(seq, "(F)");
 				continue;
-			}
+			} else if (rdev->raid_disk < 0)
+				seq_printf(seq, "(S)"); /* spare */
 			size += rdev->size;
 		}