xfs
[Top] [All Lists]

Re: swidth with mdadm and RAID6

To: cousins@xxxxxxxxxxxxxx
Subject: Re: swidth with mdadm and RAID6
From: Shailendra Tripathi <stripathi@xxxxxxxxx>
Date: Wed, 20 Sep 2006 01:49:51 +0530
Cc: "xfs@xxxxxxxxxxx" <xfs@xxxxxxxxxxx>
In-reply-to: <Pine.LNX.4.10.10609191517590.2460-100000@limpet.umeoce.maine.edu>
References: <Pine.LNX.4.10.10609191517590.2460-100000@limpet.umeoce.maine.edu>
Sender: xfs-bounce@xxxxxxxxxxx
User-agent: Mozilla Thunderbird 1.0.6 (Windows/20050716)
Steve Cousins wrote:

a 2.6.17 kernel.  So, with this in mind, is there a change that I
should try in libdisk/md.c?  Tim had suggested:

        s/nr_disks/raid_disks/

Would this be sufficient? Or should nr_disks be initialized as raid_disks
and then go into the switch clause?



I ended up just adding:

        md.nr_disks = md.raid_disks;

right be fore the switch statement and it worked fine in my situation.
Not sure how this would work with other kernels etc. but I'll let you
figure that out.


Thanks very much for your help.

Steve



Hi Steve,
Technically speaking, you are doing the same thing. However, just write the function below to avoid any confusion.


int
md_get_subvol_stripe(
        char            *dfile,
        sv_type_t       type,
        int             *sunit,
        int             *swidth,
        int             *sectalign,
        struct stat64   *sb)
{
        if (mnt_is_md_subvol(sb->st_rdev)) {
                struct md_array_info    md;
                int                     fd;

                /* Open device */
                fd = open(dfile, O_RDONLY);
                if (fd == -1)
                        return 0;

                /* Is this thing on... */
                if (ioctl(fd, GET_ARRAY_INFO, &md)) {
                        fprintf(stderr,
                                _("Error getting MD array info from %s\n"),
                                dfile);
                        exit(1);
                }
                close(fd);

                /*
                 * Ignore levels we don't want aligned (e.g. linear)
                 * and deduct disk(s) from stripe width on RAID4/5/6
                 */
                switch (md.level) {
                case 6:
                        md.raid_disks--;
                        /* fallthrough */
                case 5:
                case 4:
                        md.raid_disks--;
                        /* fallthrough */
                case 1:
                case 0:
                case 10:
                        break;
                default:
                        return 0;
                }

                /* Update sizes */
                *sunit = md.chunk_size >> 9;
                *swidth = *sunit * md.raid_disks;
                *sectalign = (md.level == 4 || md.level == 5 || md.level == 6);

                return 1;
        }
        return 0;
}



<Prev in Thread] Current Thread [Next in Thread>