diff options
author | Neil Brown <neilb@suse.de> | 2008-07-12 20:27:38 +1000 |
---|---|---|
committer | Neil Brown <neilb@suse.de> | 2008-07-12 20:27:38 +1000 |
commit | f7e7067b47d2ca9994f9222dfa5833ac84ce3b22 (patch) | |
tree | 9519e435af3001dd2ccb2ee01d114067213aa615 /super-ddf.c | |
parent | 6adfd3affda071d1083497d150a1150ade0e3fdb (diff) | |
download | mdadm-f7e7067b47d2ca9994f9222dfa5833ac84ce3b22.tar.gz mdadm-f7e7067b47d2ca9994f9222dfa5833ac84ce3b22.tar.xz mdadm-f7e7067b47d2ca9994f9222dfa5833ac84ce3b22.zip |
Add subarray field to supertype.
When loading the metadata for a subarray (super_by_fd), we set
->subarray to be the name read from md/metadata_version so that
getinfo_super can return info about the correct array.
With this we can differentiate between a container and
an array within the container by looking at ->subarray[0].
Diffstat (limited to 'super-ddf.c')
-rw-r--r-- | super-ddf.c | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/super-ddf.c b/super-ddf.c index 5644aea..378a5d2 100644 --- a/super-ddf.c +++ b/super-ddf.c @@ -733,6 +733,8 @@ static int load_super_ddf(struct supertype *st, int fd, if (load_super_ddf_all(st, fd, &st->sb, devname, 1) == 0) return 0; #endif + if (st->subarray[0]) + return 1; /* FIXME Is this correct */ if (get_dev_size(fd, devname, &dsize) == 0) return 1; @@ -1826,6 +1828,7 @@ static int init_super_ddf_bvd(struct supertype *st, vcl = malloc(offsetof(struct vcl, conf) + ddf->conf_rec_len * 512); vcl->lba_offset = (__u64*) &vcl->conf.phys_refnum[ddf->mppe]; vcl->vcnum = venum; + sprintf(st->subarray, "%d", venum); vcl->block_sizes = NULL; /* FIXME not for CONCAT */ vc = &vcl->conf; @@ -2449,6 +2452,15 @@ static int load_super_ddf_all(struct supertype *st, int fd, seq = load_ddf_local(dfd, super, NULL, keep_fd); if (!keep_fd) close(dfd); } + if (st->subarray[0]) { + struct vcl *v; + + for (v = super->conflist; v; v = v->next) + if (v->vcnum == atoi(st->subarray)) + super->newconf = v; + if (!super->newconf) + return 1; + } *sbp = super; if (st->ss == NULL) { st->ss = &super_ddf_container; |