summaryrefslogtreecommitdiff
path: root/Kill.c
diff options
context:
space:
mode:
authorNeil Brown <neilb@suse.de>2008-05-15 16:48:12 +1000
committerNeil Brown <neilb@suse.de>2008-05-15 16:48:12 +1000
commit111d01fcc76d2e7d0b05f78fae67e89cdf6856ad (patch)
tree2faa362b6581db04a41f876a57c4b1c9ca6582a7 /Kill.c
parent11fcec12ef68fa3b915e26676c47ee0f97d62256 (diff)
Change write_init_super to be called only once.
The current model for creating arrays involves writing a superblock to each device in the array. With containers (as with DDF), that model doesn't work. Every device in the container may need to be updated for an array made from just some the devices in a container. So instead of calling write_init_super for each device, we call it once for the array and have it iterate over all the devices in the array. To help with this, ->add_to_super now passes in an 'fd' and name for the device. These get saved for use by write_init_super. So add_to_super takes ownership of the fd, and write_init_super will close it. This information is stored in the new 'info' field of supertype. As part of this, write_init_super now removes any old traces of raid metadata rather than doing this in common code.
Diffstat (limited to 'Kill.c')
-rw-r--r--Kill.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/Kill.c b/Kill.c
index 0a2763ea..5b254872 100644
--- a/Kill.c
+++ b/Kill.c
@@ -34,7 +34,7 @@
#include "md_u.h"
#include "md_p.h"
-int Kill(char *dev, int force, int quiet)
+int Kill(char *dev, int force, int quiet, int noexcl)
{
/*
* Nothing fancy about Kill. It just zeroes out a superblock
@@ -44,7 +44,7 @@ int Kill(char *dev, int force, int quiet)
int fd, rv = 0;
struct supertype *st;
- fd = open(dev, O_RDWR|O_EXCL);
+ fd = open(dev, noexcl ? O_RDWR : (O_RDWR|O_EXCL));
if (fd < 0) {
if (!quiet)
fprintf(stderr, Name ": Couldn't open %s for write - not zeroing\n",