Re: Re: fr1-2.16 patch for 2.6.10 kernel
"Peter T. Breuer" <[email protected]>
| Newsgroups | gmane.linux.enbd.general |
|---|---|
| Message-ID | <[email protected]> |
"Also sprach ptb:"
> So I would suppose one wants exactly the same loop as would come next,
> just with the "i = 0" reset dropped.
>
> #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++) {
> mdk_rdev_t *rdev = conf->mirrors[i].rdev;
> if (rdev && ! rdev->faulty) {
> *rdevp = rdev;
> atomic_inc(&rdev->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_ROBUST_READ */
Actually, one can do a little better. Make the whole (2.6.8.1) routine
look like this:
static int map(mddev_t *mddev, mdk_rdev_t **rdevp)
{
conf_t *conf = mddev_to_conf(mddev);
int i, disks = conf->raid_disks;
/*
* 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 == *rdevp) {
i++;
break;
}
}
if (i >= disks)
i = 0;
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;
}
}
/*
* If for some reason we fund nothing, dropthru and use the old
* routine.
*/
#endif /* CONFIG_MD_RAID1_ROBUST_READ */
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;
}
Which is a single hunk. Does that work in 2.6.10?
Peter