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;
}
|