diff options
author | NeilBrown <neilb@suse.de> | 2014-05-06 14:52:24 +1000 |
---|---|---|
committer | NeilBrown <neilb@suse.de> | 2014-05-21 11:54:48 +1000 |
commit | 476066a3d54d9ff258586115c987d20da7eb2c53 (patch) | |
tree | ec353fdfed735e542348a10fad3bfc2aec4cf2c1 /super-ddf.c | |
parent | fca65520007a603197a995c5c1bf8366d1fc2370 (diff) |
DDF: add support of --data-offset when creating array.
Infrastructure is there, so use it.
This requires making sure that ->data_offset is correctly set, even
for containers.
Signed-off-by: NeilBrown <neilb@suse.de>
Diffstat (limited to 'super-ddf.c')
-rw-r--r-- | super-ddf.c | 22 |
1 files changed, 10 insertions, 12 deletions
diff --git a/super-ddf.c b/super-ddf.c index c8d45132..58d00fdd 100644 --- a/super-ddf.c +++ b/super-ddf.c @@ -2337,11 +2337,6 @@ static int init_super_ddf(struct supertype *st, struct phys_disk *pd; struct virtual_disk *vd; - if (data_offset != INVALID_SECTORS) { - pr_err("data-offset not supported by DDF\n"); - return 0; - } - if (st->sb) return init_super_ddf_bvd(st, info, size, name, homehost, uuid, data_offset); @@ -2745,7 +2740,8 @@ static int init_super_ddf_bvd(struct supertype *st, #ifndef MDASSEMBLE static void add_to_super_ddf_bvd(struct supertype *st, - mdu_disk_info_t *dk, int fd, char *devname) + mdu_disk_info_t *dk, int fd, char *devname, + unsigned long long data_offset) { /* fd and devname identify a device within the ddf container (st). * dk identifies a location in the new BVD. @@ -2789,7 +2785,7 @@ static void add_to_super_ddf_bvd(struct supertype *st, if (ddf->currentconf->block_sizes) blocks = ddf->currentconf->block_sizes[dk->raid_disk]; - pos = find_space(ddf, dl, INVALID_SECTORS, &blocks); + pos = find_space(ddf, dl, data_offset, &blocks); if (pos == INVALID_SECTORS) return; @@ -2878,7 +2874,7 @@ static int add_to_super_ddf(struct supertype *st, __u32 *tptr; if (ddf->currentconf) { - add_to_super_ddf_bvd(st, dk, fd, devname); + add_to_super_ddf_bvd(st, dk, fd, devname, data_offset); return 0; } @@ -3288,6 +3284,7 @@ static __u64 avail_size_ddf(struct supertype *st, __u64 devsize, static int reserve_space(struct supertype *st, int raiddisks, unsigned long long size, int chunk, + unsigned long long data_offset, unsigned long long *freesize) { /* Find 'raiddisks' spare extents at least 'size' big (but @@ -3308,7 +3305,7 @@ static int reserve_space(struct supertype *st, int raiddisks, for (dl = ddf->dlist ; dl ; dl=dl->next) { unsigned long long minsize = ULLONG_MAX; - find_space(ddf, dl, INVALID_SECTORS, &minsize); + find_space(ddf, dl, data_offset, &minsize); if (minsize >= size && minsize >= (unsigned)chunk) { cnt++; dl->esize = minsize; @@ -3410,7 +3407,8 @@ static int validate_geometry_ddf(struct supertype *st, * chosen so that add_to_super/getinfo_super * can return them. */ - return reserve_space(st, raiddisks, size, *chunk, freesize); + return reserve_space(st, raiddisks, size, *chunk, + data_offset, freesize); } return 1; } @@ -3556,7 +3554,7 @@ static int validate_geometry_ddf_bvd(struct supertype *st, if (minsize == 0) minsize = 8; for (dl = ddf->dlist; dl ; dl = dl->next) { - if (find_space(ddf, dl, INVALID_SECTORS, &minsize) + if (find_space(ddf, dl, data_offset, &minsize) != INVALID_SECTORS) dcnt++; } @@ -3587,7 +3585,7 @@ static int validate_geometry_ddf_bvd(struct supertype *st, return 0; } maxsize = ULLONG_MAX; - find_space(ddf, dl, INVALID_SECTORS, &maxsize); + find_space(ddf, dl, data_offset, &maxsize); *freesize = maxsize; // FIXME here I am |