Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 89503
b: refs/heads/master
c: 110acf3
h: refs/heads/master
i:
  89501: 381235b
  89499: 5dd0b20
  89495: 830f1f2
  89487: b4876e0
  89471: 0c82717
v: v3
  • Loading branch information
Steven Whitehouse committed Mar 31, 2008
1 parent 5005b31 commit 8ce8af7
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 23 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: dbac6710a6dfcec7fbe7d9571c183d86a4237623
refs/heads/master: 110acf38377b5b341b11644bfe98389eccec627d
44 changes: 22 additions & 22 deletions trunk/fs/gfs2/rgrp.c
Original file line number Diff line number Diff line change
Expand Up @@ -126,23 +126,24 @@ static unsigned char gfs2_testbit(struct gfs2_rgrpd *rgd, unsigned char *buffer,
* Return: the block number (bitmap buffer scope) that was found
*/

static u32 gfs2_bitfit(unsigned char *buffer, unsigned int buflen, u32 goal,
unsigned char old_state)
static u32 gfs2_bitfit(const u8 *buffer, unsigned int buflen, u32 goal,
u8 old_state)
{
unsigned char *byte;
const u8 *byte;
u32 blk = goal;
unsigned int bit, bitlong;
unsigned long *plong, plong55;
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 = (unsigned long *)(buffer + (goal / GFS2_NBBY));
plong = (const unsigned long *)(buffer + (goal / GFS2_NBBY));
bit = (goal % GFS2_NBBY) * GFS2_BIT_SIZE;
bitlong = bit;
#if BITS_PER_LONG == 32
plong55 = 0x55555555;
#else
plong55 = 0x5555555555555555;
#endif

while (byte < buffer + buflen) {

if (bitlong == 0 && old_state == 0 && *plong == plong55) {
Expand Down Expand Up @@ -179,14 +180,14 @@ static u32 gfs2_bitfit(unsigned char *buffer, unsigned int buflen, u32 goal,
* Returns: The number of bits
*/

static u32 gfs2_bitcount(struct gfs2_rgrpd *rgd, unsigned char *buffer,
unsigned int buflen, unsigned char state)
static u32 gfs2_bitcount(struct gfs2_rgrpd *rgd, const u8 *buffer,
unsigned int buflen, u8 state)
{
unsigned char *byte = buffer;
unsigned char *end = buffer + buflen;
unsigned char state1 = state << 2;
unsigned char state2 = state << 4;
unsigned char state3 = state << 6;
const u8 *byte = buffer;
const u8 *end = buffer + buflen;
const u8 state1 = state << 2;
const u8 state2 = state << 4;
const u8 state3 = state << 6;
u32 count = 0;

for (; byte < end; byte++) {
Expand Down Expand Up @@ -1327,12 +1328,11 @@ static u32 rgblk_search(struct gfs2_rgrpd *rgd, u32 goal,
for (x = 0; x <= length; x++) {
/* The GFS2_BLKST_UNLINKED state doesn't apply to the clone
bitmaps, so we must search the originals for that. */
const u8 *buffer = bi->bi_bh->b_data + bi->bi_offset;
if (old_state != GFS2_BLKST_UNLINKED && bi->bi_clone)
blk = gfs2_bitfit(bi->bi_clone + bi->bi_offset,
bi->bi_len, goal, old_state);
else
blk = gfs2_bitfit(bi->bi_bh->b_data + bi->bi_offset,
bi->bi_len, goal, old_state);
buffer = bi->bi_clone + bi->bi_offset;

blk = gfs2_bitfit(buffer, bi->bi_len, goal, old_state);
if (blk != BFITNOENT)
break;

Expand Down

0 comments on commit 8ce8af7

Please sign in to comment.