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 258441 Details for
Bug 352841
GFS2: Evaluate and implement missing gfs2_tool features
[?]
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.
[patch]
Better patch
352841.try2.patch (text/plain), 9.42 KB, created by
Robert Peterson
on 2007-11-14 17:16:04 UTC
(
hide
)
Description:
Better patch
Filename:
MIME Type:
Creator:
Robert Peterson
Created:
2007-11-14 17:16:04 UTC
Size:
9.42 KB
patch
obsolete
>? libgfs2/Makefile.new >? libgfs2/libgfs2.h.new >Index: man/gfs2_tool.8 >=================================================================== >RCS file: /cvs/cluster/cluster/gfs2/man/gfs2_tool.8,v >retrieving revision 1.3.2.3 >diff -w -u -p -p -u -r1.3.2.3 gfs2_tool.8 >--- man/gfs2_tool.8 7 Nov 2007 21:15:13 -0000 1.3.2.3 >+++ man/gfs2_tool.8 14 Nov 2007 17:07:54 -0000 >@@ -21,10 +21,10 @@ Clear an attribute flag on a file. See \ > \fBcounters\fP \fIMountPoint\fR [-c] > Print out statistics about a filesystem. If -c is used, gfs2_tool continues > to run printing out the stats once a second. >-.\".TP >-.\"\fBdf\fP \fIMountPoint\fR >-.\"Print out a space usage summary of a given filesystem. The information >-.\"printed is more detailed than a standard "df". >+.TP >+\fBdf\fP \fIMountPoint\fR >+Print out a space usage summary of a given filesystem. The information >+printed is more detailed than a standard "df". > .\".TP > .\"\fBflush\fP \fIFile\fR > .\"Sync out any dirty data for a file and drop its lock. >Index: tool/df.c >=================================================================== >RCS file: /cvs/cluster/cluster/gfs2/tool/df.c,v >retrieving revision 1.7.2.1 >diff -w -u -p -p -u -r1.7.2.1 df.c >--- tool/df.c 25 Oct 2007 14:14:47 -0000 1.7.2.1 >+++ tool/df.c 14 Nov 2007 17:07:54 -0000 >@@ -31,9 +31,6 @@ > #include "gfs2_tool.h" > #include "libgfs2.h" > >-#define SIZE (65536) >- >-#if GFS2_TOOL_FEATURE_IMPLEMENTED > /** > * do_df_one - print out information about one filesystem > * @path: the path to the filesystem >@@ -43,98 +40,68 @@ > static void > do_df_one(char *path) > { >- struct gfs2_ioctl gi; >- /* char stat_gfs2[SIZE]; */ >- /* unsigned int percentage; */ >- struct gfs2_sb sb; >- struct gfs2_dinode ji, ri; >- unsigned int journals = 0; >+ unsigned int percentage; >+ unsigned int journals; > uint64_t rgrps; > unsigned int flags; >- char *fs, *value; >- int error; >+ char *value, *fs; >+ int x, statfs_fd; > struct gfs2_sbd sbd; >+ char buf[GFS2_DEFAULT_BSIZE], statfs_fn[PATH_MAX]; >+ struct gfs2_statfs_change sc; > >+ memset(&sbd, 0, sizeof(struct gfs2_sbd)); > sbd.path_name = path; > check_for_gfs2(&sbd); >+ fs = mp2fsname(sbd.path_name); > >- sbd.device_fd = open(path, O_RDONLY); >+ sbd.device_fd = open(sbd.device_name, O_RDONLY); > if (sbd.device_fd < 0) > die("can't open %s: %s\n", path, strerror(errno)); > >- fs = mp2fsname(path); >- >- /* >- strncpy(stat_gfs2, __get_sysfs(fs, "statfs"), SIZE); >- stat_gfs2[SIZE - 1] = '\0'; >- */ >- >- { >- char *argv[] = { "get_super" }; >- >- gi.gi_argc = 1; >- gi.gi_argv = argv; >- gi.gi_data = (char *)&sb; >- gi.gi_size = sizeof(struct gfs2_sb); >- >- error = ioctl(sbd.device_fd, GFS2_IOCTL_SUPER, &gi); >- if (error != gi.gi_size) >- die("error doing get_super (%d): %s\n", >- error, strerror(errno)); >- } >- { >- char *argv[] = { "get_hfile_stat", >- "jindex" }; >+ sbd.bsize = GFS2_DEFAULT_BSIZE; >+ sbd.jsize = GFS2_DEFAULT_JSIZE; >+ sbd.rgsize = GFS2_DEFAULT_RGSIZE; >+ sbd.utsize = GFS2_DEFAULT_UTSIZE; >+ sbd.qcsize = GFS2_DEFAULT_QCSIZE; >+ osi_list_init(&sbd.rglist); >+ osi_list_init(&sbd.buf_list); >+ for (x = 0; x < BUF_HASH_SIZE; x++) >+ osi_list_init(&sbd.buf_hash[x]); >+ do_lseek(sbd.device_fd, 0x10 * sbd.bsize); >+ do_read(sbd.device_fd, buf, sbd.bsize); /* read in the superblock */ > >- gi.gi_argc = 2; >- gi.gi_argv = argv; >- gi.gi_data = (char *)&ji; >- gi.gi_size = sizeof(struct gfs2_dinode); >- >- error = ioctl(sbd.device_fd, GFS2_IOCTL_SUPER, &gi); >- if (error != gi.gi_size) >- die("error doing get_hfile_stat for jindex (%d): %s\n", >- error, strerror(errno)); >- } >- { >- char *argv[] = { "get_hfile_stat", >- "rindex" }; >+ compute_constants(&sbd); >+ gfs2_sb_in(&sbd.sd_sb, buf); /* parse it out into the sb structure */ > >- gi.gi_argc = 2; >- gi.gi_argv = argv; >- gi.gi_data = (char *)&ri; >- gi.gi_size = sizeof(struct gfs2_dinode); >- >- error = ioctl(sbd.device_fd, GFS2_IOCTL_SUPER, &gi); >- if (error != gi.gi_size) >- die("error doing get_hfile_stat for rindex (%d): %s\n", >- error, strerror(errno)); >- } >+ sbd.master_dir = gfs2_load_inode(&sbd, >+ sbd.sd_sb.sb_master_dir.no_addr); > >+ gfs2_lookupi(sbd.master_dir, "rindex", 6, &sbd.md.riinode); >+ gfs2_lookupi(sbd.master_dir, "jindex", 6, &sbd.md.jiinode); > close(sbd.device_fd); > >- journals = ji.di_entries - 2; >+ journals = sbd.md.jiinode->i_di.di_entries - 2; > >- rgrps = ri.di_size; >+ rgrps = sbd.md.riinode->i_di.di_size; > if (rgrps % sizeof(struct gfs2_rindex)) > die("bad rindex size\n"); > rgrps /= sizeof(struct gfs2_rindex); > >- > printf("%s:\n", path); >- printf(" SB lock proto = \"%s\"\n", sb.sb_lockproto); >- printf(" SB lock table = \"%s\"\n", sb.sb_locktable); >- printf(" SB ondisk format = %u\n", sb.sb_fs_format); >- printf(" SB multihost format = %u\n", sb.sb_multihost_format); >- printf(" Block size = %u\n", sb.sb_bsize); >+ printf(" SB lock proto = \"%s\"\n", sbd.sd_sb.sb_lockproto); >+ printf(" SB lock table = \"%s\"\n", sbd.sd_sb.sb_locktable); >+ printf(" SB ondisk format = %u\n", sbd.sd_sb.sb_fs_format); >+ printf(" SB multihost format = %u\n", sbd.sd_sb.sb_multihost_format); >+ printf(" Block size = %u\n", sbd.sd_sb.sb_bsize); > printf(" Journals = %u\n", journals); > printf(" Resource Groups = %"PRIu64"\n", rgrps); > printf(" Mounted lock proto = \"%s\"\n", >- ((value = get_sysfs(fs, "args/lockproto"))[0]) ? value : >- sb.sb_lockproto); >+ ((value = get_sysfs(fs, "args/lockproto"))[0]) >+ ? value : sbd.sd_sb.sb_lockproto); > printf(" Mounted lock table = \"%s\"\n", >- ((value = get_sysfs(fs, "args/locktable"))[0]) ? value : >- sb.sb_locktable); >+ ((value = get_sysfs(fs, "args/locktable"))[0]) >+ ? value : sbd.sd_sb.sb_locktable); > printf(" Mounted host data = \"%s\"\n", > get_sysfs(fs, "args/hostdata")); > printf(" Journal number = %s\n", get_sysfs(fs, "lockstruct/jid")); >@@ -145,31 +112,36 @@ do_df_one(char *path) > (get_sysfs_uint(fs, "args/localflocks")) ? "TRUE" : "FALSE"); > printf(" Local caching = %s\n", > (get_sysfs_uint(fs, "args/localcaching")) ? "TRUE" : "FALSE"); >-#if 0 >+ >+ /* Read the master statfs file */ >+ if (!find_gfs2_meta(&sbd)) >+ mount_gfs2_meta(&sbd); >+ lock_for_admin(&sbd); >+ >+ sprintf(statfs_fn, "%s/statfs", sbd.metafs_path); >+ statfs_fd = open(statfs_fn, O_RDONLY); >+ do_read(statfs_fd, buf, sizeof(struct gfs2_statfs_change)); >+ gfs2_statfs_change_in(&sc, (char *)&buf); >+ >+ close(statfs_fd); >+ >+ cleanup_metafs(&sbd); >+ > printf("\n"); > printf(" %-15s%-15s%-15s%-15s%-15s\n", "Type", "Total", "Used", "Free", "use%"); > printf(" ------------------------------------------------------------------------\n"); > >- percentage = (name2u64(stat_gfs2, "total")) ? >- (100.0 * (name2u64(stat_gfs2, "total") - name2u64(stat_gfs2, "free")) / >- name2u64(stat_gfs2, "total") + 0.5) : 0; >- printf(" %-15s%-15"PRIu64"%-15"PRIu64"%-15"PRIu64"%u%%\n", >- "data", >- name2u64(stat_gfs2, "total"), >- name2u64(stat_gfs2, "total") - name2u64(stat_gfs2, "free"), >- name2u64(stat_gfs2, "free"), >- percentage); >- >- percentage = (name2u64(stat_gfs2, "dinodes") + name2u64(stat_gfs2, "free")) ? >- (100.0 * name2u64(stat_gfs2, "dinodes") / >- (name2u64(stat_gfs2, "dinodes") + name2u64(stat_gfs2, "free")) + 0.5) : 0; >- printf(" %-15s%-15"PRIu64"%-15"PRIu64"%-15"PRIu64"%u%%\n", >- "inodes", >- name2u64(stat_gfs2, "dinodes") + name2u64(stat_gfs2, "free"), >- name2u64(stat_gfs2, "dinodes"), >- name2u64(stat_gfs2, "free"), >- percentage); >-#endif >+ percentage = sc.sc_total ? >+ (100.0 * (sc.sc_total - sc.sc_free)) / sc.sc_total + 0.5 : 0; >+ printf(" %-15s%-15llu%-15llu%-15llu%u%%\n", "data", >+ sc.sc_total, sc.sc_total - sc.sc_free, sc.sc_free, percentage); >+ >+ percentage = (sc.sc_dinodes + sc.sc_free) ? >+ (100.0 * sc.sc_dinodes / (sc.sc_dinodes + sc.sc_free)) + 0.5 : >+ 0; >+ printf(" %-15s%-15llu%-15llu%-15llu%u%%\n", "inodes", >+ sc.sc_dinodes + sc.sc_free, sc.sc_dinodes, >+ sc.sc_free, percentage); > } > > >@@ -220,4 +192,3 @@ print_df(int argc, char **argv) > fclose(file); > } > } >-#endif /* #if GFS2_TOOL_FEATURE_IMPLEMENTED */ >Index: tool/main.c >=================================================================== >RCS file: /cvs/cluster/cluster/gfs2/tool/main.c,v >retrieving revision 1.4.2.3 >diff -w -u -p -p -u -r1.4.2.3 main.c >--- tool/main.c 13 Nov 2007 17:06:33 -0000 1.4.2.3 >+++ tool/main.c 14 Nov 2007 17:07:54 -0000 >@@ -45,6 +45,9 @@ static const char *usage[] = { > "Print the counters for a filesystem\n", > " gfs2_tool counters <mountpoint>\n", > "\n", >+ "Do a GFS2 specific \"df\":\n", >+ " gfs2_tool df <mountpoint>\n", >+ "\n", > "Freeze a GFS2 cluster:\n", > " gfs2_tool freeze <mountpoint>\n", > "\n", >@@ -92,9 +95,6 @@ static const char *usage[] = { > " gfs2_tool withdraw <mountpoint>\n", > #if GFS2_TOOL_FEATURE_IMPLEMENTED > "\n", >- "Do a GFS2 specific \"df\"\n", >- " gfs2_tool df <mountpoint>\n", >- "\n", > "Force files from a machine's cache\n", > " gfs2_tool flush <filenames>\n", > "\n", >@@ -233,6 +233,8 @@ main(int argc, char *argv[]) > set_flag(argc, argv); > else if (strcmp(action, "counters") == 0) > print_counters(argc, argv); >+ else if (strcmp(action, "df") == 0) >+ print_df(argc, argv); > else if (strcmp(action, "freeze") == 0) > do_freeze(argc, argv); > else if (strcmp(action, "getargs") == 0) >@@ -266,8 +268,6 @@ main(int argc, char *argv[]) > do_file_flush(argc, argv); > else if (strcmp(action, "getsb") == 0) > print_sb(argc, argv); >- else if (strcmp(action, "df") == 0) >- print_df(argc, argv); > else if (strcmp(action, "jindex") == 0) > print_jindex(argc, argv); > else if (strcmp(action, "layout") == 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 Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 352841
:
257481
| 258441