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 226091 Details for
Bug 235931
gfs2_edit command to set NOALLOC flag
[?]
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]
Patch to add this function
235931.rgflags.patch (text/plain), 10.17 KB, created by
Robert Peterson
on 2007-10-12 21:03:11 UTC
(
hide
)
Description:
Patch to add this function
Filename:
MIME Type:
Creator:
Robert Peterson
Created:
2007-10-12 21:03:11 UTC
Size:
10.17 KB
patch
obsolete
>Index: edit/hexedit.c >=================================================================== >RCS file: /cvs/cluster/cluster/gfs2/edit/hexedit.c,v >retrieving revision 1.20 >diff -w -u -p -p -u -r1.20 hexedit.c >--- edit/hexedit.c 12 Oct 2007 15:37:19 -0000 1.20 >+++ edit/hexedit.c 12 Oct 2007 20:53:43 -0000 >@@ -602,6 +602,98 @@ uint64_t masterblock(const char *fn) > } > > /* ------------------------------------------------------------------------ */ >+/* rgcount - return how many rgrps there are. */ >+/* ------------------------------------------------------------------------ */ >+void rgcount(void) >+{ >+ uint64_t block; >+ struct gfs2_buffer_head *ribh; >+ struct gfs2_inode *riinode; >+ >+ if (gfs1) >+ block = sbd1->sb_rindex_di.no_addr; >+ else >+ block = masterblock("rindex"); >+ ribh = bread(&sbd, block); >+ riinode = inode_get(&sbd, ribh); >+ printf("%d RGs in this file system.\n", >+ riinode->i_di.di_size / sizeof(struct gfs2_rindex)); >+ inode_put(riinode, not_updated); >+ exit(EXIT_SUCCESS); >+} >+ >+/* ------------------------------------------------------------------------ */ >+/* find_rgrp_block - locate the block for a given rgrp number */ >+/* ------------------------------------------------------------------------ */ >+uint64_t find_rgrp_block(struct gfs2_inode *di, int rg) >+{ >+ char buf[sizeof(struct gfs2_rindex)]; >+ int amt; >+ struct gfs2_rindex ri; >+ >+ amt = gfs2_readi(di, (void *)&buf, >+ rg * sizeof(struct gfs2_rindex), >+ sizeof(struct gfs2_rindex)); >+ if (!amt) /* end of file */ >+ return 0; >+ gfs2_rindex_in(&ri, buf); >+ return ri.ri_addr; >+} >+ >+/* ------------------------------------------------------------------------ */ >+/* set_rgrp_flags - Set an rgrp's flags to a given value */ >+/* rgnum: which rg to print or modify flags for (0 - X) */ >+/* new_flags: value to set new rg_flags to (if modify == TRUE) */ >+/* modify: TRUE if the value is to be modified, FALSE if it's to be printed */ >+/* full: TRUE if the full RG should be printed. */ >+/* ------------------------------------------------------------------------ */ >+void set_rgrp_flags(int rgnum, uint32_t new_flags, int modify, int full) >+{ >+ struct gfs2_rgrp rg; >+ struct gfs2_buffer_head *bh, *ribh; >+ uint64_t rgblk, block; >+ struct gfs2_inode *riinode; >+ >+ if (gfs1) >+ block = sbd1->sb_rindex_di.no_addr; >+ else >+ block = masterblock("rindex"); >+ ribh = bread(&sbd, block); >+ riinode = inode_get(&sbd, ribh); >+ if (rgnum >= riinode->i_di.di_size / sizeof(struct gfs2_rindex)) { >+ fprintf(stderr, "Error: File system only has %d RGs.\n", >+ riinode->i_di.di_size / sizeof(struct gfs2_rindex)); >+ inode_put(riinode, not_updated); >+ brelse(ribh, not_updated); >+ return; >+ } >+ rgblk = find_rgrp_block(riinode, rgnum); >+ bh = bread(&sbd, rgblk); >+ gfs2_rgrp_in(&rg, bh->b_data); >+ if (modify) { >+ printf("RG #%d (block %lld / 0x%llx) rg_flags changed from 0x%08x to 0x%08x\n", >+ rgnum, rgblk, rgblk, rg.rg_flags, new_flags); >+ rg.rg_flags = new_flags; >+ gfs2_rgrp_out(&rg, bh->b_data); >+ brelse(bh, updated); >+ } else { >+ if (full) { >+ print_gfs2("RG #%d", rgnum); >+ print_gfs2(" located at: %llu (0x%llx)", rgblk, rgblk); >+ eol(0); >+ gfs2_rgrp_print(&rg); >+ } >+ else >+ printf("RG #%d (block %lld / 0x%llx) rg_flags = 0x%08x\n", >+ rgnum, rgblk, rgblk, rg.rg_flags); >+ brelse(bh, not_updated); >+ } >+ inode_put(riinode, not_updated); >+ if (modify) >+ bsync(&sbd); >+} >+ >+/* ------------------------------------------------------------------------ */ > /* parse_rindex - print the rgindex file. */ > /* ------------------------------------------------------------------------ */ > int parse_rindex(struct gfs2_inode *di, int print_rindex) >@@ -622,9 +714,9 @@ int parse_rindex(struct gfs2_inode *di, > error = gfs2_readi(di, (void *)&buf, > print_entry_ndx * sizeof(struct gfs2_rindex), > sizeof(struct gfs2_rindex)); >- gfs2_rindex_in(&ri, buf); > if (!error) /* end of file */ > break; >+ gfs2_rindex_in(&ri, buf); > if (!termlines || > (print_entry_ndx >= start_row[dmode] && > ((print_entry_ndx - start_row[dmode])+1) * lines_per_row[dmode] <= >@@ -1994,6 +2086,8 @@ void usage(void) > fprintf(stderr,"savemeta - save off your metadata for analysis and debugging. The intelligent way (assume bitmap is correct).\n"); > fprintf(stderr,"savemetaslow - save off your metadata for analysis and debugging. The SLOW way (block by block).\n"); > fprintf(stderr,"restoremeta - restore metadata for debugging (DANGEROUS).\n"); >+ fprintf(stderr,"rgcount - print how many RGs in the file system.\n"); >+ fprintf(stderr,"rgflags rgnum [new flags] - print or modify flags for rg #rgnum (0 - X)\n"); > fprintf(stderr,"-V prints version number.\n"); > fprintf(stderr,"-c 1 selects alternate color scheme 1\n"); > fprintf(stderr,"-p prints GFS2 structures or blocks to stdout.\n"); >@@ -2006,6 +2100,7 @@ void usage(void) > fprintf(stderr," inum - prints the inum file.\n"); > fprintf(stderr," statfs - prints the statfs file.\n"); > fprintf(stderr," rindex - prints the rindex file.\n"); >+ fprintf(stderr," rg X - print resource group X.\n"); > fprintf(stderr," rgs - prints all the resource groups (rgs).\n"); > fprintf(stderr," quota - prints the quota file.\n"); > fprintf(stderr,"-x print in hexmode.\n"); >@@ -2019,6 +2114,10 @@ void usage(void) > fprintf(stderr," gfs2_edit -x -p master /dev/bobs_vg/lvol0\n"); > fprintf(stderr," To print out the block-type for block 0x27381:\n"); > fprintf(stderr," gfs2_edit identify -p 0x27381 /dev/bobs_vg/lvol0\n"); >+ fprintf(stderr," To print out the fourth Resource Group. (the first R is #0)\n"); >+ fprintf(stderr," gfs2_edit -p rg 3 /dev/sdb1\n"); >+ fprintf(stderr," To set the Resource Group flags for rg #7 to 3.\n"); >+ fprintf(stderr," gfs2_edit rgflags 7 3 /dev/sdc2\n"); > }/* usage */ > > /* ------------------------------------------------------------------------ */ >@@ -2064,6 +2163,12 @@ void process_parameters(int argc, char * > savemeta(argv[i+1], argv[i+2], TRUE); > else if (!strcasecmp(argv[i], "restoremeta")) > restoremeta(argv[i+1], argv[i+2]); >+ else if (!strcmp(argv[i], "rgcount")) >+ termlines = 0; >+ else if (!strcmp(argv[i], "rgflags")) >+ termlines = 0; >+ else if (!strcmp(argv[i], "rg")) >+ termlines = 0; > else if (strchr(argv[i],'/')) > strcpy(device, argv[i]); > } >@@ -2119,6 +2224,58 @@ void process_parameters(int argc, char * > else > push_block(masterblock("quota")); > } >+ else if (!strcmp(argv[i], "rgcount")) >+ rgcount(); >+ else if (!strcmp(argv[i], "rgflags")) { >+ int rg, set = FALSE; >+ uint32_t new_flags = 0; >+ >+ i++; >+ if (i >= argc - 1) { >+ printf("Error: rg # not specified.\n"); >+ printf("Format is: %s rgflags rgnum" >+ "[newvalue]\n", >+ argv[0]); >+ exit(EXIT_FAILURE); >+ } >+ if (argv[i][0]=='0' && argv[i][1]=='x') >+ sscanf(argv[i], "%"SCNx32, >+ &rg); >+ else >+ rg = atoi(argv[i]); >+ i++; >+ if (i < argc - 1 && >+ isdigit(argv[i][0])) { >+ set = TRUE; >+ if (argv[i][0]=='0' && >+ argv[i][1]=='x') >+ sscanf(argv[i], >+ "%"SCNx32, >+ &new_flags); >+ else >+ new_flags = >+ atoi(argv[i]); >+ } >+ set_rgrp_flags(rg, new_flags, set, >+ FALSE); >+ exit(EXIT_SUCCESS); >+ } >+ else if (!strcmp(argv[i], "rg")) { >+ int rg; >+ uint32_t new_flags = 0; >+ >+ i++; >+ if (i >= argc - 1) { >+ printf("Error: rg # not specified.\n"); >+ printf("Format is: %s rg rgnum" >+ "\n", argv[0]); >+ exit(EXIT_FAILURE); >+ } >+ rg = atoi(argv[i]); >+ i++; >+ set_rgrp_flags(rg, 0, FALSE, TRUE); >+ exit(EXIT_SUCCESS); >+ } > else if (argv[i][0]=='0' && argv[i][1]=='x') { /* hex addr */ > sscanf(argv[i], "%"SCNx64, &temp_blk);/* retrieve in hex */ > push_block(temp_blk); >Index: man/gfs2_edit.8 >=================================================================== >RCS file: /cvs/cluster/cluster/gfs2/man/gfs2_edit.8,v >retrieving revision 1.2 >diff -w -u -p -p -u -r1.2 gfs2_edit.8 >--- man/gfs2_edit.8 8 Oct 2007 21:40:32 -0000 1.2 >+++ man/gfs2_edit.8 12 Oct 2007 20:53:43 -0000 >@@ -44,6 +44,8 @@ You can specify the following data struc > > \fIrindex\fR, \fIrgindex\fR - Print the resource group index system file. > >+\fIrg X\fR - Print the resource group information for RG X. >+ > \fIrgs\fR - Print the resource group information. > > \fIquota\fR - Print the contents of the system quota file. >@@ -85,6 +87,23 @@ Print program version information only. > Print in hex mode. > > .TP >+\fBrg\fP \fI<rg>\fR \fI<device>\fR >+Print the contents of Resource Group \fI<rg>\fR on \fI<device>\fR. >+ >+\fI<rg>\fR is a number from 0 to X - 1, where X is the number of RGs. >+.TP >+\fBrgcount\fP \fI<device>\fR >+Print the number of Resource Groups in the file system on \fI<device>\fR. >+.TP >+\fBrgflags\fP \fI<rg>\fR [\fInew_value\fR] \fI<device>\fR >+Print and/or modify the rg_flags value of Resource Group \fI<rg>\fR on >+\fI<device>\fR. >+ >+\fI<rg>\fR is a number from 0 to X - 1, where X is the number of RGs. >+If \fInew_value\fR is not specified, the current rg_flags value will be >+printed but not modified. If \fInew_value\fR is specified, the rg_flags >+field will be overwritten with the new value. >+.TP > \fBsavemeta\fP \fI<device>\fR \fI<filename>\fR > Save off the GFS2 metadata (not user data) for the file system on the > specified device to a file given by <filename>. You can use this option >@@ -267,8 +286,23 @@ Print the contents of block 16250 of /de > gfs2_edit -p 12345 /dev/sdc2 > Print the gfs2 data structure at block 12345. > >+.TP >+gfs2_edit rgcount /dev/sdb1 >+Print how many Resource Groups exist for /dev/sdb1. >+ >+.TP >+gfs2_edit -p rg 17 /dev/sdb1 >+Print the contents of the eighteenth Resource Group on /dev/sdb1. >+ >+.TP >+gfs2_edit rgflags 3 /dev/sdb1 >+Print the rg_flags value for the fourth Resource Group on /dev/sdb1. >+ >+.TP >+gfs2_edit rgflags 3 8 /dev/sdb1 >+Set the GFS2_RGF_NOALLOC flag on for the fourth Resource Group on /dev/sdb1. >+ > .SH KNOWN BUGS > .TP > The directory code does not work well. It might be confused > by directory "sentinel" entries. >-
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 235931
: 226091