Re: Re: fr1-2.16 patch for 2.6.10 kernel

[email protected]
Newsgroups gmane.linux.enbd.general
Message-ID <[email protected]>
Selon "Peter T. Breuer" <[email protected]>:

> "Also sprach Peter T. Breuer:"
> > Actually, one can do a little better. Make the whole (2.6.8.1) routine
> 
> Nah .. leave the rdev != *rdevp out of it. I don't want to mess up the
> count. Leave it to the rest of the existing code to worry about what
> happens if we choose the same disk again.
> 
> >         for (; i < disks; i++) {
> >                 mdk_rdev_t *rdev = conf->mirrors[i].rdev;
> >                 if (rdev && rdev != *rdevp && rdev->in_sync) {
> >                         *rdevp = rdev;
> >                         atomic_inc(&rdev->nr_pending);
> >                         spin_unlock_irq(&conf->device_lock);
> >                         return i;
> >                 }
> >         }
> 

After patching, i have that : 

static int map(mddev_t *mddev, mdk_rdev_t **rdevp)
{
        conf_t *conf = mddev_to_conf(mddev);
        int i, disks = conf->raid_disks;
#ifdef CONFIG_MD_RAID1_ROBUST_READ
        mdk_rdev_t *rdev = *rdevp;
#endif /* CONFIG_MD_RAID1_READ_WRITE_CORRECT */

        /*
         * Later we do read balancing on the read side
         * now we use the first available disk.
         */

        spin_lock_irq(&conf->device_lock);
#ifdef CONFIG_MD_RAID1_ROBUST_READ
        /*
         * Uh, no. Choose the next disk if we can, not the first.
         */
        for (i = 0; i < disks; i++) {
                if (conf->mirrors[i].rdev == rdev) {
                        i++;
                        break;
                }
        }
        if (i >= disks)
                i = 0;
        for (; i < disks; i++) {
                if (conf->mirrors[i].operational) {
                        *rdevp = conf->mirrors[i].rdev;
                        atomic_inc(&(*rdevp)->nr_pending);
                        spin_unlock_irq(&conf->device_lock);
                        return i;
                }
        }
        /*
         * If for some reason we fund nothing, dropthru and use the old
         * routine.
         */
#endif /* CONFIG_MD_RAID1_READ_WRITE_CORRECT */
        for (i = 0; i < disks; i++) {
                mdk_rdev_t *rdev = conf->mirrors[i].rdev;
                if (rdev && rdev->in_sync) {
                        *rdevp = rdev;
                        atomic_inc(&rdev->nr_pending);
                        spin_unlock_irq(&conf->device_lock);
                        return i;
                }
        }
        spin_unlock_irq(&conf->device_lock);

        printk(KERN_ERR "raid1_map(): huh, no more operational devices?\n");
        return -1;
}

So, what would you change ?



----------------------------------------------------------------
      Lycée Diderot Paris  - Ce message est envoyé avec IMP -
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.