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 297459 Details for
Bug 435456
GFS2: Optimise loop in gfs2_bitfit
[?]
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]
Second attempt at a patch
435456.upstream2.patch (text/plain), 2.92 KB, created by
Robert Peterson
on 2008-03-10 16:44:51 UTC
(
hide
)
Description:
Second attempt at a patch
Filename:
MIME Type:
Creator:
Robert Peterson
Created:
2008-03-10 16:44:51 UTC
Size:
2.92 KB
patch
obsolete
> fs/gfs2/rgrp.c | 81 +++++++++++++++++++++++++++++++++++-------------------- > 1 files changed, 51 insertions(+), 30 deletions(-) > >diff --git a/fs/gfs2/rgrp.c b/fs/gfs2/rgrp.c >index 4291375..31adb13 100644 >--- a/fs/gfs2/rgrp.c >+++ b/fs/gfs2/rgrp.c >@@ -33,6 +33,16 @@ > #define BFITNOENT ((u32)~0) > #define NO_BLOCK ((u64)~0) > >+#if BITS_PER_LONG == 32 >+#define LBITMASK (0x55555555UL) >+#define LBITSKIP55 (0x55555555UL) >+#define LBITSKIP00 (0x00000000UL) >+#else >+#define LBITMASK (0x5555555555555555UL) >+#define LBITSKIP55 (0x5555555555555555UL) >+#define LBITSKIP00 (0x0000000000000000UL) >+#endif >+ > /* > * These routines are used by the resource group routines (rgrp.c) > * to keep track of block allocation. Each block is represented by two >@@ -138,43 +148,54 @@ static inline unsigned char gfs2_testbit(struct gfs2_rgrpd *rgd, > static u32 gfs2_bitfit(const u8 *buffer, unsigned int buflen, u32 goal, > u8 old_state) > { >- const u8 *byte; >- u32 blk = goal; >- unsigned int bit, bitlong; >- const unsigned long *plong; >-#if BITS_PER_LONG == 32 >- const unsigned long plong55 = 0x55555555; >-#else >- const unsigned long plong55 = 0x5555555555555555; >-#endif >- >- byte = buffer + (goal / GFS2_NBBY); >- plong = (const unsigned long *)(buffer + (goal / GFS2_NBBY)); >- bit = (goal % GFS2_NBBY) * GFS2_BIT_SIZE; >- bitlong = bit; >- >- while (byte < buffer + buflen) { >- >- if (bitlong == 0 && old_state == 0 && *plong == plong55) { >- plong++; >- byte += sizeof(unsigned long); >- blk += sizeof(unsigned long) * GFS2_NBBY; >- continue; >+ const u8 *byte, *start, *end; >+ int bit, startbit; >+ u32 g1, g2, misaligned; >+ unsigned long *plong; >+ unsigned long lskipval; >+ >+ lskipval = (old_state & GFS2_BLKST_USED) ? LBITSKIP00 : LBITSKIP55; >+ g1 = (goal / GFS2_NBBY); >+ start = buffer + g1; >+ byte = start; >+ end = buffer + buflen; >+ g2 = ALIGN(g1, sizeof(unsigned long)); >+ plong = (unsigned long *)(buffer + g2); >+ startbit = bit = (goal % GFS2_NBBY) * GFS2_BIT_SIZE; >+ misaligned = g2 - g1; >+ if (!misaligned) >+ goto ulong_aligned; >+/* parse the bitmap a byte at a time */ >+misaligned: >+ while (byte < end) { >+ if (((*byte >> bit) & GFS2_BIT_MASK) == old_state) { >+ return goal + >+ (((byte - start) * GFS2_NBBY) + >+ ((bit - startbit) >> 1)); > } >- if (((*byte >> bit) & GFS2_BIT_MASK) == old_state) >- return blk; > bit += GFS2_BIT_SIZE; >- if (bit >= 8) { >+ if (bit >= GFS2_NBBY * GFS2_BIT_SIZE) { > bit = 0; > byte++; >+ misaligned--; >+ if (!misaligned) { >+ plong = (unsigned long *)byte; >+ goto ulong_aligned; >+ } > } >- bitlong += GFS2_BIT_SIZE; >- if (bitlong >= sizeof(unsigned long) * 8) { >- bitlong = 0; >+ } >+ return BFITNOENT; >+ >+/* parse the bitmap a unsigned long at a time */ >+ulong_aligned: >+ while ((unsigned char *)plong < end) { >+ if (((*plong) & LBITMASK) == lskipval) > plong++; >+ else { >+ byte = (const u8 *)plong; >+ misaligned += sizeof(unsigned long) - 1; >+ goto misaligned; > } >- >- blk++; > } > > return BFITNOENT;
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 435456
:
297261
|
297459
|
297460
|
297533
|
297654
|
297802