diff options
Diffstat (limited to 'fs/gfs2/rgrp.c')
-rw-r--r-- | fs/gfs2/rgrp.c | 72 |
1 files changed, 36 insertions, 36 deletions
diff --git a/fs/gfs2/rgrp.c b/fs/gfs2/rgrp.c index 62d0a84df982..af49c8b82ffb 100644 --- a/fs/gfs2/rgrp.c +++ b/fs/gfs2/rgrp.c | |||
@@ -60,7 +60,7 @@ static const char valid_change[16] = { | |||
60 | */ | 60 | */ |
61 | 61 | ||
62 | static void gfs2_setbit(struct gfs2_rgrpd *rgd, unsigned char *buffer, | 62 | static void gfs2_setbit(struct gfs2_rgrpd *rgd, unsigned char *buffer, |
63 | unsigned int buflen, uint32_t block, | 63 | unsigned int buflen, u32 block, |
64 | unsigned char new_state) | 64 | unsigned char new_state) |
65 | { | 65 | { |
66 | unsigned char *byte, *end, cur_state; | 66 | unsigned char *byte, *end, cur_state; |
@@ -90,7 +90,7 @@ static void gfs2_setbit(struct gfs2_rgrpd *rgd, unsigned char *buffer, | |||
90 | */ | 90 | */ |
91 | 91 | ||
92 | static unsigned char gfs2_testbit(struct gfs2_rgrpd *rgd, unsigned char *buffer, | 92 | static unsigned char gfs2_testbit(struct gfs2_rgrpd *rgd, unsigned char *buffer, |
93 | unsigned int buflen, uint32_t block) | 93 | unsigned int buflen, u32 block) |
94 | { | 94 | { |
95 | unsigned char *byte, *end, cur_state; | 95 | unsigned char *byte, *end, cur_state; |
96 | unsigned int bit; | 96 | unsigned int bit; |
@@ -122,12 +122,12 @@ static unsigned char gfs2_testbit(struct gfs2_rgrpd *rgd, unsigned char *buffer, | |||
122 | * Return: the block number (bitmap buffer scope) that was found | 122 | * Return: the block number (bitmap buffer scope) that was found |
123 | */ | 123 | */ |
124 | 124 | ||
125 | static uint32_t gfs2_bitfit(struct gfs2_rgrpd *rgd, unsigned char *buffer, | 125 | static u32 gfs2_bitfit(struct gfs2_rgrpd *rgd, unsigned char *buffer, |
126 | unsigned int buflen, uint32_t goal, | 126 | unsigned int buflen, u32 goal, |
127 | unsigned char old_state) | 127 | unsigned char old_state) |
128 | { | 128 | { |
129 | unsigned char *byte, *end, alloc; | 129 | unsigned char *byte, *end, alloc; |
130 | uint32_t blk = goal; | 130 | u32 blk = goal; |
131 | unsigned int bit; | 131 | unsigned int bit; |
132 | 132 | ||
133 | byte = buffer + (goal / GFS2_NBBY); | 133 | byte = buffer + (goal / GFS2_NBBY); |
@@ -169,7 +169,7 @@ static uint32_t gfs2_bitfit(struct gfs2_rgrpd *rgd, unsigned char *buffer, | |||
169 | * Returns: The number of bits | 169 | * Returns: The number of bits |
170 | */ | 170 | */ |
171 | 171 | ||
172 | static uint32_t gfs2_bitcount(struct gfs2_rgrpd *rgd, unsigned char *buffer, | 172 | static u32 gfs2_bitcount(struct gfs2_rgrpd *rgd, unsigned char *buffer, |
173 | unsigned int buflen, unsigned char state) | 173 | unsigned int buflen, unsigned char state) |
174 | { | 174 | { |
175 | unsigned char *byte = buffer; | 175 | unsigned char *byte = buffer; |
@@ -177,7 +177,7 @@ static uint32_t gfs2_bitcount(struct gfs2_rgrpd *rgd, unsigned char *buffer, | |||
177 | unsigned char state1 = state << 2; | 177 | unsigned char state1 = state << 2; |
178 | unsigned char state2 = state << 4; | 178 | unsigned char state2 = state << 4; |
179 | unsigned char state3 = state << 6; | 179 | unsigned char state3 = state << 6; |
180 | uint32_t count = 0; | 180 | u32 count = 0; |
181 | 181 | ||
182 | for (; byte < end; byte++) { | 182 | for (; byte < end; byte++) { |
183 | if (((*byte) & 0x03) == state) | 183 | if (((*byte) & 0x03) == state) |
@@ -204,11 +204,11 @@ void gfs2_rgrp_verify(struct gfs2_rgrpd *rgd) | |||
204 | { | 204 | { |
205 | struct gfs2_sbd *sdp = rgd->rd_sbd; | 205 | struct gfs2_sbd *sdp = rgd->rd_sbd; |
206 | struct gfs2_bitmap *bi = NULL; | 206 | struct gfs2_bitmap *bi = NULL; |
207 | uint32_t length = rgd->rd_ri.ri_length; | 207 | u32 length = rgd->rd_ri.ri_length; |
208 | uint32_t count[4], tmp; | 208 | u32 count[4], tmp; |
209 | int buf, x; | 209 | int buf, x; |
210 | 210 | ||
211 | memset(count, 0, 4 * sizeof(uint32_t)); | 211 | memset(count, 0, 4 * sizeof(u32)); |
212 | 212 | ||
213 | /* Count # blocks in each of 4 possible allocation states */ | 213 | /* Count # blocks in each of 4 possible allocation states */ |
214 | for (buf = 0; buf < length; buf++) { | 214 | for (buf = 0; buf < length; buf++) { |
@@ -253,10 +253,10 @@ void gfs2_rgrp_verify(struct gfs2_rgrpd *rgd) | |||
253 | 253 | ||
254 | } | 254 | } |
255 | 255 | ||
256 | static inline int rgrp_contains_block(struct gfs2_rindex *ri, uint64_t block) | 256 | static inline int rgrp_contains_block(struct gfs2_rindex *ri, u64 block) |
257 | { | 257 | { |
258 | uint64_t first = ri->ri_data0; | 258 | u64 first = ri->ri_data0; |
259 | uint64_t last = first + ri->ri_data; | 259 | u64 last = first + ri->ri_data; |
260 | return !!(first <= block && block < last); | 260 | return !!(first <= block && block < last); |
261 | } | 261 | } |
262 | 262 | ||
@@ -268,7 +268,7 @@ static inline int rgrp_contains_block(struct gfs2_rindex *ri, uint64_t block) | |||
268 | * Returns: The resource group, or NULL if not found | 268 | * Returns: The resource group, or NULL if not found |
269 | */ | 269 | */ |
270 | 270 | ||
271 | struct gfs2_rgrpd *gfs2_blk2rgrpd(struct gfs2_sbd *sdp, uint64_t blk) | 271 | struct gfs2_rgrpd *gfs2_blk2rgrpd(struct gfs2_sbd *sdp, u64 blk) |
272 | { | 272 | { |
273 | struct gfs2_rgrpd *rgd; | 273 | struct gfs2_rgrpd *rgd; |
274 | 274 | ||
@@ -367,8 +367,8 @@ static int compute_bitstructs(struct gfs2_rgrpd *rgd) | |||
367 | { | 367 | { |
368 | struct gfs2_sbd *sdp = rgd->rd_sbd; | 368 | struct gfs2_sbd *sdp = rgd->rd_sbd; |
369 | struct gfs2_bitmap *bi; | 369 | struct gfs2_bitmap *bi; |
370 | uint32_t length = rgd->rd_ri.ri_length; /* # blocks in hdr & bitmap */ | 370 | u32 length = rgd->rd_ri.ri_length; /* # blocks in hdr & bitmap */ |
371 | uint32_t bytes_left, bytes; | 371 | u32 bytes_left, bytes; |
372 | int x; | 372 | int x; |
373 | 373 | ||
374 | if (!length) | 374 | if (!length) |
@@ -444,7 +444,7 @@ static int gfs2_ri_update(struct gfs2_inode *ip) | |||
444 | struct gfs2_rgrpd *rgd; | 444 | struct gfs2_rgrpd *rgd; |
445 | char buf[sizeof(struct gfs2_rindex)]; | 445 | char buf[sizeof(struct gfs2_rindex)]; |
446 | struct file_ra_state ra_state; | 446 | struct file_ra_state ra_state; |
447 | uint64_t junk = ip->i_di.di_size; | 447 | u64 junk = ip->i_di.di_size; |
448 | int error; | 448 | int error; |
449 | 449 | ||
450 | if (do_div(junk, sizeof(struct gfs2_rindex))) { | 450 | if (do_div(junk, sizeof(struct gfs2_rindex))) { |
@@ -741,7 +741,7 @@ static int try_rgrp_fit(struct gfs2_rgrpd *rgd, struct gfs2_alloc *al) | |||
741 | */ | 741 | */ |
742 | 742 | ||
743 | static struct gfs2_rgrpd *recent_rgrp_first(struct gfs2_sbd *sdp, | 743 | static struct gfs2_rgrpd *recent_rgrp_first(struct gfs2_sbd *sdp, |
744 | uint64_t rglast) | 744 | u64 rglast) |
745 | { | 745 | { |
746 | struct gfs2_rgrpd *rgd = NULL; | 746 | struct gfs2_rgrpd *rgd = NULL; |
747 | 747 | ||
@@ -1037,10 +1037,10 @@ void gfs2_inplace_release(struct gfs2_inode *ip) | |||
1037 | * Returns: The block type (GFS2_BLKST_*) | 1037 | * Returns: The block type (GFS2_BLKST_*) |
1038 | */ | 1038 | */ |
1039 | 1039 | ||
1040 | unsigned char gfs2_get_block_type(struct gfs2_rgrpd *rgd, uint64_t block) | 1040 | unsigned char gfs2_get_block_type(struct gfs2_rgrpd *rgd, u64 block) |
1041 | { | 1041 | { |
1042 | struct gfs2_bitmap *bi = NULL; | 1042 | struct gfs2_bitmap *bi = NULL; |
1043 | uint32_t length, rgrp_block, buf_block; | 1043 | u32 length, rgrp_block, buf_block; |
1044 | unsigned int buf; | 1044 | unsigned int buf; |
1045 | unsigned char type; | 1045 | unsigned char type; |
1046 | 1046 | ||
@@ -1083,12 +1083,12 @@ unsigned char gfs2_get_block_type(struct gfs2_rgrpd *rgd, uint64_t block) | |||
1083 | * Returns: the block number allocated | 1083 | * Returns: the block number allocated |
1084 | */ | 1084 | */ |
1085 | 1085 | ||
1086 | static uint32_t rgblk_search(struct gfs2_rgrpd *rgd, uint32_t goal, | 1086 | static u32 rgblk_search(struct gfs2_rgrpd *rgd, u32 goal, |
1087 | unsigned char old_state, unsigned char new_state) | 1087 | unsigned char old_state, unsigned char new_state) |
1088 | { | 1088 | { |
1089 | struct gfs2_bitmap *bi = NULL; | 1089 | struct gfs2_bitmap *bi = NULL; |
1090 | uint32_t length = rgd->rd_ri.ri_length; | 1090 | u32 length = rgd->rd_ri.ri_length; |
1091 | uint32_t blk = 0; | 1091 | u32 blk = 0; |
1092 | unsigned int buf, x; | 1092 | unsigned int buf, x; |
1093 | 1093 | ||
1094 | /* Find bitmap block that contains bits for goal block */ | 1094 | /* Find bitmap block that contains bits for goal block */ |
@@ -1148,12 +1148,12 @@ static uint32_t rgblk_search(struct gfs2_rgrpd *rgd, uint32_t goal, | |||
1148 | * Returns: Resource group containing the block(s) | 1148 | * Returns: Resource group containing the block(s) |
1149 | */ | 1149 | */ |
1150 | 1150 | ||
1151 | static struct gfs2_rgrpd *rgblk_free(struct gfs2_sbd *sdp, uint64_t bstart, | 1151 | static struct gfs2_rgrpd *rgblk_free(struct gfs2_sbd *sdp, u64 bstart, |
1152 | uint32_t blen, unsigned char new_state) | 1152 | u32 blen, unsigned char new_state) |
1153 | { | 1153 | { |
1154 | struct gfs2_rgrpd *rgd; | 1154 | struct gfs2_rgrpd *rgd; |
1155 | struct gfs2_bitmap *bi = NULL; | 1155 | struct gfs2_bitmap *bi = NULL; |
1156 | uint32_t length, rgrp_blk, buf_blk; | 1156 | u32 length, rgrp_blk, buf_blk; |
1157 | unsigned int buf; | 1157 | unsigned int buf; |
1158 | 1158 | ||
1159 | rgd = gfs2_blk2rgrpd(sdp, bstart); | 1159 | rgd = gfs2_blk2rgrpd(sdp, bstart); |
@@ -1206,8 +1206,8 @@ u64 gfs2_alloc_data(struct gfs2_inode *ip) | |||
1206 | struct gfs2_sbd *sdp = GFS2_SB(&ip->i_inode); | 1206 | struct gfs2_sbd *sdp = GFS2_SB(&ip->i_inode); |
1207 | struct gfs2_alloc *al = &ip->i_alloc; | 1207 | struct gfs2_alloc *al = &ip->i_alloc; |
1208 | struct gfs2_rgrpd *rgd = al->al_rgd; | 1208 | struct gfs2_rgrpd *rgd = al->al_rgd; |
1209 | uint32_t goal, blk; | 1209 | u32 goal, blk; |
1210 | uint64_t block; | 1210 | u64 block; |
1211 | 1211 | ||
1212 | if (rgrp_contains_block(&rgd->rd_ri, ip->i_di.di_goal_data)) | 1212 | if (rgrp_contains_block(&rgd->rd_ri, ip->i_di.di_goal_data)) |
1213 | goal = ip->i_di.di_goal_data - rgd->rd_ri.ri_data0; | 1213 | goal = ip->i_di.di_goal_data - rgd->rd_ri.ri_data0; |
@@ -1250,8 +1250,8 @@ u64 gfs2_alloc_meta(struct gfs2_inode *ip) | |||
1250 | struct gfs2_sbd *sdp = GFS2_SB(&ip->i_inode); | 1250 | struct gfs2_sbd *sdp = GFS2_SB(&ip->i_inode); |
1251 | struct gfs2_alloc *al = &ip->i_alloc; | 1251 | struct gfs2_alloc *al = &ip->i_alloc; |
1252 | struct gfs2_rgrpd *rgd = al->al_rgd; | 1252 | struct gfs2_rgrpd *rgd = al->al_rgd; |
1253 | uint32_t goal, blk; | 1253 | u32 goal, blk; |
1254 | uint64_t block; | 1254 | u64 block; |
1255 | 1255 | ||
1256 | if (rgrp_contains_block(&rgd->rd_ri, ip->i_di.di_goal_meta)) | 1256 | if (rgrp_contains_block(&rgd->rd_ri, ip->i_di.di_goal_meta)) |
1257 | goal = ip->i_di.di_goal_meta - rgd->rd_ri.ri_data0; | 1257 | goal = ip->i_di.di_goal_meta - rgd->rd_ri.ri_data0; |
@@ -1332,7 +1332,7 @@ u64 gfs2_alloc_di(struct gfs2_inode *dip, u64 *generation) | |||
1332 | * | 1332 | * |
1333 | */ | 1333 | */ |
1334 | 1334 | ||
1335 | void gfs2_free_data(struct gfs2_inode *ip, uint64_t bstart, uint32_t blen) | 1335 | void gfs2_free_data(struct gfs2_inode *ip, u64 bstart, u32 blen) |
1336 | { | 1336 | { |
1337 | struct gfs2_sbd *sdp = GFS2_SB(&ip->i_inode); | 1337 | struct gfs2_sbd *sdp = GFS2_SB(&ip->i_inode); |
1338 | struct gfs2_rgrpd *rgd; | 1338 | struct gfs2_rgrpd *rgd; |
@@ -1349,7 +1349,7 @@ void gfs2_free_data(struct gfs2_inode *ip, uint64_t bstart, uint32_t blen) | |||
1349 | gfs2_trans_add_rg(rgd); | 1349 | gfs2_trans_add_rg(rgd); |
1350 | 1350 | ||
1351 | gfs2_statfs_change(sdp, 0, +blen, 0); | 1351 | gfs2_statfs_change(sdp, 0, +blen, 0); |
1352 | gfs2_quota_change(ip, -(int64_t)blen, | 1352 | gfs2_quota_change(ip, -(s64)blen, |
1353 | ip->i_di.di_uid, ip->i_di.di_gid); | 1353 | ip->i_di.di_uid, ip->i_di.di_gid); |
1354 | } | 1354 | } |
1355 | 1355 | ||
@@ -1361,7 +1361,7 @@ void gfs2_free_data(struct gfs2_inode *ip, uint64_t bstart, uint32_t blen) | |||
1361 | * | 1361 | * |
1362 | */ | 1362 | */ |
1363 | 1363 | ||
1364 | void gfs2_free_meta(struct gfs2_inode *ip, uint64_t bstart, uint32_t blen) | 1364 | void gfs2_free_meta(struct gfs2_inode *ip, u64 bstart, u32 blen) |
1365 | { | 1365 | { |
1366 | struct gfs2_sbd *sdp = GFS2_SB(&ip->i_inode); | 1366 | struct gfs2_sbd *sdp = GFS2_SB(&ip->i_inode); |
1367 | struct gfs2_rgrpd *rgd; | 1367 | struct gfs2_rgrpd *rgd; |
@@ -1378,7 +1378,7 @@ void gfs2_free_meta(struct gfs2_inode *ip, uint64_t bstart, uint32_t blen) | |||
1378 | gfs2_trans_add_rg(rgd); | 1378 | gfs2_trans_add_rg(rgd); |
1379 | 1379 | ||
1380 | gfs2_statfs_change(sdp, 0, +blen, 0); | 1380 | gfs2_statfs_change(sdp, 0, +blen, 0); |
1381 | gfs2_quota_change(ip, -(int64_t)blen, ip->i_di.di_uid, ip->i_di.di_gid); | 1381 | gfs2_quota_change(ip, -(s64)blen, ip->i_di.di_uid, ip->i_di.di_gid); |
1382 | gfs2_meta_wipe(ip, bstart, blen); | 1382 | gfs2_meta_wipe(ip, bstart, blen); |
1383 | } | 1383 | } |
1384 | 1384 | ||
@@ -1397,7 +1397,7 @@ void gfs2_unlink_di(struct inode *inode) | |||
1397 | gfs2_trans_add_rg(rgd); | 1397 | gfs2_trans_add_rg(rgd); |
1398 | } | 1398 | } |
1399 | 1399 | ||
1400 | static void gfs2_free_uninit_di(struct gfs2_rgrpd *rgd, uint64_t blkno) | 1400 | static void gfs2_free_uninit_di(struct gfs2_rgrpd *rgd, u64 blkno) |
1401 | { | 1401 | { |
1402 | struct gfs2_sbd *sdp = rgd->rd_sbd; | 1402 | struct gfs2_sbd *sdp = rgd->rd_sbd; |
1403 | struct gfs2_rgrpd *tmp_rgd; | 1403 | struct gfs2_rgrpd *tmp_rgd; |
@@ -1440,7 +1440,7 @@ void gfs2_free_di(struct gfs2_rgrpd *rgd, struct gfs2_inode *ip) | |||
1440 | */ | 1440 | */ |
1441 | 1441 | ||
1442 | void gfs2_rlist_add(struct gfs2_sbd *sdp, struct gfs2_rgrp_list *rlist, | 1442 | void gfs2_rlist_add(struct gfs2_sbd *sdp, struct gfs2_rgrp_list *rlist, |
1443 | uint64_t block) | 1443 | u64 block) |
1444 | { | 1444 | { |
1445 | struct gfs2_rgrpd *rgd; | 1445 | struct gfs2_rgrpd *rgd; |
1446 | struct gfs2_rgrpd **tmp; | 1446 | struct gfs2_rgrpd **tmp; |