mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: crquan@gmail.com
To: NeilBrown <neilb@suse.de>, linux-raid@vger.kernel.org
To: Neil Brown <neilb@suse.de>, linux-raid@vger.kernel.org
Cc: linux-kernel@vger.kernel.org
Subject: [MD] need another print_sb for mdp_superblock_1
Date: Sun,  5 Oct 2008 01:21:14 +0800	[thread overview]
Message-ID: <1223140874-7067-1-git-send-email-crquan@gmail.com> (raw)

The current print_sb function is only for superblock 0.90.xx, not for
superblock 1.00.00 above, otherwise it would drop silly messages like

  md:	**********************************
  md:	* <COMPLETE RAID STATE PRINTOUT> *
  md:	**********************************
  md2: <ram2><ram3><ram1><ram0>
  md: rdev ram2, SZ:00065472 F:0 S:1 DN:4
  md: rdev superblock:
  md:  SB: (V:1.0.0) ID:<35550a8f.00000000.00000000.00000000> CT:4f45a9ef
  md:     L978400564 S1684889970 ND:762016617 RD:1684627826 md13613 LO:65536 CS:-2
  md:     UT:00000010 ST:0 AD:131056 WD:0 FD:0 SD:0 CSUM:00000000 E:00000000
       D  0:  DISK<N:-1,(-1,-1),R:-1,S:-1>
       D  1:  DISK<N:-1,(-1,-1),R:-1,S:-1>
       D  2:  DISK<N:-1,(-1,-1),R:-1,S:-1>
       D  3:  DISK<N:-1,(-1,-1),R:-1,S:-1>
  md:     THIS:  DISK<N:0,(0,0),R:0,S:0>

So we need another print_mdp_superblock_1 function, either directly used in
print_rdev or or we can add an function pointer to struct super_type.

Denis ChengRq

---

This little patch is just an implementation example, we can revamp print_rdev,
but I'm more intended for another pointer in struct super_type.

diff --git a/drivers/md/md.c b/drivers/md/md.c
index deeac4b..d7f1b22 100644
--- a/drivers/md/md.c
+++ b/drivers/md/md.c
@@ -1634,7 +1634,7 @@ static void print_sb(mdp_super_t *sb)
 
 }
 
-static void print_rdev(mdk_rdev_t *rdev)
+static void print_rdev(mdk_rdev_t *rdev, int major_version)
 {
 	char b[BDEVNAME_SIZE];
 	printk(KERN_INFO "md: rdev %s, SZ:%08llu F:%d S:%d DN:%u\n",
@@ -1643,7 +1643,9 @@ static void print_rdev(mdk_rdev_t *rdev)
 	        rdev->desc_nr);
 	if (rdev->sb_loaded) {
 		printk(KERN_INFO "md: rdev superblock:\n");
-		print_sb((mdp_super_t*)page_address(rdev->sb_page));
+		if (major_version == 0)
+			print_sb((mdp_super_t*)page_address(rdev->sb_page));
+		/* if major_version 1: print mdp_superblock_1 */
 	} else
 		printk(KERN_INFO "md: no rdev superblock!\n");
 }
@@ -1670,7 +1672,7 @@ static void md_print_devices(void)
 		printk("\n");
 
 		rdev_for_each(rdev, tmp2, mddev)
-			print_rdev(rdev);
+			print_rdev(rdev, mddev->major_version);
 	}
 	printk("md:	**********************************\n");
 	printk("\n");

                 reply	other threads:[~2008-10-04 17:22 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1223140874-7067-1-git-send-email-crquan@gmail.com \
    --to=crquan@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-raid@vger.kernel.org \
    --cc=neilb@suse.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®