All of lore.kernel.org
 help / color / mirror / Atom feed
From: Shailendra Tripathi <stripathi@agami.com>
To: cousins@umit.maine.edu
Cc: "\"xfs@oss.sgi.com\" <xfs@oss.sgi.com>" <xfs@oss.sgi.com>
Subject: Re: swidth with mdadm and RAID6
Date: Tue, 19 Sep 2006 03:43:51 +0530	[thread overview]
Message-ID: <450F1A1F.1020204@agami.com> (raw)
In-Reply-To: <Pine.LNX.4.10.10609181639000.1732-100000@limpet.umeoce.maine.edu>

Hi Steve,
             Your guess appears to be correct. md_ioctl returns nr which 
is total number of disk in the array including the spare disks. However, 
XFS function md_get_vol_stripe does not take spare disk into account. It 
needs to subtract spare_disks as well.
     However, md.spare_disks returned by the call returns spare + parity 
(both). So, one way could be substract spare_disks directly. Otherwise, 
the xfs should rely on md.raid_disks. This does not include spare_disks 
and nr.disks should be changed for that.
    
When I run my program md_info on  raid5 array with 5 devices and 2 
spares, I get
[root@ga09 root]# ./a.out /dev/md11
Level 5, disks=7 spare_disks=3 raid_disks=5

Steve can you please compile the pasted program and run on your system 
with md prepared. It takes /dev/md<no> as input.
In your case, you should get above line as:
Level 6, disks=11 spare disks=3 raid_disks=10

       nr=working=active=failed=spare=0;
        ITERATE_RDEV(mddev,rdev,tmp) {
                nr++;
                if (rdev->faulty)
                        failed++;
                else {
                        working++;
                        if (rdev->in_sync)
                                active++;
                        else
                                spare++;
                }
        }

        info.level         = mddev->level;
        info.size          = mddev->size;
        info.nr_disks      = nr;
       ....
        info.active_disks  = active;
        info.working_disks = working;
        info.failed_disks  = failed;
        info.spare_disks   = spare;

-shailendra
The program is pasted below:
md_info.c. Takes /dev/md<no> as name. For example, /dev/md11.

#include<stdio.h>
#include<fcntl.h>
#include<sys/ioctl.h>
#ifndef MD_MAJOR
#define MD_MAJOR                9
#endif

#define GET_ARRAY_INFO          _IOR (MD_MAJOR, 0x11, struct md_array_info)


struct md_array_info {
__uint32_t major_version;
__uint32_t minor_version;
__uint32_t patch_version;
__uint32_t ctime;
__uint32_t level;
__uint32_t size;
__uint32_t nr_disks;
__uint32_t raid_disks;
__uint32_t md_minor;
__uint32_t not_persistent;
/*
* Generic state information
*/
__uint32_t utime;         /*  0 Superblock update time            */
__uint32_t state;         /*  1 State bits (clean, ...)           */
__uint32_t active_disks;  /*  2 Number of currently active disks  */
__uint32_t working_disks; /*  3 Number of working disks           */
__uint32_t failed_disks;  /*  4 Number of failed disks            */
__uint32_t spare_disks;   /*  5 Number of spare disks             */
/*
* Personality information
*/
__uint32_t layout;        /*  0 the array's physical layout       */
__uint32_t chunk_size;    /*  1 chunk size in bytes   */

};

int main(int argc, char *argv[])
{
        struct md_array_info    md;
        int                     fd;


        /* Open device */
        fd = open(argv[1], O_RDONLY);
        if (fd == -1) {
                printf("Could not open %s\n", argv[1]);
                exit(1);
        }
        if (ioctl(fd, GET_ARRAY_INFO, &md)) {
                printf("Error getting MD array info from %s\n", argv[1]);
                exit(1);
        }
        close(fd);
        printf("Level %d, disks=%d spare_disks=%d raid_disks=%d\n", 
md.level, md.nr_disks,
                md.spare_disks, md.raid_disks);
        return 0;
}

  parent reply	other threads:[~2006-09-18 23:24 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <fc.004c4d192b2c45a93b9aca00fc3f0f38.2b2c4b4d@umit.maine.edu>
2006-09-18 20:28 ` swidth with mdadm and RAID6 Steve Cousins
2006-09-18 20:44 ` Steve Cousins
2006-09-18 21:06   ` Shailendra Tripathi
2006-09-18 22:13   ` Shailendra Tripathi [this message]
2006-09-19  5:11     ` Timothy Shimmin
2006-09-19  6:44       ` Shailendra Tripathi
2006-09-19  7:02         ` Timothy Shimmin
     [not found] <fc.004c4d192b3470d73b9aca0029fcf469.2b349301@umit.maine.edu>
2006-09-19 17:52 ` Steve Cousins
2006-09-19 19:22   ` Steve Cousins
2006-09-19 20:19     ` Shailendra Tripathi
     [not found] <fc.004c4d192b2da8e03b9aca0078918430.2b2da8e5@umit.maine.edu>
2006-09-19 16:36 ` Steve Cousins
2006-09-19 16:58   ` Shailendra Tripathi
2006-09-19 17:13   ` Steve Cousins
     [not found] <fc.004c4d192b2a17d13b9aca00b4f73745.2b2a26d7@umit.maine.edu>
2006-09-18 15:33 ` Steve Cousins
2006-09-18 18:10   ` Shailendra Tripathi
2006-09-18 18:19     ` Shailendra Tripathi
2006-09-15 21:07 Steve Cousins
2006-09-15 23:49 ` Peter Grandi
2006-09-18 14:50 ` Shailendra Tripathi

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=450F1A1F.1020204@agami.com \
    --to=stripathi@agami.com \
    --cc=cousins@umit.maine.edu \
    --cc=xfs@oss.sgi.com \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.