diff options
author | Steven Whitehouse <swhiteho@redhat.com> | 2008-01-29 08:30:20 -0500 |
---|---|---|
committer | Steven Whitehouse <swhiteho@redhat.com> | 2008-03-31 05:40:21 -0400 |
commit | 110acf38377b5b341b11644bfe98389eccec627d (patch) | |
tree | cafe58b50d12c9102d061d0d9b668e1f78342849 /fs | |
parent | dbac6710a6dfcec7fbe7d9571c183d86a4237623 (diff) |
[GFS2] Add consts to various bits of rgrp.c
There are a couple of routines which scan bitmaps where we can
mark the bitmaps const, plus a couple of call sites that can
be updated too.
Signed-off-by: Steven Whitehouse <swhiteho@redhat.com>
Diffstat (limited to 'fs')
-rw-r--r-- | fs/gfs2/rgrp.c | 44 |
1 files changed, 22 insertions, 22 deletions
diff --git a/fs/gfs2/rgrp.c b/fs/gfs2/rgrp.c index da60ce8c5d7d..5fd87104e595 100644 --- a/fs/gfs2/rgrp.c +++ b/fs/gfs2/rgrp.c | |||
@@ -126,23 +126,24 @@ static unsigned char gfs2_testbit(struct gfs2_rgrpd *rgd, unsigned char *buffer, | |||
126 | * Return: the block number (bitmap buffer scope) that was found | 126 | * Return: the block number (bitmap buffer scope) that was found |
127 | */ | 127 | */ |
128 | 128 | ||
129 | static u32 gfs2_bitfit(unsigned char *buffer, unsigned int buflen, u32 goal, | 129 | static u32 gfs2_bitfit(const u8 *buffer, unsigned int buflen, u32 goal, |
130 | unsigned char old_state) | 130 | u8 old_state) |
131 | { | 131 | { |
132 | unsigned char *byte; | 132 | const u8 *byte; |
133 | u32 blk = goal; | 133 | u32 blk = goal; |
134 | unsigned int bit, bitlong; | 134 | unsigned int bit, bitlong; |
135 | unsigned long *plong, plong55; | 135 | const unsigned long *plong; |
136 | #if BITS_PER_LONG == 32 | ||
137 | const unsigned long plong55 = 0x55555555; | ||
138 | #else | ||
139 | const unsigned long plong55 = 0x5555555555555555; | ||
140 | #endif | ||
136 | 141 | ||
137 | byte = buffer + (goal / GFS2_NBBY); | 142 | byte = buffer + (goal / GFS2_NBBY); |
138 | plong = (unsigned long *)(buffer + (goal / GFS2_NBBY)); | 143 | plong = (const unsigned long *)(buffer + (goal / GFS2_NBBY)); |
139 | bit = (goal % GFS2_NBBY) * GFS2_BIT_SIZE; | 144 | bit = (goal % GFS2_NBBY) * GFS2_BIT_SIZE; |
140 | bitlong = bit; | 145 | bitlong = bit; |
141 | #if BITS_PER_LONG == 32 | 146 | |
142 | plong55 = 0x55555555; | ||
143 | #else | ||
144 | plong55 = 0x5555555555555555; | ||
145 | #endif | ||
146 | while (byte < buffer + buflen) { | 147 | while (byte < buffer + buflen) { |
147 | 148 | ||
148 | if (bitlong == 0 && old_state == 0 && *plong == plong55) { | 149 | if (bitlong == 0 && old_state == 0 && *plong == plong55) { |
@@ -179,14 +180,14 @@ static u32 gfs2_bitfit(unsigned char *buffer, unsigned int buflen, u32 goal, | |||
179 | * Returns: The number of bits | 180 | * Returns: The number of bits |
180 | */ | 181 | */ |
181 | 182 | ||
182 | static u32 gfs2_bitcount(struct gfs2_rgrpd *rgd, unsigned char *buffer, | 183 | static u32 gfs2_bitcount(struct gfs2_rgrpd *rgd, const u8 *buffer, |
183 | unsigned int buflen, unsigned char state) | 184 | unsigned int buflen, u8 state) |
184 | { | 185 | { |
185 | unsigned char *byte = buffer; | 186 | const u8 *byte = buffer; |
186 | unsigned char *end = buffer + buflen; | 187 | const u8 *end = buffer + buflen; |
187 | unsigned char state1 = state << 2; | 188 | const u8 state1 = state << 2; |
188 | unsigned char state2 = state << 4; | 189 | const u8 state2 = state << 4; |
189 | unsigned char state3 = state << 6; | 190 | const u8 state3 = state << 6; |
190 | u32 count = 0; | 191 | u32 count = 0; |
191 | 192 | ||
192 | for (; byte < end; byte++) { | 193 | for (; byte < end; byte++) { |
@@ -1327,12 +1328,11 @@ static u32 rgblk_search(struct gfs2_rgrpd *rgd, u32 goal, | |||
1327 | for (x = 0; x <= length; x++) { | 1328 | for (x = 0; x <= length; x++) { |
1328 | /* The GFS2_BLKST_UNLINKED state doesn't apply to the clone | 1329 | /* The GFS2_BLKST_UNLINKED state doesn't apply to the clone |
1329 | bitmaps, so we must search the originals for that. */ | 1330 | bitmaps, so we must search the originals for that. */ |
1331 | const u8 *buffer = bi->bi_bh->b_data + bi->bi_offset; | ||
1330 | if (old_state != GFS2_BLKST_UNLINKED && bi->bi_clone) | 1332 | if (old_state != GFS2_BLKST_UNLINKED && bi->bi_clone) |
1331 | blk = gfs2_bitfit(bi->bi_clone + bi->bi_offset, | 1333 | buffer = bi->bi_clone + bi->bi_offset; |
1332 | bi->bi_len, goal, old_state); | 1334 | |
1333 | else | 1335 | blk = gfs2_bitfit(buffer, bi->bi_len, goal, old_state); |
1334 | blk = gfs2_bitfit(bi->bi_bh->b_data + bi->bi_offset, | ||
1335 | bi->bi_len, goal, old_state); | ||
1336 | if (blk != BFITNOENT) | 1336 | if (blk != BFITNOENT) |
1337 | break; | 1337 | break; |
1338 | 1338 | ||