diff options
Diffstat (limited to 'fs/gfs2/rgrp.c')
-rw-r--r-- | fs/gfs2/rgrp.c | 118 |
1 files changed, 67 insertions, 51 deletions
diff --git a/fs/gfs2/rgrp.c b/fs/gfs2/rgrp.c index 691e6f3ce43b..75df79eb50ba 100644 --- a/fs/gfs2/rgrp.c +++ b/fs/gfs2/rgrp.c | |||
@@ -34,17 +34,19 @@ | |||
34 | /* | 34 | /* |
35 | * These routines are used by the resource group routines (rgrp.c) | 35 | * These routines are used by the resource group routines (rgrp.c) |
36 | * to keep track of block allocation. Each block is represented by two | 36 | * to keep track of block allocation. Each block is represented by two |
37 | * bits. One bit indicates whether or not the block is used. (1=used, | 37 | * bits. So, each byte represents GFS2_NBBY (i.e. 4) blocks. |
38 | * 0=free) The other bit indicates whether or not the block contains a | 38 | * |
39 | * dinode or not. (1=dinode, 0=not-dinode) So, each byte represents | 39 | * 0 = Free |
40 | * GFS2_NBBY (i.e. 4) blocks. | 40 | * 1 = Used (not metadata) |
41 | * 2 = Unlinked (still in use) inode | ||
42 | * 3 = Used (metadata) | ||
41 | */ | 43 | */ |
42 | 44 | ||
43 | static const char valid_change[16] = { | 45 | static const char valid_change[16] = { |
44 | /* current */ | 46 | /* current */ |
45 | /* n */ 0, 1, 0, 1, | 47 | /* n */ 0, 1, 1, 1, |
46 | /* e */ 1, 0, 0, 0, | 48 | /* e */ 1, 0, 0, 0, |
47 | /* w */ 0, 0, 0, 0, | 49 | /* w */ 0, 0, 0, 1, |
48 | 1, 0, 0, 0 | 50 | 1, 0, 0, 0 |
49 | }; | 51 | }; |
50 | 52 | ||
@@ -228,26 +230,27 @@ void gfs2_rgrp_verify(struct gfs2_rgrpd *rgd) | |||
228 | tmp = rgd->rd_ri.ri_data - | 230 | tmp = rgd->rd_ri.ri_data - |
229 | rgd->rd_rg.rg_free - | 231 | rgd->rd_rg.rg_free - |
230 | rgd->rd_rg.rg_dinodes; | 232 | rgd->rd_rg.rg_dinodes; |
231 | if (count[1] != tmp) { | 233 | if (count[1] + count[2] != tmp) { |
232 | if (gfs2_consist_rgrpd(rgd)) | 234 | if (gfs2_consist_rgrpd(rgd)) |
233 | fs_err(sdp, "used data mismatch: %u != %u\n", | 235 | fs_err(sdp, "used data mismatch: %u != %u\n", |
234 | count[1], tmp); | 236 | count[1], tmp); |
235 | return; | 237 | return; |
236 | } | 238 | } |
237 | 239 | ||
238 | if (count[2]) { | 240 | if (count[3] != rgd->rd_rg.rg_dinodes) { |
239 | if (gfs2_consist_rgrpd(rgd)) | 241 | if (gfs2_consist_rgrpd(rgd)) |
240 | fs_err(sdp, "free metadata mismatch: %u != 0\n", | 242 | fs_err(sdp, "used metadata mismatch: %u != %u\n", |
241 | count[2]); | 243 | count[3], rgd->rd_rg.rg_dinodes); |
242 | return; | 244 | return; |
243 | } | 245 | } |
244 | 246 | ||
245 | if (count[3] != rgd->rd_rg.rg_dinodes) { | 247 | if (count[2] > count[3]) { |
246 | if (gfs2_consist_rgrpd(rgd)) | 248 | if (gfs2_consist_rgrpd(rgd)) |
247 | fs_err(sdp, "used metadata mismatch: %u != %u\n", | 249 | fs_err(sdp, "unlinked inodes > inodes: %u\n", |
248 | count[3], rgd->rd_rg.rg_dinodes); | 250 | count[2]); |
249 | return; | 251 | return; |
250 | } | 252 | } |
253 | |||
251 | } | 254 | } |
252 | 255 | ||
253 | static inline int rgrp_contains_block(struct gfs2_rindex *ri, uint64_t block) | 256 | static inline int rgrp_contains_block(struct gfs2_rindex *ri, uint64_t block) |
@@ -368,6 +371,9 @@ static int compute_bitstructs(struct gfs2_rgrpd *rgd) | |||
368 | uint32_t bytes_left, bytes; | 371 | uint32_t bytes_left, bytes; |
369 | int x; | 372 | int x; |
370 | 373 | ||
374 | if (!length) | ||
375 | return -EINVAL; | ||
376 | |||
371 | rgd->rd_bits = kcalloc(length, sizeof(struct gfs2_bitmap), GFP_KERNEL); | 377 | rgd->rd_bits = kcalloc(length, sizeof(struct gfs2_bitmap), GFP_KERNEL); |
372 | if (!rgd->rd_bits) | 378 | if (!rgd->rd_bits) |
373 | return -ENOMEM; | 379 | return -ENOMEM; |
@@ -433,14 +439,16 @@ static int compute_bitstructs(struct gfs2_rgrpd *rgd) | |||
433 | 439 | ||
434 | static int gfs2_ri_update(struct gfs2_inode *ip) | 440 | static int gfs2_ri_update(struct gfs2_inode *ip) |
435 | { | 441 | { |
436 | struct gfs2_sbd *sdp = ip->i_sbd; | 442 | struct gfs2_sbd *sdp = GFS2_SB(&ip->i_inode); |
437 | struct inode *inode = ip->i_vnode; | 443 | struct inode *inode = &ip->i_inode; |
438 | struct gfs2_rgrpd *rgd; | 444 | struct gfs2_rgrpd *rgd; |
439 | char buf[sizeof(struct gfs2_rindex)]; | 445 | char buf[sizeof(struct gfs2_rindex)]; |
440 | struct file_ra_state ra_state; | 446 | struct file_ra_state ra_state; |
441 | uint64_t junk = ip->i_di.di_size; | 447 | uint64_t junk = ip->i_di.di_size; |
442 | int error; | 448 | int error; |
443 | 449 | ||
450 | printk(KERN_INFO "gfs2_ri_update inode=%p\n", inode); | ||
451 | |||
444 | if (do_div(junk, sizeof(struct gfs2_rindex))) { | 452 | if (do_div(junk, sizeof(struct gfs2_rindex))) { |
445 | gfs2_consist_inode(ip); | 453 | gfs2_consist_inode(ip); |
446 | return -EIO; | 454 | return -EIO; |
@@ -448,9 +456,12 @@ static int gfs2_ri_update(struct gfs2_inode *ip) | |||
448 | 456 | ||
449 | clear_rgrpdi(sdp); | 457 | clear_rgrpdi(sdp); |
450 | 458 | ||
459 | printk(KERN_INFO "rgrps cleared\n"); | ||
460 | |||
451 | file_ra_state_init(&ra_state, inode->i_mapping); | 461 | file_ra_state_init(&ra_state, inode->i_mapping); |
452 | for (sdp->sd_rgrps = 0;; sdp->sd_rgrps++) { | 462 | for (sdp->sd_rgrps = 0;; sdp->sd_rgrps++) { |
453 | loff_t pos = sdp->sd_rgrps * sizeof(struct gfs2_rindex); | 463 | loff_t pos = sdp->sd_rgrps * sizeof(struct gfs2_rindex); |
464 | printk(KERN_INFO "reading rgrp %d\n", sdp->sd_rgrps); | ||
454 | error = gfs2_internal_read(ip, &ra_state, buf, &pos, | 465 | error = gfs2_internal_read(ip, &ra_state, buf, &pos, |
455 | sizeof(struct gfs2_rindex)); | 466 | sizeof(struct gfs2_rindex)); |
456 | if (!error) | 467 | if (!error) |
@@ -474,13 +485,15 @@ static int gfs2_ri_update(struct gfs2_inode *ip) | |||
474 | list_add_tail(&rgd->rd_list_mru, &sdp->sd_rindex_mru_list); | 485 | list_add_tail(&rgd->rd_list_mru, &sdp->sd_rindex_mru_list); |
475 | 486 | ||
476 | gfs2_rindex_in(&rgd->rd_ri, buf); | 487 | gfs2_rindex_in(&rgd->rd_ri, buf); |
477 | 488 | printk(KERN_INFO "compute bitstructs\n"); | |
478 | error = compute_bitstructs(rgd); | 489 | error = compute_bitstructs(rgd); |
479 | if (error) | 490 | if (error) |
480 | goto fail; | 491 | goto fail; |
481 | 492 | ||
493 | printk(KERN_INFO "gfs2_glock_get\n"); | ||
482 | error = gfs2_glock_get(sdp, rgd->rd_ri.ri_addr, | 494 | error = gfs2_glock_get(sdp, rgd->rd_ri.ri_addr, |
483 | &gfs2_rgrp_glops, CREATE, &rgd->rd_gl); | 495 | &gfs2_rgrp_glops, CREATE, &rgd->rd_gl); |
496 | printk(KERN_INFO "gfs2_glock_got one\n"); | ||
484 | if (error) | 497 | if (error) |
485 | goto fail; | 498 | goto fail; |
486 | 499 | ||
@@ -488,13 +501,14 @@ static int gfs2_ri_update(struct gfs2_inode *ip) | |||
488 | rgd->rd_rg_vn = rgd->rd_gl->gl_vn - 1; | 501 | rgd->rd_rg_vn = rgd->rd_gl->gl_vn - 1; |
489 | } | 502 | } |
490 | 503 | ||
504 | printk(KERN_INFO "ok, finished\n"); | ||
491 | sdp->sd_rindex_vn = ip->i_gl->gl_vn; | 505 | sdp->sd_rindex_vn = ip->i_gl->gl_vn; |
492 | |||
493 | return 0; | 506 | return 0; |
494 | 507 | ||
495 | fail: | 508 | fail: |
509 | printk(KERN_INFO "fail\n"); | ||
496 | clear_rgrpdi(sdp); | 510 | clear_rgrpdi(sdp); |
497 | 511 | printk(KERN_INFO "cleared rgrps\n"); | |
498 | return error; | 512 | return error; |
499 | } | 513 | } |
500 | 514 | ||
@@ -518,7 +532,7 @@ static int gfs2_ri_update(struct gfs2_inode *ip) | |||
518 | 532 | ||
519 | int gfs2_rindex_hold(struct gfs2_sbd *sdp, struct gfs2_holder *ri_gh) | 533 | int gfs2_rindex_hold(struct gfs2_sbd *sdp, struct gfs2_holder *ri_gh) |
520 | { | 534 | { |
521 | struct gfs2_inode *ip = sdp->sd_rindex->u.generic_ip; | 535 | struct gfs2_inode *ip = GFS2_I(sdp->sd_rindex); |
522 | struct gfs2_glock *gl = ip->i_gl; | 536 | struct gfs2_glock *gl = ip->i_gl; |
523 | int error; | 537 | int error; |
524 | 538 | ||
@@ -583,8 +597,7 @@ int gfs2_rgrp_bh_get(struct gfs2_rgrpd *rgd) | |||
583 | error = gfs2_meta_reread(sdp, bi->bi_bh, DIO_WAIT); | 597 | error = gfs2_meta_reread(sdp, bi->bi_bh, DIO_WAIT); |
584 | if (error) | 598 | if (error) |
585 | goto fail; | 599 | goto fail; |
586 | if (gfs2_metatype_check(sdp, bi->bi_bh, | 600 | if (gfs2_metatype_check(sdp, bi->bi_bh, y ? GFS2_METATYPE_RB : |
587 | (y) ? GFS2_METATYPE_RB : | ||
588 | GFS2_METATYPE_RG)) { | 601 | GFS2_METATYPE_RG)) { |
589 | error = -EIO; | 602 | error = -EIO; |
590 | goto fail; | 603 | goto fail; |
@@ -605,7 +618,7 @@ int gfs2_rgrp_bh_get(struct gfs2_rgrpd *rgd) | |||
605 | 618 | ||
606 | return 0; | 619 | return 0; |
607 | 620 | ||
608 | fail: | 621 | fail: |
609 | while (x--) { | 622 | while (x--) { |
610 | bi = rgd->rd_bits + x; | 623 | bi = rgd->rd_bits + x; |
611 | brelse(bi->bi_bh); | 624 | brelse(bi->bi_bh); |
@@ -667,8 +680,7 @@ void gfs2_rgrp_repolish_clones(struct gfs2_rgrpd *rgd) | |||
667 | if (!bi->bi_clone) | 680 | if (!bi->bi_clone) |
668 | continue; | 681 | continue; |
669 | memcpy(bi->bi_clone + bi->bi_offset, | 682 | memcpy(bi->bi_clone + bi->bi_offset, |
670 | bi->bi_bh->b_data + bi->bi_offset, | 683 | bi->bi_bh->b_data + bi->bi_offset, bi->bi_len); |
671 | bi->bi_len); | ||
672 | } | 684 | } |
673 | 685 | ||
674 | spin_lock(&sdp->sd_rindex_spin); | 686 | spin_lock(&sdp->sd_rindex_spin); |
@@ -757,13 +769,11 @@ static struct gfs2_rgrpd *recent_rgrp_first(struct gfs2_sbd *sdp, | |||
757 | goto out; | 769 | goto out; |
758 | } | 770 | } |
759 | 771 | ||
760 | first: | 772 | first: |
761 | rgd = list_entry(sdp->sd_rindex_recent_list.next, struct gfs2_rgrpd, | 773 | rgd = list_entry(sdp->sd_rindex_recent_list.next, struct gfs2_rgrpd, |
762 | rd_recent); | 774 | rd_recent); |
763 | 775 | out: | |
764 | out: | ||
765 | spin_unlock(&sdp->sd_rindex_spin); | 776 | spin_unlock(&sdp->sd_rindex_spin); |
766 | |||
767 | return rgd; | 777 | return rgd; |
768 | } | 778 | } |
769 | 779 | ||
@@ -805,9 +815,8 @@ static struct gfs2_rgrpd *recent_rgrp_next(struct gfs2_rgrpd *cur_rgd, | |||
805 | if (!list_empty(head)) | 815 | if (!list_empty(head)) |
806 | rgd = list_entry(head->next, struct gfs2_rgrpd, rd_recent); | 816 | rgd = list_entry(head->next, struct gfs2_rgrpd, rd_recent); |
807 | 817 | ||
808 | out: | 818 | out: |
809 | spin_unlock(&sdp->sd_rindex_spin); | 819 | spin_unlock(&sdp->sd_rindex_spin); |
810 | |||
811 | return rgd; | 820 | return rgd; |
812 | } | 821 | } |
813 | 822 | ||
@@ -835,7 +844,7 @@ static void recent_rgrp_add(struct gfs2_rgrpd *new_rgd) | |||
835 | } | 844 | } |
836 | list_add_tail(&new_rgd->rd_recent, &sdp->sd_rindex_recent_list); | 845 | list_add_tail(&new_rgd->rd_recent, &sdp->sd_rindex_recent_list); |
837 | 846 | ||
838 | out: | 847 | out: |
839 | spin_unlock(&sdp->sd_rindex_spin); | 848 | spin_unlock(&sdp->sd_rindex_spin); |
840 | } | 849 | } |
841 | 850 | ||
@@ -898,7 +907,7 @@ static void forward_rgrp_set(struct gfs2_sbd *sdp, struct gfs2_rgrpd *rgd) | |||
898 | 907 | ||
899 | static int get_local_rgrp(struct gfs2_inode *ip) | 908 | static int get_local_rgrp(struct gfs2_inode *ip) |
900 | { | 909 | { |
901 | struct gfs2_sbd *sdp = ip->i_sbd; | 910 | struct gfs2_sbd *sdp = GFS2_SB(&ip->i_inode); |
902 | struct gfs2_rgrpd *rgd, *begin = NULL; | 911 | struct gfs2_rgrpd *rgd, *begin = NULL; |
903 | struct gfs2_alloc *al = &ip->i_alloc; | 912 | struct gfs2_alloc *al = &ip->i_alloc; |
904 | int flags = LM_FLAG_TRY; | 913 | int flags = LM_FLAG_TRY; |
@@ -965,7 +974,7 @@ static int get_local_rgrp(struct gfs2_inode *ip) | |||
965 | } | 974 | } |
966 | } | 975 | } |
967 | 976 | ||
968 | out: | 977 | out: |
969 | ip->i_last_rg_alloc = rgd->rd_ri.ri_addr; | 978 | ip->i_last_rg_alloc = rgd->rd_ri.ri_addr; |
970 | 979 | ||
971 | if (begin) { | 980 | if (begin) { |
@@ -988,7 +997,7 @@ static int get_local_rgrp(struct gfs2_inode *ip) | |||
988 | 997 | ||
989 | int gfs2_inplace_reserve_i(struct gfs2_inode *ip, char *file, unsigned int line) | 998 | int gfs2_inplace_reserve_i(struct gfs2_inode *ip, char *file, unsigned int line) |
990 | { | 999 | { |
991 | struct gfs2_sbd *sdp = ip->i_sbd; | 1000 | struct gfs2_sbd *sdp = GFS2_SB(&ip->i_inode); |
992 | struct gfs2_alloc *al = &ip->i_alloc; | 1001 | struct gfs2_alloc *al = &ip->i_alloc; |
993 | int error; | 1002 | int error; |
994 | 1003 | ||
@@ -1020,7 +1029,7 @@ int gfs2_inplace_reserve_i(struct gfs2_inode *ip, char *file, unsigned int line) | |||
1020 | 1029 | ||
1021 | void gfs2_inplace_release(struct gfs2_inode *ip) | 1030 | void gfs2_inplace_release(struct gfs2_inode *ip) |
1022 | { | 1031 | { |
1023 | struct gfs2_sbd *sdp = ip->i_sbd; | 1032 | struct gfs2_sbd *sdp = GFS2_SB(&ip->i_inode); |
1024 | struct gfs2_alloc *al = &ip->i_alloc; | 1033 | struct gfs2_alloc *al = &ip->i_alloc; |
1025 | 1034 | ||
1026 | if (gfs2_assert_warn(sdp, al->al_alloced <= al->al_requested) == -1) | 1035 | if (gfs2_assert_warn(sdp, al->al_alloced <= al->al_requested) == -1) |
@@ -1061,8 +1070,7 @@ unsigned char gfs2_get_block_type(struct gfs2_rgrpd *rgd, uint64_t block) | |||
1061 | gfs2_assert(rgd->rd_sbd, buf < length); | 1070 | gfs2_assert(rgd->rd_sbd, buf < length); |
1062 | buf_block = rgrp_block - bi->bi_start * GFS2_NBBY; | 1071 | buf_block = rgrp_block - bi->bi_start * GFS2_NBBY; |
1063 | 1072 | ||
1064 | type = gfs2_testbit(rgd, | 1073 | type = gfs2_testbit(rgd, bi->bi_bh->b_data + bi->bi_offset, |
1065 | bi->bi_bh->b_data + bi->bi_offset, | ||
1066 | bi->bi_len, buf_block); | 1074 | bi->bi_len, buf_block); |
1067 | 1075 | ||
1068 | return type; | 1076 | return type; |
@@ -1210,7 +1218,7 @@ static struct gfs2_rgrpd *rgblk_free(struct gfs2_sbd *sdp, uint64_t bstart, | |||
1210 | 1218 | ||
1211 | uint64_t gfs2_alloc_data(struct gfs2_inode *ip) | 1219 | uint64_t gfs2_alloc_data(struct gfs2_inode *ip) |
1212 | { | 1220 | { |
1213 | struct gfs2_sbd *sdp = ip->i_sbd; | 1221 | struct gfs2_sbd *sdp = GFS2_SB(&ip->i_inode); |
1214 | struct gfs2_alloc *al = &ip->i_alloc; | 1222 | struct gfs2_alloc *al = &ip->i_alloc; |
1215 | struct gfs2_rgrpd *rgd = al->al_rgd; | 1223 | struct gfs2_rgrpd *rgd = al->al_rgd; |
1216 | uint32_t goal, blk; | 1224 | uint32_t goal, blk; |
@@ -1254,7 +1262,7 @@ uint64_t gfs2_alloc_data(struct gfs2_inode *ip) | |||
1254 | 1262 | ||
1255 | uint64_t gfs2_alloc_meta(struct gfs2_inode *ip) | 1263 | uint64_t gfs2_alloc_meta(struct gfs2_inode *ip) |
1256 | { | 1264 | { |
1257 | struct gfs2_sbd *sdp = ip->i_sbd; | 1265 | struct gfs2_sbd *sdp = GFS2_SB(&ip->i_inode); |
1258 | struct gfs2_alloc *al = &ip->i_alloc; | 1266 | struct gfs2_alloc *al = &ip->i_alloc; |
1259 | struct gfs2_rgrpd *rgd = al->al_rgd; | 1267 | struct gfs2_rgrpd *rgd = al->al_rgd; |
1260 | uint32_t goal, blk; | 1268 | uint32_t goal, blk; |
@@ -1299,7 +1307,7 @@ uint64_t gfs2_alloc_meta(struct gfs2_inode *ip) | |||
1299 | 1307 | ||
1300 | uint64_t gfs2_alloc_di(struct gfs2_inode *dip) | 1308 | uint64_t gfs2_alloc_di(struct gfs2_inode *dip) |
1301 | { | 1309 | { |
1302 | struct gfs2_sbd *sdp = dip->i_sbd; | 1310 | struct gfs2_sbd *sdp = GFS2_SB(&dip->i_inode); |
1303 | struct gfs2_alloc *al = &dip->i_alloc; | 1311 | struct gfs2_alloc *al = &dip->i_alloc; |
1304 | struct gfs2_rgrpd *rgd = al->al_rgd; | 1312 | struct gfs2_rgrpd *rgd = al->al_rgd; |
1305 | uint32_t blk; | 1313 | uint32_t blk; |
@@ -1341,7 +1349,7 @@ uint64_t gfs2_alloc_di(struct gfs2_inode *dip) | |||
1341 | 1349 | ||
1342 | void gfs2_free_data(struct gfs2_inode *ip, uint64_t bstart, uint32_t blen) | 1350 | void gfs2_free_data(struct gfs2_inode *ip, uint64_t bstart, uint32_t blen) |
1343 | { | 1351 | { |
1344 | struct gfs2_sbd *sdp = ip->i_sbd; | 1352 | struct gfs2_sbd *sdp = GFS2_SB(&ip->i_inode); |
1345 | struct gfs2_rgrpd *rgd; | 1353 | struct gfs2_rgrpd *rgd; |
1346 | 1354 | ||
1347 | rgd = rgblk_free(sdp, bstart, blen, GFS2_BLKST_FREE); | 1355 | rgd = rgblk_free(sdp, bstart, blen, GFS2_BLKST_FREE); |
@@ -1370,7 +1378,7 @@ void gfs2_free_data(struct gfs2_inode *ip, uint64_t bstart, uint32_t blen) | |||
1370 | 1378 | ||
1371 | void gfs2_free_meta(struct gfs2_inode *ip, uint64_t bstart, uint32_t blen) | 1379 | void gfs2_free_meta(struct gfs2_inode *ip, uint64_t bstart, uint32_t blen) |
1372 | { | 1380 | { |
1373 | struct gfs2_sbd *sdp = ip->i_sbd; | 1381 | struct gfs2_sbd *sdp = GFS2_SB(&ip->i_inode); |
1374 | struct gfs2_rgrpd *rgd; | 1382 | struct gfs2_rgrpd *rgd; |
1375 | 1383 | ||
1376 | rgd = rgblk_free(sdp, bstart, blen, GFS2_BLKST_FREE); | 1384 | rgd = rgblk_free(sdp, bstart, blen, GFS2_BLKST_FREE); |
@@ -1385,11 +1393,25 @@ void gfs2_free_meta(struct gfs2_inode *ip, uint64_t bstart, uint32_t blen) | |||
1385 | gfs2_trans_add_rg(rgd); | 1393 | gfs2_trans_add_rg(rgd); |
1386 | 1394 | ||
1387 | gfs2_statfs_change(sdp, 0, +blen, 0); | 1395 | gfs2_statfs_change(sdp, 0, +blen, 0); |
1388 | gfs2_quota_change(ip, -(int64_t)blen, | 1396 | gfs2_quota_change(ip, -(int64_t)blen, ip->i_di.di_uid, ip->i_di.di_gid); |
1389 | ip->i_di.di_uid, ip->i_di.di_gid); | ||
1390 | gfs2_meta_wipe(ip, bstart, blen); | 1397 | gfs2_meta_wipe(ip, bstart, blen); |
1391 | } | 1398 | } |
1392 | 1399 | ||
1400 | void gfs2_unlink_di(struct inode *inode) | ||
1401 | { | ||
1402 | struct gfs2_inode *ip = GFS2_I(inode); | ||
1403 | struct gfs2_sbd *sdp = GFS2_SB(inode); | ||
1404 | struct gfs2_rgrpd *rgd; | ||
1405 | u64 blkno = ip->i_num.no_addr; | ||
1406 | |||
1407 | rgd = rgblk_free(sdp, blkno, 1, GFS2_BLKST_UNLINKED); | ||
1408 | if (!rgd) | ||
1409 | return; | ||
1410 | gfs2_trans_add_bh(rgd->rd_gl, rgd->rd_bits[0].bi_bh, 1); | ||
1411 | gfs2_rgrp_out(&rgd->rd_rg, rgd->rd_bits[0].bi_bh->b_data); | ||
1412 | gfs2_trans_add_rg(rgd); | ||
1413 | } | ||
1414 | |||
1393 | void gfs2_free_uninit_di(struct gfs2_rgrpd *rgd, uint64_t blkno) | 1415 | void gfs2_free_uninit_di(struct gfs2_rgrpd *rgd, uint64_t blkno) |
1394 | { | 1416 | { |
1395 | struct gfs2_sbd *sdp = rgd->rd_sbd; | 1417 | struct gfs2_sbd *sdp = rgd->rd_sbd; |
@@ -1412,12 +1434,6 @@ void gfs2_free_uninit_di(struct gfs2_rgrpd *rgd, uint64_t blkno) | |||
1412 | gfs2_trans_add_rg(rgd); | 1434 | gfs2_trans_add_rg(rgd); |
1413 | } | 1435 | } |
1414 | 1436 | ||
1415 | /** | ||
1416 | * gfs2_free_uninit_di - free a dinode block | ||
1417 | * @rgd: the resource group that contains the dinode | ||
1418 | * @ip: the inode | ||
1419 | * | ||
1420 | */ | ||
1421 | 1437 | ||
1422 | void gfs2_free_di(struct gfs2_rgrpd *rgd, struct gfs2_inode *ip) | 1438 | void gfs2_free_di(struct gfs2_rgrpd *rgd, struct gfs2_inode *ip) |
1423 | { | 1439 | { |