Whamcloud - gitweb
Make lovstripe.c a bit more verbose when running the test.
authoradilger <adilger>
Fri, 11 Oct 2002 21:24:05 +0000 (21:24 +0000)
committeradilger <adilger>
Fri, 11 Oct 2002 21:24:05 +0000 (21:24 +0000)
lustre/tests/lovstripe.c

index 01d487c..4c19dba 100644 (file)
@@ -33,11 +33,8 @@ int main( void )
 
        result = write_file("/mnt/lustre/ost1", &a_striping);
 
-       if (result < 0) {
-               fprintf(stderr, "\nProblem writing to /mnt/lustre/ost1: %s\n",
-                       strerror(errno));
+       if (result < 0)
                exit(-1);
-       }
 
        /*  Write file for OST2 only  */
        /*       Start at OST 1, and use only 1 OST  */
@@ -46,11 +43,8 @@ int main( void )
 
        result = write_file("/mnt/lustre/ost2", &a_striping);
 
-       if (result < 0) {
-               fprintf(stderr, "Problem writing to /mnt/lustre/ost2: %s\n",
-                       strerror(errno));
+       if (result < 0)
                exit(-1);
-       }
 
        /*  Write file across both OST1 and OST2  */
        /*       Start at OST 0, and use only 2 OSTs  */
@@ -59,11 +53,8 @@ int main( void )
 
        result = write_file("/mnt/lustre/ost1and2", &a_striping);
 
-       if (result < 0) {
-               fprintf(stderr, "Problem writing to /mnt/lustre/ost1and2: %s\n",
-                       strerror(errno));
+       if (result < 0)
                exit(-1);
-       }
 
        return 0;
 }
@@ -74,6 +65,7 @@ int write_file(char *name, struct lov_user_md *striping)
        char buf[262144], buf2[262144];
        int fd, result;
 
+       printf("opening %s\n", name);
        fd = open(name, O_CREAT | O_RDWR | O_LOV_DELAY_CREATE);
        if (fd < 0) {
                fprintf(stderr, "\nUnable to open '%s': %s\n",
@@ -81,6 +73,7 @@ int write_file(char *name, struct lov_user_md *striping)
                return -1;
        }
 
+       printf("setting stripe data on %s\n", name);
        result = ioctl(fd, LL_IOC_LOV_SETSTRIPE, striping);
        if (result < 0) {
                fprintf(stderr, "\nError on ioctl for '%s' (%d): %s\n",
@@ -90,48 +83,51 @@ int write_file(char *name, struct lov_user_md *striping)
        }
 
        /*  Write bogus data  */
+       printf("writing data to %s\n", name);
        result = write(fd, buf, sizeof(buf));
-       if (result < 0 || result != sizeof(buf)) {
-               fprintf(stderr, "\nError in writing data to '%s' (%d): %s\n",
+       if (result < 0) {
+               fprintf(stderr, "\nerror: writing data to '%s' (%d): %s\n",
                        name, fd, strerror(errno));
                close(fd);
                return -1;
        }
 
        if (result != sizeof(buf)) {
-               fprintf(stderr, "\nShort write to '%s' (%d): %d != %d\n",
+               fprintf(stderr, "\nerror: short write to '%s' (%d): %d != %d\n",
                        name, fd, result, sizeof(buf));
                close(fd);
                return -1;
        }
 
        /*  Seek to beginning again */
+       printf("seeking in %s\n", name);
        result = lseek(fd, 0, SEEK_SET);
        if (result < 0) {
-               fprintf(stderr, "\nError seeking to beginning '%s' (%d): %s\n",
+               fprintf(stderr, "\nerror: seeking to beginning '%s' (%d): %s\n",
                        name, fd, strerror(errno));
                close(fd);
                return -1;
        }
 
        /*  Read bogus data back  */
+       printf("reading data from %s\n", name);
        result = read(fd, buf2, sizeof(buf));
        if (result < 0) {
-               fprintf(stderr, "\nError in reading data from '%s' (%d): %s\n",
+               fprintf(stderr, "\nerror: reading data from '%s' (%d): %s\n",
                        name, fd, strerror(errno));
                close(fd);
                return -1;
        }
 
        if (result != sizeof(buf)) {
-               fprintf(stderr, "\nShort read from '%s' (%d): %d != %d\n",
+               fprintf(stderr,"\nerror: short read from '%s' (%d): %d != %d\n",
                        name, fd, result, sizeof(buf));
                close(fd);
                return -1;
        }
 
        if (memcmp(buf, buf2, sizeof(buf))) {
-               fprintf(stderr, "\nError comparing data in '%s' (%d): %s\n",
+               fprintf(stderr, "\nerror: comparing data in '%s' (%d): %s\n",
                        name, fd, strerror(errno));
                close(fd);
                return -1;