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 */
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 */
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;
}
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",
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",
}
/* 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;