quiet WaitClean()

Signed-off-by: Dan Williams <dan.j.williams@intel.com>
This commit is contained in:
Dan Williams 2008-10-02 16:07:21 -07:00
parent 13047e4c07
commit 27dec8fae3
4 changed files with 10 additions and 8 deletions

View File

@ -632,7 +632,7 @@ int Wait(char *dev)
static char *clean_states[] = {
"clear", "inactive", "readonly", "read-auto", "clean", NULL };
int WaitClean(char *dev)
int WaitClean(char *dev, int verbose)
{
int fd;
struct mdinfo *mdi;
@ -641,15 +641,17 @@ int WaitClean(char *dev)
fd = open(dev, O_RDONLY);
if (fd < 0) {
fprintf(stderr, Name ": Couldn't open %s: %s\n", dev, strerror(errno));
if (verbose)
fprintf(stderr, Name ": Couldn't open %s: %s\n", dev, strerror(errno));
return 1;
}
devnum = fd2devnum(fd);
mdi = sysfs_read(fd, devnum, GET_VERSION|GET_LEVEL|GET_SAFEMODE);
if (!mdi) {
fprintf(stderr, Name ": Failed to read sysfs attributes for "
"%s\n", dev);
if (verbose)
fprintf(stderr, Name ": Failed to read sysfs attributes for "
"%s\n", dev);
close(fd);
return 0;
}
@ -714,7 +716,7 @@ int WaitClean(char *dev)
rv = 0;
} else
rv = 1;
if (rv)
if (rv && verbose)
fprintf(stderr, Name ": Error waiting for %s to be clean\n",
dev);

View File

@ -1284,7 +1284,7 @@ int main(int argc, char *argv[])
case 'W':
rv |= Wait(dv->devname); continue;
case Waitclean:
rv |= WaitClean(dv->devname); continue;
rv |= WaitClean(dv->devname, verbose-quiet); continue;
}
mdfd = open_mddev(dv->devname, 1);
if (mdfd>=0) {

View File

@ -723,7 +723,7 @@ extern int Monitor(mddev_dev_t devlist,
extern int Kill(char *dev, int force, int quiet, int noexcl);
extern int Wait(char *dev);
extern int WaitClean(char *dev);
extern int WaitClean(char *dev, int verbose);
extern int Incremental(char *devname, int verbose, int runstop,
struct supertype *st, char *homehost, int autof);

View File

@ -159,7 +159,7 @@ static void try_kill_monitor(char *devname)
for ( ; mdstat; mdstat = mdstat->next)
if (is_container_member(mdstat, devname)) {
sprintf(buf, "/dev/%s", mdstat->dev);
WaitClean(buf);
WaitClean(buf, 0);
}
free_mdstat(mdstat);
remove_pidfile(devname);