diff options
Diffstat (limited to 'fs/gfs2/rgrp.c')
-rw-r--r-- | fs/gfs2/rgrp.c | 102 |
1 files changed, 50 insertions, 52 deletions
diff --git a/fs/gfs2/rgrp.c b/fs/gfs2/rgrp.c index 3df65c9ab73b..f74fb9bd1973 100644 --- a/fs/gfs2/rgrp.c +++ b/fs/gfs2/rgrp.c | |||
@@ -70,15 +70,15 @@ static u32 rgblk_search(struct gfs2_rgrpd *rgd, u32 goal, | |||
70 | 70 | ||
71 | /** | 71 | /** |
72 | * gfs2_setbit - Set a bit in the bitmaps | 72 | * gfs2_setbit - Set a bit in the bitmaps |
73 | * @buffer: the buffer that holds the bitmaps | 73 | * @rgd: the resource group descriptor |
74 | * @buflen: the length (in bytes) of the buffer | 74 | * @buf2: the clone buffer that holds the bitmaps |
75 | * @bi: the bitmap structure | ||
75 | * @block: the block to set | 76 | * @block: the block to set |
76 | * @new_state: the new state of the block | 77 | * @new_state: the new state of the block |
77 | * | 78 | * |
78 | */ | 79 | */ |
79 | 80 | ||
80 | static inline void gfs2_setbit(struct gfs2_rgrpd *rgd, unsigned char *buf1, | 81 | static inline void gfs2_setbit(struct gfs2_rgrpd *rgd, unsigned char *buf2, |
81 | unsigned char *buf2, unsigned int offset, | ||
82 | struct gfs2_bitmap *bi, u32 block, | 82 | struct gfs2_bitmap *bi, u32 block, |
83 | unsigned char new_state) | 83 | unsigned char new_state) |
84 | { | 84 | { |
@@ -86,8 +86,8 @@ static inline void gfs2_setbit(struct gfs2_rgrpd *rgd, unsigned char *buf1, | |||
86 | unsigned int buflen = bi->bi_len; | 86 | unsigned int buflen = bi->bi_len; |
87 | const unsigned int bit = (block % GFS2_NBBY) * GFS2_BIT_SIZE; | 87 | const unsigned int bit = (block % GFS2_NBBY) * GFS2_BIT_SIZE; |
88 | 88 | ||
89 | byte1 = buf1 + offset + (block / GFS2_NBBY); | 89 | byte1 = bi->bi_bh->b_data + bi->bi_offset + (block / GFS2_NBBY); |
90 | end = buf1 + offset + buflen; | 90 | end = bi->bi_bh->b_data + bi->bi_offset + buflen; |
91 | 91 | ||
92 | BUG_ON(byte1 >= end); | 92 | BUG_ON(byte1 >= end); |
93 | 93 | ||
@@ -110,7 +110,7 @@ static inline void gfs2_setbit(struct gfs2_rgrpd *rgd, unsigned char *buf1, | |||
110 | *byte1 ^= (cur_state ^ new_state) << bit; | 110 | *byte1 ^= (cur_state ^ new_state) << bit; |
111 | 111 | ||
112 | if (buf2) { | 112 | if (buf2) { |
113 | byte2 = buf2 + offset + (block / GFS2_NBBY); | 113 | byte2 = buf2 + bi->bi_offset + (block / GFS2_NBBY); |
114 | cur_state = (*byte2 >> bit) & GFS2_BIT_MASK; | 114 | cur_state = (*byte2 >> bit) & GFS2_BIT_MASK; |
115 | *byte2 ^= (cur_state ^ new_state) << bit; | 115 | *byte2 ^= (cur_state ^ new_state) << bit; |
116 | } | 116 | } |
@@ -118,6 +118,7 @@ static inline void gfs2_setbit(struct gfs2_rgrpd *rgd, unsigned char *buf1, | |||
118 | 118 | ||
119 | /** | 119 | /** |
120 | * gfs2_testbit - test a bit in the bitmaps | 120 | * gfs2_testbit - test a bit in the bitmaps |
121 | * @rgd: the resource group descriptor | ||
121 | * @buffer: the buffer that holds the bitmaps | 122 | * @buffer: the buffer that holds the bitmaps |
122 | * @buflen: the length (in bytes) of the buffer | 123 | * @buflen: the length (in bytes) of the buffer |
123 | * @block: the block to read | 124 | * @block: the block to read |
@@ -179,7 +180,7 @@ static inline u64 gfs2_bit_search(const __le64 *ptr, u64 mask, u8 state) | |||
179 | /** | 180 | /** |
180 | * gfs2_bitfit - Search an rgrp's bitmap buffer to find a bit-pair representing | 181 | * gfs2_bitfit - Search an rgrp's bitmap buffer to find a bit-pair representing |
181 | * a block in a given allocation state. | 182 | * a block in a given allocation state. |
182 | * @buffer: the buffer that holds the bitmaps | 183 | * @buf: the buffer that holds the bitmaps |
183 | * @len: the length (in bytes) of the buffer | 184 | * @len: the length (in bytes) of the buffer |
184 | * @goal: start search at this block's bit-pair (within @buffer) | 185 | * @goal: start search at this block's bit-pair (within @buffer) |
185 | * @state: GFS2_BLKST_XXX the state of the block we're looking for. | 186 | * @state: GFS2_BLKST_XXX the state of the block we're looking for. |
@@ -231,6 +232,7 @@ static u32 gfs2_bitfit(const u8 *buf, const unsigned int len, | |||
231 | 232 | ||
232 | /** | 233 | /** |
233 | * gfs2_bitcount - count the number of bits in a certain state | 234 | * gfs2_bitcount - count the number of bits in a certain state |
235 | * @rgd: the resource group descriptor | ||
234 | * @buffer: the buffer that holds the bitmaps | 236 | * @buffer: the buffer that holds the bitmaps |
235 | * @buflen: the length (in bytes) of the buffer | 237 | * @buflen: the length (in bytes) of the buffer |
236 | * @state: the state of the block we're looking for | 238 | * @state: the state of the block we're looking for |
@@ -264,7 +266,6 @@ static u32 gfs2_bitcount(struct gfs2_rgrpd *rgd, const u8 *buffer, | |||
264 | 266 | ||
265 | /** | 267 | /** |
266 | * gfs2_rgrp_verify - Verify that a resource group is consistent | 268 | * gfs2_rgrp_verify - Verify that a resource group is consistent |
267 | * @sdp: the filesystem | ||
268 | * @rgd: the rgrp | 269 | * @rgd: the rgrp |
269 | * | 270 | * |
270 | */ | 271 | */ |
@@ -322,7 +323,8 @@ static inline int rgrp_contains_block(struct gfs2_rgrpd *rgd, u64 block) | |||
322 | /** | 323 | /** |
323 | * gfs2_blk2rgrpd - Find resource group for a given data/meta block number | 324 | * gfs2_blk2rgrpd - Find resource group for a given data/meta block number |
324 | * @sdp: The GFS2 superblock | 325 | * @sdp: The GFS2 superblock |
325 | * @n: The data block number | 326 | * @blk: The data block number |
327 | * @exact: True if this needs to be an exact match | ||
326 | * | 328 | * |
327 | * Returns: The resource group, or NULL if not found | 329 | * Returns: The resource group, or NULL if not found |
328 | */ | 330 | */ |
@@ -380,7 +382,7 @@ struct gfs2_rgrpd *gfs2_rgrpd_get_first(struct gfs2_sbd *sdp) | |||
380 | 382 | ||
381 | /** | 383 | /** |
382 | * gfs2_rgrpd_get_next - get the next RG | 384 | * gfs2_rgrpd_get_next - get the next RG |
383 | * @rgd: A RG | 385 | * @rgd: the resource group descriptor |
384 | * | 386 | * |
385 | * Returns: The next rgrp | 387 | * Returns: The next rgrp |
386 | */ | 388 | */ |
@@ -529,6 +531,7 @@ static int compute_bitstructs(struct gfs2_rgrpd *rgd) | |||
529 | 531 | ||
530 | /** | 532 | /** |
531 | * gfs2_ri_total - Total up the file system space, according to the rindex. | 533 | * gfs2_ri_total - Total up the file system space, according to the rindex. |
534 | * @sdp: the filesystem | ||
532 | * | 535 | * |
533 | */ | 536 | */ |
534 | u64 gfs2_ri_total(struct gfs2_sbd *sdp) | 537 | u64 gfs2_ri_total(struct gfs2_sbd *sdp) |
@@ -537,16 +540,14 @@ u64 gfs2_ri_total(struct gfs2_sbd *sdp) | |||
537 | struct inode *inode = sdp->sd_rindex; | 540 | struct inode *inode = sdp->sd_rindex; |
538 | struct gfs2_inode *ip = GFS2_I(inode); | 541 | struct gfs2_inode *ip = GFS2_I(inode); |
539 | char buf[sizeof(struct gfs2_rindex)]; | 542 | char buf[sizeof(struct gfs2_rindex)]; |
540 | struct file_ra_state ra_state; | ||
541 | int error, rgrps; | 543 | int error, rgrps; |
542 | 544 | ||
543 | file_ra_state_init(&ra_state, inode->i_mapping); | ||
544 | for (rgrps = 0;; rgrps++) { | 545 | for (rgrps = 0;; rgrps++) { |
545 | loff_t pos = rgrps * sizeof(struct gfs2_rindex); | 546 | loff_t pos = rgrps * sizeof(struct gfs2_rindex); |
546 | 547 | ||
547 | if (pos + sizeof(struct gfs2_rindex) > i_size_read(inode)) | 548 | if (pos + sizeof(struct gfs2_rindex) > i_size_read(inode)) |
548 | break; | 549 | break; |
549 | error = gfs2_internal_read(ip, &ra_state, buf, &pos, | 550 | error = gfs2_internal_read(ip, buf, &pos, |
550 | sizeof(struct gfs2_rindex)); | 551 | sizeof(struct gfs2_rindex)); |
551 | if (error != sizeof(struct gfs2_rindex)) | 552 | if (error != sizeof(struct gfs2_rindex)) |
552 | break; | 553 | break; |
@@ -582,13 +583,12 @@ static int rgd_insert(struct gfs2_rgrpd *rgd) | |||
582 | 583 | ||
583 | /** | 584 | /** |
584 | * read_rindex_entry - Pull in a new resource index entry from the disk | 585 | * read_rindex_entry - Pull in a new resource index entry from the disk |
585 | * @gl: The glock covering the rindex inode | 586 | * @ip: Pointer to the rindex inode |
586 | * | 587 | * |
587 | * Returns: 0 on success, > 0 on EOF, error code otherwise | 588 | * Returns: 0 on success, > 0 on EOF, error code otherwise |
588 | */ | 589 | */ |
589 | 590 | ||
590 | static int read_rindex_entry(struct gfs2_inode *ip, | 591 | static int read_rindex_entry(struct gfs2_inode *ip) |
591 | struct file_ra_state *ra_state) | ||
592 | { | 592 | { |
593 | struct gfs2_sbd *sdp = GFS2_SB(&ip->i_inode); | 593 | struct gfs2_sbd *sdp = GFS2_SB(&ip->i_inode); |
594 | loff_t pos = sdp->sd_rgrps * sizeof(struct gfs2_rindex); | 594 | loff_t pos = sdp->sd_rgrps * sizeof(struct gfs2_rindex); |
@@ -599,7 +599,7 @@ static int read_rindex_entry(struct gfs2_inode *ip, | |||
599 | if (pos >= i_size_read(&ip->i_inode)) | 599 | if (pos >= i_size_read(&ip->i_inode)) |
600 | return 1; | 600 | return 1; |
601 | 601 | ||
602 | error = gfs2_internal_read(ip, ra_state, (char *)&buf, &pos, | 602 | error = gfs2_internal_read(ip, (char *)&buf, &pos, |
603 | sizeof(struct gfs2_rindex)); | 603 | sizeof(struct gfs2_rindex)); |
604 | 604 | ||
605 | if (error != sizeof(struct gfs2_rindex)) | 605 | if (error != sizeof(struct gfs2_rindex)) |
@@ -655,13 +655,10 @@ fail: | |||
655 | static int gfs2_ri_update(struct gfs2_inode *ip) | 655 | static int gfs2_ri_update(struct gfs2_inode *ip) |
656 | { | 656 | { |
657 | struct gfs2_sbd *sdp = GFS2_SB(&ip->i_inode); | 657 | struct gfs2_sbd *sdp = GFS2_SB(&ip->i_inode); |
658 | struct inode *inode = &ip->i_inode; | ||
659 | struct file_ra_state ra_state; | ||
660 | int error; | 658 | int error; |
661 | 659 | ||
662 | file_ra_state_init(&ra_state, inode->i_mapping); | ||
663 | do { | 660 | do { |
664 | error = read_rindex_entry(ip, &ra_state); | 661 | error = read_rindex_entry(ip); |
665 | } while (error == 0); | 662 | } while (error == 0); |
666 | 663 | ||
667 | if (error < 0) | 664 | if (error < 0) |
@@ -741,7 +738,7 @@ static void gfs2_rgrp_out(struct gfs2_rgrpd *rgd, void *buf) | |||
741 | 738 | ||
742 | /** | 739 | /** |
743 | * gfs2_rgrp_go_lock - Read in a RG's header and bitmaps | 740 | * gfs2_rgrp_go_lock - Read in a RG's header and bitmaps |
744 | * @rgd: the struct gfs2_rgrpd describing the RG to read in | 741 | * @gh: The glock holder for the resource group |
745 | * | 742 | * |
746 | * Read in all of a Resource Group's header and bitmap blocks. | 743 | * Read in all of a Resource Group's header and bitmap blocks. |
747 | * Caller must eventually call gfs2_rgrp_relse() to free the bitmaps. | 744 | * Caller must eventually call gfs2_rgrp_relse() to free the bitmaps. |
@@ -801,7 +798,7 @@ fail: | |||
801 | 798 | ||
802 | /** | 799 | /** |
803 | * gfs2_rgrp_go_unlock - Release RG bitmaps read in with gfs2_rgrp_bh_get() | 800 | * gfs2_rgrp_go_unlock - Release RG bitmaps read in with gfs2_rgrp_bh_get() |
804 | * @rgd: the struct gfs2_rgrpd describing the RG to read in | 801 | * @gh: The glock holder for the resource group |
805 | * | 802 | * |
806 | */ | 803 | */ |
807 | 804 | ||
@@ -1002,11 +999,13 @@ struct gfs2_qadata *gfs2_qadata_get(struct gfs2_inode *ip) | |||
1002 | * Returns: the struct gfs2_qadata | 999 | * Returns: the struct gfs2_qadata |
1003 | */ | 1000 | */ |
1004 | 1001 | ||
1005 | static struct gfs2_blkreserv *gfs2_blkrsv_get(struct gfs2_inode *ip) | 1002 | static int gfs2_blkrsv_get(struct gfs2_inode *ip) |
1006 | { | 1003 | { |
1007 | BUG_ON(ip->i_res != NULL); | 1004 | BUG_ON(ip->i_res != NULL); |
1008 | ip->i_res = kzalloc(sizeof(struct gfs2_blkreserv), GFP_NOFS); | 1005 | ip->i_res = kmem_cache_zalloc(gfs2_rsrv_cachep, GFP_NOFS); |
1009 | return ip->i_res; | 1006 | if (!ip->i_res) |
1007 | return -ENOMEM; | ||
1008 | return 0; | ||
1010 | } | 1009 | } |
1011 | 1010 | ||
1012 | /** | 1011 | /** |
@@ -1038,6 +1037,8 @@ static inline u32 gfs2_bi2rgd_blk(struct gfs2_bitmap *bi, u32 blk) | |||
1038 | /** | 1037 | /** |
1039 | * try_rgrp_unlink - Look for any unlinked, allocated, but unused inodes | 1038 | * try_rgrp_unlink - Look for any unlinked, allocated, but unused inodes |
1040 | * @rgd: The rgrp | 1039 | * @rgd: The rgrp |
1040 | * @last_unlinked: block address of the last dinode we unlinked | ||
1041 | * @skip: block address we should explicitly not unlink | ||
1041 | * | 1042 | * |
1042 | * Returns: 0 if no error | 1043 | * Returns: 0 if no error |
1043 | * The inode, if one has been found, in inode. | 1044 | * The inode, if one has been found, in inode. |
@@ -1102,7 +1103,7 @@ static void try_rgrp_unlink(struct gfs2_rgrpd *rgd, u64 *last_unlinked, u64 skip | |||
1102 | /** | 1103 | /** |
1103 | * get_local_rgrp - Choose and lock a rgrp for allocation | 1104 | * get_local_rgrp - Choose and lock a rgrp for allocation |
1104 | * @ip: the inode to reserve space for | 1105 | * @ip: the inode to reserve space for |
1105 | * @rgp: the chosen and locked rgrp | 1106 | * @last_unlinked: the last unlinked block |
1106 | * | 1107 | * |
1107 | * Try to acquire rgrp in way which avoids contending with others. | 1108 | * Try to acquire rgrp in way which avoids contending with others. |
1108 | * | 1109 | * |
@@ -1164,13 +1165,14 @@ static int get_local_rgrp(struct gfs2_inode *ip, u64 *last_unlinked) | |||
1164 | static void gfs2_blkrsv_put(struct gfs2_inode *ip) | 1165 | static void gfs2_blkrsv_put(struct gfs2_inode *ip) |
1165 | { | 1166 | { |
1166 | BUG_ON(ip->i_res == NULL); | 1167 | BUG_ON(ip->i_res == NULL); |
1167 | kfree(ip->i_res); | 1168 | kmem_cache_free(gfs2_rsrv_cachep, ip->i_res); |
1168 | ip->i_res = NULL; | 1169 | ip->i_res = NULL; |
1169 | } | 1170 | } |
1170 | 1171 | ||
1171 | /** | 1172 | /** |
1172 | * gfs2_inplace_reserve - Reserve space in the filesystem | 1173 | * gfs2_inplace_reserve - Reserve space in the filesystem |
1173 | * @ip: the inode to reserve space for | 1174 | * @ip: the inode to reserve space for |
1175 | * @requested: the number of blocks to be reserved | ||
1174 | * | 1176 | * |
1175 | * Returns: errno | 1177 | * Returns: errno |
1176 | */ | 1178 | */ |
@@ -1179,14 +1181,15 @@ int gfs2_inplace_reserve(struct gfs2_inode *ip, u32 requested) | |||
1179 | { | 1181 | { |
1180 | struct gfs2_sbd *sdp = GFS2_SB(&ip->i_inode); | 1182 | struct gfs2_sbd *sdp = GFS2_SB(&ip->i_inode); |
1181 | struct gfs2_blkreserv *rs; | 1183 | struct gfs2_blkreserv *rs; |
1182 | int error = 0; | 1184 | int error; |
1183 | u64 last_unlinked = NO_BLOCK; | 1185 | u64 last_unlinked = NO_BLOCK; |
1184 | int tries = 0; | 1186 | int tries = 0; |
1185 | 1187 | ||
1186 | rs = gfs2_blkrsv_get(ip); | 1188 | error = gfs2_blkrsv_get(ip); |
1187 | if (!rs) | 1189 | if (error) |
1188 | return -ENOMEM; | 1190 | return error; |
1189 | 1191 | ||
1192 | rs = ip->i_res; | ||
1190 | rs->rs_requested = requested; | 1193 | rs->rs_requested = requested; |
1191 | if (gfs2_assert_warn(sdp, requested)) { | 1194 | if (gfs2_assert_warn(sdp, requested)) { |
1192 | error = -EINVAL; | 1195 | error = -EINVAL; |
@@ -1268,7 +1271,6 @@ static unsigned char gfs2_get_block_type(struct gfs2_rgrpd *rgd, u64 block) | |||
1268 | * @rgd: the resource group descriptor | 1271 | * @rgd: the resource group descriptor |
1269 | * @goal: the goal block within the RG (start here to search for avail block) | 1272 | * @goal: the goal block within the RG (start here to search for avail block) |
1270 | * @state: GFS2_BLKST_XXX the before-allocation state to find | 1273 | * @state: GFS2_BLKST_XXX the before-allocation state to find |
1271 | * @dinode: TRUE if the first block we allocate is for a dinode | ||
1272 | * @rbi: address of the pointer to the bitmap containing the block found | 1274 | * @rbi: address of the pointer to the bitmap containing the block found |
1273 | * | 1275 | * |
1274 | * Walk rgrp's bitmap to find bits that represent a block in @state. | 1276 | * Walk rgrp's bitmap to find bits that represent a block in @state. |
@@ -1282,13 +1284,12 @@ static unsigned char gfs2_get_block_type(struct gfs2_rgrpd *rgd, u64 block) | |||
1282 | * Returns: the block number found relative to the bitmap rbi | 1284 | * Returns: the block number found relative to the bitmap rbi |
1283 | */ | 1285 | */ |
1284 | 1286 | ||
1285 | static u32 rgblk_search(struct gfs2_rgrpd *rgd, u32 goal, | 1287 | static u32 rgblk_search(struct gfs2_rgrpd *rgd, u32 goal, unsigned char state, |
1286 | unsigned char state, | ||
1287 | struct gfs2_bitmap **rbi) | 1288 | struct gfs2_bitmap **rbi) |
1288 | { | 1289 | { |
1289 | struct gfs2_bitmap *bi = NULL; | 1290 | struct gfs2_bitmap *bi = NULL; |
1290 | const u32 length = rgd->rd_length; | 1291 | const u32 length = rgd->rd_length; |
1291 | u32 blk = BFITNOENT; | 1292 | u32 biblk = BFITNOENT; |
1292 | unsigned int buf, x; | 1293 | unsigned int buf, x; |
1293 | const u8 *buffer = NULL; | 1294 | const u8 *buffer = NULL; |
1294 | 1295 | ||
@@ -1325,8 +1326,8 @@ do_search: | |||
1325 | if (state != GFS2_BLKST_UNLINKED && bi->bi_clone) | 1326 | if (state != GFS2_BLKST_UNLINKED && bi->bi_clone) |
1326 | buffer = bi->bi_clone + bi->bi_offset; | 1327 | buffer = bi->bi_clone + bi->bi_offset; |
1327 | 1328 | ||
1328 | blk = gfs2_bitfit(buffer, bi->bi_len, goal, state); | 1329 | biblk = gfs2_bitfit(buffer, bi->bi_len, goal, state); |
1329 | if (blk != BFITNOENT) | 1330 | if (biblk != BFITNOENT) |
1330 | break; | 1331 | break; |
1331 | 1332 | ||
1332 | if ((goal == 0) && (state == GFS2_BLKST_FREE)) | 1333 | if ((goal == 0) && (state == GFS2_BLKST_FREE)) |
@@ -1339,10 +1340,10 @@ skip: | |||
1339 | goal = 0; | 1340 | goal = 0; |
1340 | } | 1341 | } |
1341 | 1342 | ||
1342 | if (blk != BFITNOENT) | 1343 | if (biblk != BFITNOENT) |
1343 | *rbi = bi; | 1344 | *rbi = bi; |
1344 | 1345 | ||
1345 | return blk; | 1346 | return biblk; |
1346 | } | 1347 | } |
1347 | 1348 | ||
1348 | /** | 1349 | /** |
@@ -1367,8 +1368,8 @@ static u64 gfs2_alloc_extent(struct gfs2_rgrpd *rgd, struct gfs2_bitmap *bi, | |||
1367 | *n = 0; | 1368 | *n = 0; |
1368 | buffer = bi->bi_bh->b_data + bi->bi_offset; | 1369 | buffer = bi->bi_bh->b_data + bi->bi_offset; |
1369 | gfs2_trans_add_bh(rgd->rd_gl, bi->bi_bh, 1); | 1370 | gfs2_trans_add_bh(rgd->rd_gl, bi->bi_bh, 1); |
1370 | gfs2_setbit(rgd, bi->bi_bh->b_data, bi->bi_clone, bi->bi_offset, | 1371 | gfs2_setbit(rgd, bi->bi_clone, bi, blk, |
1371 | bi, blk, dinode ? GFS2_BLKST_DINODE : GFS2_BLKST_USED); | 1372 | dinode ? GFS2_BLKST_DINODE : GFS2_BLKST_USED); |
1372 | (*n)++; | 1373 | (*n)++; |
1373 | goal = blk; | 1374 | goal = blk; |
1374 | while (*n < elen) { | 1375 | while (*n < elen) { |
@@ -1378,8 +1379,7 @@ static u64 gfs2_alloc_extent(struct gfs2_rgrpd *rgd, struct gfs2_bitmap *bi, | |||
1378 | if (gfs2_testbit(rgd, buffer, bi->bi_len, goal) != | 1379 | if (gfs2_testbit(rgd, buffer, bi->bi_len, goal) != |
1379 | GFS2_BLKST_FREE) | 1380 | GFS2_BLKST_FREE) |
1380 | break; | 1381 | break; |
1381 | gfs2_setbit(rgd, bi->bi_bh->b_data, bi->bi_clone, bi->bi_offset, | 1382 | gfs2_setbit(rgd, bi->bi_clone, bi, goal, GFS2_BLKST_USED); |
1382 | bi, goal, GFS2_BLKST_USED); | ||
1383 | (*n)++; | 1383 | (*n)++; |
1384 | } | 1384 | } |
1385 | blk = gfs2_bi2rgd_blk(bi, blk); | 1385 | blk = gfs2_bi2rgd_blk(bi, blk); |
@@ -1436,8 +1436,7 @@ static struct gfs2_rgrpd *rgblk_free(struct gfs2_sbd *sdp, u64 bstart, | |||
1436 | bi->bi_len); | 1436 | bi->bi_len); |
1437 | } | 1437 | } |
1438 | gfs2_trans_add_bh(rgd->rd_gl, bi->bi_bh, 1); | 1438 | gfs2_trans_add_bh(rgd->rd_gl, bi->bi_bh, 1); |
1439 | gfs2_setbit(rgd, bi->bi_bh->b_data, NULL, bi->bi_offset, | 1439 | gfs2_setbit(rgd, NULL, bi, buf_blk, new_state); |
1440 | bi, buf_blk, new_state); | ||
1441 | } | 1440 | } |
1442 | 1441 | ||
1443 | return rgd; | 1442 | return rgd; |
@@ -1557,7 +1556,7 @@ int gfs2_alloc_blocks(struct gfs2_inode *ip, u64 *bn, unsigned int *nblocks, | |||
1557 | ip->i_inode.i_gid); | 1556 | ip->i_inode.i_gid); |
1558 | 1557 | ||
1559 | rgd->rd_free_clone -= *nblocks; | 1558 | rgd->rd_free_clone -= *nblocks; |
1560 | trace_gfs2_block_alloc(ip, block, *nblocks, | 1559 | trace_gfs2_block_alloc(ip, rgd, block, *nblocks, |
1561 | dinode ? GFS2_BLKST_DINODE : GFS2_BLKST_USED); | 1560 | dinode ? GFS2_BLKST_DINODE : GFS2_BLKST_USED); |
1562 | *bn = block; | 1561 | *bn = block; |
1563 | return 0; | 1562 | return 0; |
@@ -1584,7 +1583,7 @@ void __gfs2_free_blocks(struct gfs2_inode *ip, u64 bstart, u32 blen, int meta) | |||
1584 | rgd = rgblk_free(sdp, bstart, blen, GFS2_BLKST_FREE); | 1583 | rgd = rgblk_free(sdp, bstart, blen, GFS2_BLKST_FREE); |
1585 | if (!rgd) | 1584 | if (!rgd) |
1586 | return; | 1585 | return; |
1587 | trace_gfs2_block_alloc(ip, bstart, blen, GFS2_BLKST_FREE); | 1586 | trace_gfs2_block_alloc(ip, rgd, bstart, blen, GFS2_BLKST_FREE); |
1588 | rgd->rd_free += blen; | 1587 | rgd->rd_free += blen; |
1589 | rgd->rd_flags &= ~GFS2_RGF_TRIMMED; | 1588 | rgd->rd_flags &= ~GFS2_RGF_TRIMMED; |
1590 | gfs2_trans_add_bh(rgd->rd_gl, rgd->rd_bits[0].bi_bh, 1); | 1589 | gfs2_trans_add_bh(rgd->rd_gl, rgd->rd_bits[0].bi_bh, 1); |
@@ -1622,7 +1621,7 @@ void gfs2_unlink_di(struct inode *inode) | |||
1622 | rgd = rgblk_free(sdp, blkno, 1, GFS2_BLKST_UNLINKED); | 1621 | rgd = rgblk_free(sdp, blkno, 1, GFS2_BLKST_UNLINKED); |
1623 | if (!rgd) | 1622 | if (!rgd) |
1624 | return; | 1623 | return; |
1625 | trace_gfs2_block_alloc(ip, blkno, 1, GFS2_BLKST_UNLINKED); | 1624 | trace_gfs2_block_alloc(ip, rgd, blkno, 1, GFS2_BLKST_UNLINKED); |
1626 | gfs2_trans_add_bh(rgd->rd_gl, rgd->rd_bits[0].bi_bh, 1); | 1625 | gfs2_trans_add_bh(rgd->rd_gl, rgd->rd_bits[0].bi_bh, 1); |
1627 | gfs2_rgrp_out(rgd, rgd->rd_bits[0].bi_bh->b_data); | 1626 | gfs2_rgrp_out(rgd, rgd->rd_bits[0].bi_bh->b_data); |
1628 | } | 1627 | } |
@@ -1652,7 +1651,7 @@ static void gfs2_free_uninit_di(struct gfs2_rgrpd *rgd, u64 blkno) | |||
1652 | void gfs2_free_di(struct gfs2_rgrpd *rgd, struct gfs2_inode *ip) | 1651 | void gfs2_free_di(struct gfs2_rgrpd *rgd, struct gfs2_inode *ip) |
1653 | { | 1652 | { |
1654 | gfs2_free_uninit_di(rgd, ip->i_no_addr); | 1653 | gfs2_free_uninit_di(rgd, ip->i_no_addr); |
1655 | trace_gfs2_block_alloc(ip, ip->i_no_addr, 1, GFS2_BLKST_FREE); | 1654 | trace_gfs2_block_alloc(ip, rgd, ip->i_no_addr, 1, GFS2_BLKST_FREE); |
1656 | gfs2_quota_change(ip, -1, ip->i_inode.i_uid, ip->i_inode.i_gid); | 1655 | gfs2_quota_change(ip, -1, ip->i_inode.i_uid, ip->i_inode.i_gid); |
1657 | gfs2_meta_wipe(ip, ip->i_no_addr, 1); | 1656 | gfs2_meta_wipe(ip, ip->i_no_addr, 1); |
1658 | } | 1657 | } |
@@ -1752,7 +1751,6 @@ void gfs2_rlist_add(struct gfs2_inode *ip, struct gfs2_rgrp_list *rlist, | |||
1752 | * and initialize an array of glock holders for them | 1751 | * and initialize an array of glock holders for them |
1753 | * @rlist: the list of resource groups | 1752 | * @rlist: the list of resource groups |
1754 | * @state: the lock state to acquire the RG lock in | 1753 | * @state: the lock state to acquire the RG lock in |
1755 | * @flags: the modifier flags for the holder structures | ||
1756 | * | 1754 | * |
1757 | * FIXME: Don't use NOFAIL | 1755 | * FIXME: Don't use NOFAIL |
1758 | * | 1756 | * |