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 147620 Details for
Bug 222308
mkfs and journal addition for GFS2 should produce contiguous journals
[?]
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 to fix the problem
222308.patch.try2 (text/plain), 9.51 KB, created by
Robert Peterson
on 2007-02-08 00:50:39 UTC
(
hide
)
Description:
Better patch to fix the problem
Filename:
MIME Type:
Creator:
Robert Peterson
Created:
2007-02-08 00:50:39 UTC
Size:
9.51 KB
patch
obsolete
>Index: libgfs2/fs_ops.c >=================================================================== >RCS file: /cvs/cluster/cluster/gfs2/libgfs2/fs_ops.c,v >retrieving revision 1.4 >diff -w -u -p -r1.4 fs_ops.c >--- libgfs2/fs_ops.c 12 Jun 2006 20:38:27 -0000 1.4 >+++ libgfs2/fs_ops.c 8 Feb 2007 00:48:58 -0000 >@@ -209,7 +209,7 @@ static void unstuff_dinode(struct gfs2_i > ip->i_di.di_height = 1; > } > >-static unsigned int calc_tree_height(struct gfs2_inode *ip, uint64_t size) >+unsigned int calc_tree_height(struct gfs2_inode *ip, uint64_t size) > { > struct gfs2_sbd *sdp = ip->i_sbd; > uint64_t *arr; >@@ -233,7 +233,7 @@ static unsigned int calc_tree_height(str > return height; > } > >-static void build_height(struct gfs2_inode *ip, int height) >+void build_height(struct gfs2_inode *ip, int height) > { > struct gfs2_sbd *sdp = ip->i_sbd; > struct gfs2_buffer_head *bh; >@@ -335,7 +335,7 @@ static void lookup_block(struct gfs2_ino > } > > void block_map(struct gfs2_inode *ip, uint64_t lblock, int *new, >- uint64_t *dblock, uint32_t *extlen) >+ uint64_t *dblock, uint32_t *extlen, int prealloc) > { > struct gfs2_sbd *sdp = ip->i_sbd; > struct gfs2_buffer_head *bh; >@@ -395,6 +395,7 @@ void block_map(struct gfs2_inode *ip, ui > bh = bread(sdp, *dblock); > } > >+ if (!prealloc) > lookup_block(ip, bh, end_of_metadata, mp, create, new, dblock); > > if (extlen && *dblock) { >@@ -480,7 +481,7 @@ int gfs2_readi(struct gfs2_inode *ip, vo > amount = sdp->bsize - o; > > if (!extlen) >- block_map(ip, lblock, ¬_new, &dblock, &extlen); >+ block_map(ip, lblock, ¬_new, &dblock, &extlen, FALSE); > > if (dblock) { > bh = bread(sdp, dblock); >@@ -552,7 +553,7 @@ int gfs2_writei(struct gfs2_inode *ip, v > > if (!extlen) { > new = TRUE; >- block_map(ip, lblock, &new, &dblock, &extlen); >+ block_map(ip, lblock, &new, &dblock, &extlen, FALSE); > } > > if (new) { >@@ -583,7 +584,8 @@ int gfs2_writei(struct gfs2_inode *ip, v > return copied; > } > >-struct gfs2_buffer_head *get_file_buf(struct gfs2_inode *ip, uint64_t lbn) >+struct gfs2_buffer_head *get_file_buf(struct gfs2_inode *ip, uint64_t lbn, >+ int prealloc) > { > struct gfs2_sbd *sdp = ip->i_sbd; > uint64_t dbn; >@@ -592,11 +594,11 @@ struct gfs2_buffer_head *get_file_buf(st > if (inode_is_stuffed(ip)) > unstuff_dinode(ip); > >- block_map(ip, lbn, &new, &dbn, NULL); >+ block_map(ip, lbn, &new, &dbn, NULL, prealloc); > if (!dbn) > die("get_file_buf\n"); > >- if (new && >+ if (!prealloc && new && > ip->i_di.di_size < (lbn + 1) << sdp->bsize_shift) > ip->i_di.di_size = (lbn + 1) << sdp->bsize_shift; > >Index: libgfs2/libgfs2.h >=================================================================== >RCS file: /cvs/cluster/cluster/gfs2/libgfs2/libgfs2.h,v >retrieving revision 1.9 >diff -w -u -p -r1.9 libgfs2.h >--- libgfs2/libgfs2.h 23 Jan 2007 19:23:06 -0000 1.9 >+++ libgfs2/libgfs2.h 8 Feb 2007 00:48:58 -0000 >@@ -391,7 +391,8 @@ int gfs2_readi(struct gfs2_inode *ip, vo > uint64_t offset, unsigned int size); > int gfs2_writei(struct gfs2_inode *ip, void *buf, > uint64_t offset, unsigned int size); >-struct gfs2_buffer_head *get_file_buf(struct gfs2_inode *ip, uint64_t lbn); >+struct gfs2_buffer_head *get_file_buf(struct gfs2_inode *ip, uint64_t lbn, >+ int prealloc); > struct gfs2_buffer_head *init_dinode(struct gfs2_sbd *sdp, > struct gfs2_inum *inum, > unsigned int mode, uint32_t flags, >@@ -408,7 +409,7 @@ void dir_add(struct gfs2_inode *dip, cha > int gfs2_dirent_del(struct gfs2_inode *dip, struct gfs2_buffer_head *bh, > const char *filename, int filename_len); > void block_map(struct gfs2_inode *ip, uint64_t lblock, int *new, >- uint64_t *dblock, uint32_t *extlen); >+ uint64_t *dblock, uint32_t *extlen, int prealloc); > void gfs2_get_leaf_nr(struct gfs2_inode *dip, uint32_t index, > uint64_t *leaf_out); > int gfs2_freedi(struct gfs2_sbd *sdp, uint64_t block); >@@ -418,6 +419,10 @@ int gfs2_dirent_first(struct gfs2_inode > struct gfs2_dirent **dent); > int gfs2_dirent_next(struct gfs2_inode *dip, struct gfs2_buffer_head *bh, > struct gfs2_dirent **dent); >+void build_height(struct gfs2_inode *ip, int height); >+unsigned int calc_tree_height(struct gfs2_inode *ip, uint64_t size); >+void write_journal(struct gfs2_sbd *sdp, struct gfs2_inode *ip, unsigned int j, >+ unsigned int blocks); > > /** > * device_size - figure out a device's size >Index: libgfs2/structures.c >=================================================================== >RCS file: /cvs/cluster/cluster/gfs2/libgfs2/structures.c,v >retrieving revision 1.6 >diff -w -u -p -r1.6 structures.c >--- libgfs2/structures.c 22 Nov 2006 18:39:38 -0000 1.6 >+++ libgfs2/structures.c 8 Feb 2007 00:48:58 -0000 >@@ -83,20 +83,19 @@ build_sb(struct gfs2_sbd *sdp) > } > } > >-void build_journal(struct gfs2_inode *jindex, unsigned int j) >+void write_journal(struct gfs2_sbd *sdp, struct gfs2_inode *ip, unsigned int j, >+ unsigned int blocks) > { >- struct gfs2_sbd *sdp = jindex->i_sbd; >- char name[256]; >- struct gfs2_inode *ip; > struct gfs2_log_header lh; >- unsigned int blocks = sdp->jsize << 20 >> sdp->bsize_shift; > unsigned int x; > uint64_t seq = RANDOM(blocks); > uint32_t hash; >+ unsigned int height; > >- sprintf(name, "journal%u", j); >- ip = createi(jindex, name, S_IFREG | 0600, >- GFS2_DIF_SYSTEM); >+ /* Build the height up so our journal blocks will be contiguous and */ >+ /* not broken up by indirect block pages. */ >+ height = calc_tree_height(ip, (blocks + 1) * sdp->bsize); >+ build_height(ip, height); > > memset(&lh, 0, sizeof(struct gfs2_log_header)); > lh.lh_header.mh_magic = GFS2_MAGIC; >@@ -105,9 +104,17 @@ void build_journal(struct gfs2_inode *ji > lh.lh_flags = GFS2_LOG_HEAD_UNMOUNT; > > for (x = 0; x < blocks; x++) { >- struct gfs2_buffer_head *bh = get_file_buf(ip, ip->i_di.di_size >> sdp->bsize_shift); >+ struct gfs2_buffer_head *bh = >+ get_file_buf(ip, (ip->i_di.di_size >> sdp->bsize_shift) + x, TRUE); > if (!bh) >- die("build_journals\n"); >+ die("write_journal\n"); >+ brelse(bh, updated); >+ } >+ for (x = 0; x < blocks; x++) { >+ struct gfs2_buffer_head *bh = >+ get_file_buf(ip, (ip->i_di.di_size >> sdp->bsize_shift), FALSE); >+ if (!bh) >+ die("write_journal\n"); > > lh.lh_sequence = seq; > lh.lh_blkno = x; >@@ -125,8 +132,6 @@ void build_journal(struct gfs2_inode *ji > printf("\nJournal %u:\n", j); > gfs2_dinode_print(&ip->i_di); > } >- >- inode_put(ip, updated); > } > > void >@@ -138,8 +143,15 @@ build_jindex(struct gfs2_sbd *sdp) > jindex = createi(sdp->master_dir, "jindex", S_IFDIR | 0700, > GFS2_DIF_SYSTEM); > >- for (j = 0; j < sdp->md.journals; j++) >- build_journal(jindex, j); >+ for (j = 0; j < sdp->md.journals; j++) { >+ char name[256]; >+ struct gfs2_inode *ip; >+ >+ sprintf(name, "journal%u", j); >+ ip = createi(jindex, name, S_IFREG | 0600, GFS2_DIF_SYSTEM); >+ write_journal(sdp, ip, j, sdp->jsize << 20 >> sdp->bsize_shift); >+ inode_put(ip, updated); >+ } > > if (sdp->debug) { > printf("\nJindex:\n"); >@@ -209,7 +221,7 @@ build_quota_change(struct gfs2_inode *pe > GFS2_DIF_SYSTEM); > > for (x = 0; x < blocks; x++) { >- struct gfs2_buffer_head *bh = get_file_buf(ip, ip->i_di.di_size >> sdp->bsize_shift); >+ struct gfs2_buffer_head *bh = get_file_buf(ip, ip->i_di.di_size >> sdp->bsize_shift, FALSE); > if (!bh) > die("build_quota_change\n"); > >Index: fsck/fs_recovery.c >=================================================================== >RCS file: /cvs/cluster/cluster/gfs2/fsck/fs_recovery.c,v >retrieving revision 1.4 >diff -w -u -p -r1.4 fs_recovery.c >--- fsck/fs_recovery.c 15 Jun 2006 18:48:45 -0000 1.4 >+++ fsck/fs_recovery.c 8 Feb 2007 00:48:58 -0000 >@@ -25,65 +25,6 @@ > #define RANDOM(values) ((values) * (random() / (RAND_MAX + 1.0))) > > /* >- * reconstruct_single_journal - write a fresh journal >- * @sdp: superblock >- * @jnum: journal number >- * >- * This function will write a fresh journal over the top of >- * the previous journal. All journal information is lost. This >- * process is basically stolen from write_journals() in the mkfs code. >- * >- * Returns: -1 on error, 0 otherwise >- */ >-static int reconstruct_single_journal(struct gfs2_sbd *sdp, int jnum){ >- struct gfs2_log_header lh; >- unsigned int blocks; >- struct gfs2_inode *ip = sdp->md.journal[jnum]; >- uint64_t seq; >- uint64_t dblock; >- uint32_t hash, extlen; >- unsigned int x; >- int new = 0; >- >- blocks = ip->i_di.di_blocks; >- srandom(time(NULL)); >- seq = RANDOM(blocks); >- >- log_info("Clearing journal %d\n", jnum); >- >- memset(&lh, 0, sizeof(struct gfs2_log_header)); >- lh.lh_header.mh_magic = GFS2_MAGIC; >- lh.lh_header.mh_type = GFS2_METATYPE_LH; >- lh.lh_header.mh_format = GFS2_FORMAT_LH; >- lh.lh_flags = GFS2_LOG_HEAD_UNMOUNT; >- >- for (x = 0; x < blocks; x++) { >- struct gfs2_buffer_head *bh; >- >- block_map(ip, x, &new, &dblock, &extlen); >- bh = bread(sdp, dblock); >- if (!bh) { >- log_err("Unable to read journal block at %" PRIu64 >- " (0x%" PRIx64")\n", dblock, dblock); >- return -1; >- } >- >- lh.lh_sequence = seq; >- lh.lh_blkno = x; >- gfs2_log_header_out(&lh, bh->b_data); >- hash = gfs2_disk_hash(bh->b_data, sizeof(struct gfs2_log_header)); >- ((struct gfs2_log_header *)bh->b_data)->lh_hash = cpu_to_be32(hash); >- brelse(bh, updated); >- >- if (++seq == blocks) >- seq = 0; >- } >- >- return 0; >-} >- >- >-/* > * reconstruct_journals - write fresh journals > * sdp: the super block > * >@@ -103,8 +44,8 @@ int reconstruct_journals(struct gfs2_sbd > * the gfs2_fsck */ > if((i % 2) == 0) > log_at_notice("."); >- if(reconstruct_single_journal(sdp, i)) >- return -1; >+ write_journal(sdp, sdp->md.journal[i], i, >+ sdp->md.journal[i]->i_di.di_blocks); > } > log_notice("\nJournals cleared.\n"); > 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 Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 222308
:
147527
|
147620
|
147922