Login
[x]
Log in using an account from:
Fedora Account System
Red Hat Associate
Red Hat Customer
Or login using a Red Hat Bugzilla account
Forgot Password
Login:
Hide Forgot
Create an Account
Red Hat Bugzilla – Attachment 913989 Details for
Bug 1090423
Data integrity issue on rebuilding RAID 6 with 100MB resync speed
[?]
New
Simple Search
Advanced Search
My Links
Browse
Requests
Reports
Current State
Search
Tabular reports
Graphical reports
Duplicates
Other Reports
User Changes
Plotly Reports
Bug Status
Bug Severity
Non-Defaults
|
Product Dashboard
Help
Page Help!
Bug Writing Guidelines
What's new
Browser Support Policy
5.0.4.rh83 Release notes
FAQ
Guides index
User guide
Web Services
Contact
Legal
This site requires JavaScript to be enabled to function correctly, please enable it.
sorage integrity checker - CAVEAT THIS DESTROYS ALL DATA ON THE NAMED DEVICE
integrity.c (text/x-csrc), 3.61 KB, created by
Mark Goodwin
on 2014-07-02 06:07:18 UTC
(
hide
)
Description:
sorage integrity checker - CAVEAT THIS DESTROYS ALL DATA ON THE NAMED DEVICE
Filename:
MIME Type:
Creator:
Mark Goodwin
Created:
2014-07-02 06:07:18 UTC
Size:
3.61 KB
patch
obsolete
>/* > * multithreaded storage integrity checker. > * > * **** USE WITH EXTREME CAUTION. **** > * > * WARNING : this program will overwrite all data on the named device > * or file, causing complete loss of all data or filesystem or raw data > * on the device, including metadata and partition tables. > * > * Usage: nthreads size-per-thread device-or-file > * - nthreads is the number of parallel threads > * - size-per-thread is the number of Gbytes each thread will test > * - device-or-file is the device to be tested. It must be at least > * nthreads * size-per-thread Gbytes in size. > */ >#include <stdio.h> >#include <time.h> >#include <sys/types.h> >#include <sys/stat.h> >#include <fcntl.h> >#include <pthread.h> >#include <unistd.h> >#include <stdlib.h> >#include <string.h> > >#define MB (1024*1024) >#define GB (1024*MB) >#define BUFSIZE MB > >typedef struct { > off_t chunk; > off_t offset; > char *devname; >} arg_t; > >static unsigned long sum(unsigned char *buf, int len) >{ > unsigned long sum = 0; > unsigned char *p = buf, *pend = buf + len; > > for (; p < pend; p++) > sum += *p; > return sum; >} > >/* > * per-thread workload > */ >void * >work(void *a) >{ > arg_t *arg = (arg_t *)a; > unsigned char buffer[BUFSIZE]; > int rfd, dfd; > off_t off; > unsigned long s; > > rfd = open("/dev/urandom", O_RDONLY); > dfd = open(arg->devname, O_RDWR); > > if (dfd < 0) { > perror(arg->devname); > exit(1); > } > > /* read in the random bytes for this chunk */ > if (read(rfd, buffer, BUFSIZE) != BUFSIZE) { > perror("/dev/urandom"); > fprintf(stderr, "thread offset %luG FAILED to read urandom\n", arg->offset/GB); > exit(1); > > } > s = sum(buffer, BUFSIZE); > > for(;;) { > > /* write to the whole chunk, verifying as we go */ > for (off=arg->offset; off < arg->offset + arg->chunk - BUFSIZE; off += BUFSIZE) { > lseek(dfd, off, 0); > if (write(dfd, buffer, BUFSIZE) != BUFSIZE) { > perror(arg->devname); > fprintf(stderr, "thread offset %luG FAILED to write at offset %luG\n", arg->offset/GB, off/GB); > exit(1); > } > > lseek(dfd, off, 0); > if (read(dfd, buffer, BUFSIZE) != BUFSIZE) { > perror(arg->devname); > fprintf(stderr, "thread offset %luG FAILED to read at offset %lu bytes\n", arg->offset/GB, off); > exit(1); > } > > if (sum(buffer, BUFSIZE) != s) { > fprintf(stderr, "thread offset %luG FAILED VERIFICATION at offset %luG\n", > arg->offset/GB, off/GB); > exit(1); > } > usleep(100000); > } > > /* now read and re-verify the whole chunk */ > for (off=arg->offset; off < arg->offset + arg->chunk - BUFSIZE; off += BUFSIZE) { > lseek(dfd, off, 0); > if (read(dfd, buffer, BUFSIZE) != BUFSIZE) { > perror(arg->devname); > fprintf(stderr, "thread offset %luG FAILED to read verify at offset %lu bytes\n", arg->offset/GB, off); > exit(1); > } > > if (sum(buffer, BUFSIZE) != s) { > fprintf(stderr, "thread offset %luG FAILED RE-VERIFICATION at offset %luG\n", > arg->offset/GB, off/GB); > exit(1); > } > } > /* ... repeat forever until interrupted */ > } >} > >int >main(int argc, char **argv) >{ > int i, n; > char *dev = argv[1]; > pthread_t *id; > off_t off, c; > arg_t *arg; > > if (argc != 4) { > fprintf(stderr, "Usage: nthreads size-per-thread device-or-file\n"); > fprintf(stderr, "size is in GB\n"); > exit(1); > } > n = atoi(argv[1]); > c = atol(argv[2]) * GB; > dev = argv[3]; > printf("%d threads, each testing %luG\n", n, c/GB); > > arg = (arg_t *)malloc(sizeof(arg_t) * n); > id = (pthread_t *)malloc(sizeof(pthread_t) * n); > > for (i=0, off=0; i < n; i++, off += c) { > arg[i].chunk = c; > arg[i].offset = off; > arg[i].devname = dev; > printf("Thread[%2d] testing %luG .. %luG\n", i, off/GB, (off+c)/GB); > pthread_create(&id[i], NULL, work, (void *)&arg[i]); > } > pause(); > exit(0); >}
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Raw
Actions:
View
Attachments on
bug 1090423
: 913989 |
921122
|
922175
|
922482
|
922826