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 918532 Details for
Bug 1091866
volume is disappered after vol-wipe with logical type pool
[?]
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.
Sample code (compile cc -o scrub scrub.c)
scrub.c (text/plain), 2.39 KB, created by
John Ferlan
on 2014-07-16 21:18:45 UTC
(
hide
)
Description:
Sample code (compile cc -o scrub scrub.c)
Filename:
MIME Type:
Creator:
John Ferlan
Created:
2014-07-16 21:18:45 UTC
Size:
2.39 KB
patch
obsolete
>#include <stdio.h> >#include <unistd.h> >#include <fcntl.h> >#include <stdlib.h> >#include <sys/types.h> >#include <sys/stat.h> > >static int >writezero(int fd, char *writebuf, size_t writebuf_len, off_t extent_len) >{ > int written = 0; > off_t remaining = 0; > size_t write_size = 0; > size_t bytes_wiped = 0; > > printf("About to write extent_len=%ld\n", extent_len); > remaining = extent_len; > while (remaining > 0) { > write_size = (writebuf_len < remaining) ? writebuf_len : remaining; > //printf("remaining=%lu write_size=%lu", remaining, write_size); > written = write(fd, writebuf, write_size); > if (written < 0) { > fprintf(stderr, "Failed to write %zu bytes", write_size); > return -1; > } > bytes_wiped += written; > remaining -= written; > } > printf("Finished writing %ld bytes\n", bytes_wiped); > return bytes_wiped; >} > >int main(int argc, int **argv) > >{ > int fd, rc; > struct stat st; > char *writebuf; > > if (argc != 3) { > fprintf(stderr, "Usage: %s path-to-lv {all|half}\n", argv[0]); > exit(EXIT_FAILURE); > } > > printf("Open '%s' for scrub\n", argv[1]); > fd = open((const char *)argv[1], O_RDWR); > if (fd < 0) { > fprintf(stderr, "Failed to open storage volume"); > exit(EXIT_FAILURE); > } > > if (fstat(fd, &st) == -1) { > fprintf(stderr, "Failed to stat storage volume"); > close(fd); > exit(EXIT_FAILURE); > } > > writebuf = calloc(1, st.st_blksize); > if (writebuf == NULL) { > fprintf(stderr, "Failed to allocate writebuf blksize=%ld", > st.st_blksize); > close(fd); > exit(EXIT_FAILURE); > } > > rc = lseek(fd, 0, SEEK_SET); > if (rc < 0) { > fprintf(stderr, "Failed to seek to start of file"); > free(writebuf); > close(fd); > exit(EXIT_FAILURE); > } > > if (!strcmp(argv[2], "half")) > rc = writezero(fd, writebuf, st.st_blksize, 4096*1024/2); > else if (!strcmp(argv[2], "all")) > rc = writezero(fd, writebuf, st.st_blksize, 4096*1024); > else { > fprintf(stderr, "Invalid arg2='%s', expect half or all", argv[2]); > free(writebuf); > close(fd); > exit(EXIT_FAILURE); > } > if (rc < 0) { > fprintf(stderr, "Failed to write to file"); > free(writebuf); > close(fd); > exit(EXIT_FAILURE); > } > > free(writebuf); > close(fd); > return 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 1091866
: 918532