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 282321 Details for
Bug 223220
Optimise bmap for the gfs2 journal
[?]
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]
Bob's proposed patch
gronk (text/plain), 4.70 KB, created by
Robert Peterson
on 2007-12-09 19:47:37 UTC
(
hide
)
Description:
Bob's proposed patch
Filename:
MIME Type:
Creator:
Robert Peterson
Created:
2007-12-09 19:47:37 UTC
Size:
4.70 KB
patch
obsolete
>--- a/incore.h 2007-11-30 17:34:06.000000000 -0600 >+++ b/incore.h 2007-12-06 18:33:27.000000000 -0600 >@@ -372,8 +372,17 @@ struct gfs2_ail { > u64 ai_sync_gen; > }; > >+struct gfs2_journal_extent { >+ struct list_head extent_list; >+ >+ unsigned int lblock; /* First logical block */ >+ u64 dblock; /* First disk block */ >+ u64 blocks; >+}; >+ > struct gfs2_jdesc { > struct list_head jd_list; >+ struct list_head extent_list; > > struct inode *jd_inode; > unsigned int jd_jid; >--- a/log.c 2007-11-30 17:34:06.000000000 -0600 >+++ b/log.c 2007-12-09 13:34:08.000000000 -0600 >@@ -358,8 +358,20 @@ static u64 log_bmap(struct gfs2_sbd *sdp > int error; > struct buffer_head bh_map = { .b_state = 0, .b_blocknr = 0 }; > >+ if (!list_empty(&sdp->sd_jdesc->extent_list)) { /* got an extent map */ >+ struct gfs2_journal_extent *je; >+ >+ list_for_each_entry(je, &sdp->sd_jdesc->extent_list, >+ extent_list) { >+ if (lbn >= je->lblock && >+ lbn < je->lblock + je->blocks) { >+ return je->dblock + lbn; >+ } >+ } >+ } >+ /* No mapping or not found: do it the old fashioned way. */ > bh_map.b_size = 1 << inode->i_blkbits; >- error = gfs2_block_map(inode, lbn, 0, &bh_map); >+ error = gfs2_block_map(inode, lbn, &bh_map, 0); > if (error || !bh_map.b_blocknr) > printk(KERN_INFO "error=%d, dbn=%llu lbn=%u", error, > (unsigned long long)bh_map.b_blocknr, lbn); >--- a/ops_fstype.c 2007-09-25 16:37:23.000000000 -0500 >+++ b/ops_fstype.c 2007-12-06 16:00:19.000000000 -0600 >@@ -21,6 +21,7 @@ > > #include "gfs2.h" > #include "incore.h" >+#include "bmap.h" > #include "daemon.h" > #include "glock.h" > #include "glops.h" >@@ -302,6 +303,64 @@ out: > return error; > } > >+/** >+ * map_journal_extents - create a reusable "extent" mapping from all logical >+ * blocks to all physical blocks for the given journal. This will save >+ * us time when writing journal blocks. Most journals will have only one >+ * extent that maps all their logical blocks. That's because gfs2.mkfs >+ * arranges the journal blocks sequentially to maximize performance. >+ * So the extent would map the first block for the entire file length. >+ * However, gfs2_jadd can happen while file activity is happening, so >+ * those journals may not be sequential. Less likely is the case where >+ * the users created their own journals by mounting the metafs and >+ * laying it out. But it's still possible. These journals might have >+ * several extents. >+ */ >+static int map_journal_extents(struct gfs2_sbd *sdp) >+{ >+ struct gfs2_jdesc *jd = sdp->sd_jdesc; >+ unsigned int lb; >+ u64 db, prev_db; /* logical block, disk block, prev disk block */ >+ struct gfs2_inode *ip = GFS2_I(jd->jd_inode); >+ struct gfs2_journal_extent *jext = NULL; >+ struct buffer_head bh; >+ int rc = 0; >+ >+ INIT_LIST_HEAD(&jd->extent_list); >+ prev_db = 0; >+ >+ for (lb = 0; lb < ip->i_di.di_size / sdp->sd_sb.sb_bsize; lb++) { >+ bh.b_state = 0; >+ bh.b_blocknr = 0; >+ bh.b_size = 1 << ip->i_inode.i_blkbits; >+ rc = gfs2_block_map(jd->jd_inode, lb, &bh, 0); >+ db = bh.b_blocknr; >+ if (rc || !db) { >+ printk(KERN_INFO "GFS2 journal mapping error %d: lb=" >+ "%u db=%llu\n", rc, lb, (unsigned long long)db); >+ break; >+ } >+ if (!prev_db || db != prev_db + 1) { >+ jext = kzalloc(sizeof(struct gfs2_journal_extent), >+ GFP_KERNEL); >+ if (!jext) { >+ printk(KERN_INFO "GFS2 error: out of memory " >+ "mapping journal extents.\n"); >+ rc = -ENOMEM; >+ break; >+ } >+ jext->dblock = db; >+ jext->lblock = lb; >+ jext->blocks = 1; >+ list_add_tail(&jext->extent_list, &jd->extent_list); >+ } else { >+ jext->blocks++; >+ } >+ prev_db = db; >+ } >+ return rc; >+} >+ > static int init_journal(struct gfs2_sbd *sdp, int undo) > { > struct gfs2_holder ji_gh; >@@ -377,6 +436,9 @@ static int init_journal(struct gfs2_sbd > goto fail_jinode_gh; > } > sdp->sd_log_blks_free = sdp->sd_jdesc->jd_blocks; >+ >+ /* Map the extents for this journal's blocks */ >+ map_journal_extents(sdp); > } > > if (sdp->sd_lockstruct.ls_first) { >--- a/super.c 2007-11-30 17:34:06.000000000 -0600 >+++ b/super.c 2007-12-07 09:44:14.000000000 -0600 >@@ -425,8 +425,9 @@ int gfs2_jindex_hold(struct gfs2_sbd *sd > > void gfs2_jindex_free(struct gfs2_sbd *sdp) > { >- struct list_head list; >+ struct list_head list, *head; > struct gfs2_jdesc *jd; >+ struct gfs2_journal_extent *jext; > > spin_lock(&sdp->sd_jindex_spin); > list_add(&list, &sdp->sd_jindex_list); >@@ -436,6 +437,14 @@ void gfs2_jindex_free(struct gfs2_sbd *s > > while (!list_empty(&list)) { > jd = list_entry(list.next, struct gfs2_jdesc, jd_list); >+ head = &jd->extent_list; >+ while (!list_empty(head)) { >+ jext = list_entry(head->next, >+ struct gfs2_journal_extent, >+ extent_list); >+ list_del(&jext->extent_list); >+ kfree(jext); >+ } > list_del(&jd->jd_list); > iput(jd->jd_inode); > kfree(jd);
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 223220
: 282321