Change Build to take a struct context

Signed-off-by: NeilBrown <neilb@suse.de>
This commit is contained in:
NeilBrown 2012-07-09 17:19:21 +10:00
parent 86da243fda
commit 0c9e4afb1f
3 changed files with 9 additions and 9 deletions

14
Build.c
View File

@ -31,7 +31,7 @@
int Build(char *mddev, int chunk, int level, int layout, int Build(char *mddev, int chunk, int level, int layout,
int raiddisks, struct mddev_dev *devlist, int assume_clean, int raiddisks, struct mddev_dev *devlist, int assume_clean,
char *bitmap_file, int bitmap_chunk, int write_behind, char *bitmap_file, int bitmap_chunk, int write_behind,
int delay, int verbose, int autof, unsigned long long size) struct context *c, unsigned long long size)
{ {
/* Build a linear or raid0 arrays without superblocks /* Build a linear or raid0 arrays without superblocks
* We cannot really do any checks, we just do it. * We cannot really do any checks, we just do it.
@ -90,26 +90,26 @@ int Build(char *mddev, int chunk, int level, int layout,
break; break;
case 10: case 10:
layout = 0x102; /* near=2, far=1 */ layout = 0x102; /* near=2, far=1 */
if (verbose > 0) if (c->verbose > 0)
pr_err("layout defaults to n1\n"); pr_err("layout defaults to n1\n");
break; break;
case 5: case 5:
case 6: case 6:
layout = map_name(r5layout, "default"); layout = map_name(r5layout, "default");
if (verbose > 0) if (c->verbose > 0)
pr_err("layout defaults to %s\n", map_num(r5layout, layout)); pr_err("layout defaults to %s\n", map_num(r5layout, layout));
break; break;
case LEVEL_FAULTY: case LEVEL_FAULTY:
layout = map_name(faultylayout, "default"); layout = map_name(faultylayout, "default");
if (verbose > 0) if (c->verbose > 0)
pr_err("layout defaults to %s\n", map_num(faultylayout, layout)); pr_err("layout defaults to %s\n", map_num(faultylayout, layout));
break; break;
} }
/* We need to create the device. It can have no name. */ /* We need to create the device. It can have no name. */
map_lock(&map); map_lock(&map);
mdfd = create_mddev(mddev, NULL, autof, LOCAL, mdfd = create_mddev(mddev, NULL, c->autof, LOCAL,
chosen_name); chosen_name);
if (mdfd < 0) { if (mdfd < 0) {
map_unlock(&map); map_unlock(&map);
@ -230,7 +230,7 @@ int Build(char *mddev, int chunk, int level, int layout,
} }
bitmapsize = size>>9; /* FIXME wrong for RAID10 */ bitmapsize = size>>9; /* FIXME wrong for RAID10 */
if (CreateBitmap(bitmap_file, 1, NULL, bitmap_chunk, if (CreateBitmap(bitmap_file, 1, NULL, bitmap_chunk,
delay, write_behind, bitmapsize, major)) { c->delay, write_behind, bitmapsize, major)) {
goto abort; goto abort;
} }
bitmap_fd = open(bitmap_file, O_RDWR); bitmap_fd = open(bitmap_file, O_RDWR);
@ -273,7 +273,7 @@ int Build(char *mddev, int chunk, int level, int layout,
goto abort; goto abort;
} }
} }
if (verbose >= 0) if (c->verbose >= 0)
pr_err("array %s built and started.\n", pr_err("array %s built and started.\n",
mddev); mddev);
wait_for(mddev, mdfd); wait_for(mddev, mdfd);

View File

@ -1315,7 +1315,7 @@ int main(int argc, char *argv[])
rv = Build(devlist->devname, chunk, level, layout, rv = Build(devlist->devname, chunk, level, layout,
raiddisks, devlist->next, assume_clean, raiddisks, devlist->next, assume_clean,
bitmap_file, bitmap_chunk, write_behind, bitmap_file, bitmap_chunk, write_behind,
c.delay, c.verbose, c.autof, size); &c, size);
break; break;
case CREATE: case CREATE:
if (c.delay == 0) if (c.delay == 0)

View File

@ -1101,7 +1101,7 @@ extern int Assemble(struct supertype *st, char *mddev,
extern int Build(char *mddev, int chunk, int level, int layout, extern int Build(char *mddev, int chunk, int level, int layout,
int raiddisks, struct mddev_dev *devlist, int assume_clean, int raiddisks, struct mddev_dev *devlist, int assume_clean,
char *bitmap_file, int bitmap_chunk, int write_behind, char *bitmap_file, int bitmap_chunk, int write_behind,
int delay, int verbose, int autof, unsigned long long size); struct context *c, unsigned long long size);
extern int Create(struct supertype *st, char *mddev, extern int Create(struct supertype *st, char *mddev,