linux-raid.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Suresh Babu Kandukuru <suresh.babu.kandukuru@oracle.com>
To: linux-raid@vger.kernel.org, neilb@suse.de
Subject: Scalability of MD raid 1  mirror devices
Date: Mon, 12 Oct 2015 05:03:34 -0700 (PDT)	[thread overview]
Message-ID: <a8179bae-f8e8-4239-b760-cd85252e48bc@default> (raw)
In-Reply-To: <98ad0e44-1ac1-4451-a3d3-0a48f3a1d9e7@default>


Dear Group,

We are doing scalability of MD raid 1  mirror devices on the Linux host running the 3.17.2 .   we see the number of RAID 1 devices limited to 128 in one case and 511 in another case .  we would like to know why this limitation ?. Appreciate any kind of inputs and pointers 

We can create the RAID 1 device in 3 ways.

1.  /dev/mdX   -> here X is the number, we can specify from 0 to 511.
2. /dev/md/X  -> here also X is a number from 0 to 511. It creates it as a link to the actual device /dev/mdX. ( similar to above but creates a link also).
3. /dev/md/”name”  -> This creates a link to actual device, whichever is free starting from 127 to 0. Below is the function which is responsible for it.

char *find_free_devnm(int use_partitions)
{
        static char devnm[32];
        int devnum;
        for (devnum = 127; devnum != 128;  devnum = devnum ? devnum-1 : (1<<20)-1) {

                if (use_partitions)
                        sprintf(devnm, "md_d%d", devnum);
                else
                        sprintf(devnm, "md%d", devnum);
                if (mddev_busy(devnm))
                        continue;
                if (!conf_name_is_free(devnm))
                        continue;
                if (!use_udev()) {
                        /* make sure it is new to /dev too, at least as a
                         * non-standard */
                        int devid = devnm2devid(devnm);
                        if (devid) {
                                char *dn = map_dev(major(devid),
                                                   minor(devid), 0);
                                if (dn && ! is_standard(dn, NULL))
                                        continue;
                        }
                }
                break;
        }
        if (devnum == 128)
                return NULL;
        return devnm;
}

So ideally we should not create a device which is more than 128 { The program may crash }.

Then we  tried to find how we are able to create up to 511 and why it is failing after that.

int dev_open(char *dev, int flags)

inside this function 

fd = open(dev, flags);  / this line is assigning fd to -1 , which is causing the program to fail. So I wrote a simple program to crosscheck it.

int main(){

        char devname[32] = "/dev/hello1";

// The flags I have set according to the code.

        int flags = O_RDWR;
        flags |= O_DIRECT;
        if (mknod(devname, S_IFBLK|0600, makedev(9,511)) == 0) {

                int  fd = open(devname, flags);
                cout<<fd<<endl;
                unlink(devname);

        }
}

So if the minor number is more than 511, the “fd” is assigned to -1, if it is in the range of 0 to 511 It is working fine.

So should we go with the range of 511 or stick to 128 ?

Thanks 
/Suresh
--
To unsubscribe from this list: send the line "unsubscribe linux-raid" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

       reply	other threads:[~2015-10-12 12:03 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <98ad0e44-1ac1-4451-a3d3-0a48f3a1d9e7@default>
2015-10-12 12:03 ` Suresh Babu Kandukuru [this message]
2015-10-15  9:04   ` Scalability of MD raid 1 mirror devices Ankur Bose
2015-10-16  1:11     ` Neil Brown
2015-10-16  2:29       ` Neil Brown

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=a8179bae-f8e8-4239-b760-cd85252e48bc@default \
    --to=suresh.babu.kandukuru@oracle.com \
    --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;
as well as URLs for NNTP newsgroup(s).