diff options
author | Neil Brown <neilb@suse.de> | 2005-06-07 23:16:35 +0000 |
---|---|---|
committer | Neil Brown <neilb@suse.de> | 2005-06-07 23:16:35 +0000 |
commit | c82f047cfceb479c9c6b56b44c196018af050e45 (patch) | |
tree | 2bce84dc8b9cf6068a863372f0c06530def3a1a4 /Create.c | |
parent | a3fd117c7a2b2449704ee86eb9ec180906142f7a (diff) | |
download | mdadm-c82f047cfceb479c9c6b56b44c196018af050e45.tar.gz mdadm-c82f047cfceb479c9c6b56b44c196018af050e45.tar.xz mdadm-c82f047cfceb479c9c6b56b44c196018af050e45.zip |
Initial bitmap support
Signed-off-by: Neil Brown <neilb@cse.unsw.edu.au>
Diffstat (limited to 'Create.c')
-rw-r--r-- | Create.c | 24 |
1 files changed, 23 insertions, 1 deletions
@@ -34,7 +34,8 @@ int Create(struct supertype *st, char *mddev, int mdfd, int chunk, int level, int layout, unsigned long size, int raiddisks, int sparedisks, int subdevs, mddev_dev_t devlist, - int runstop, int verbose, int force) + int runstop, int verbose, int force, + char *bitmap_file, int bitmap_chunk, int delay) { /* * Create a new raid array. @@ -66,6 +67,7 @@ int Create(struct supertype *st, char *mddev, int mdfd, int pass; int vers; int rv; + int bitmap_fd; mdu_array_info_t array; @@ -358,6 +360,26 @@ int Create(struct supertype *st, char *mddev, int mdfd, return 1; } + if (bitmap_file) { + int uuid[4]; + st->ss->uuid_from_super(uuid, super); + if (CreateBitmap(bitmap_file, force, (char*)uuid, bitmap_chunk, delay, + array.size*2ULL /* FIXME wrong for raid10 */)) { + return 1; + } + bitmap_fd = open(bitmap_file, O_RDWR); + if (bitmap_fd < 0) { + fprintf(stderr, Name ": weird: %s cannot be openned\n", + bitmap_file); + return 1; + } + if (ioctl(mdfd, SET_BITMAP_FILE, bitmap_fd) < 0) { + fprintf(stderr, Name ": Cannot set bitmap file for %s: %s\n", + mddev, strerror(errno)); + return 1; + } + } + for (pass=1; pass <=2 ; pass++) { |