diff options
Diffstat (limited to 'fs/gfs2/dir.c')
-rw-r--r-- | fs/gfs2/dir.c | 93 |
1 files changed, 52 insertions, 41 deletions
diff --git a/fs/gfs2/dir.c b/fs/gfs2/dir.c index e24af28b1a12..0fdcb7713cd9 100644 --- a/fs/gfs2/dir.c +++ b/fs/gfs2/dir.c | |||
@@ -131,8 +131,8 @@ static int gfs2_dir_write_stuffed(struct gfs2_inode *ip, const char *buf, | |||
131 | memcpy(dibh->b_data + offset + sizeof(struct gfs2_dinode), buf, size); | 131 | memcpy(dibh->b_data + offset + sizeof(struct gfs2_dinode), buf, size); |
132 | if (ip->i_di.di_size < offset + size) | 132 | if (ip->i_di.di_size < offset + size) |
133 | ip->i_di.di_size = offset + size; | 133 | ip->i_di.di_size = offset + size; |
134 | ip->i_di.di_mtime = ip->i_di.di_ctime = get_seconds(); | 134 | ip->i_inode.i_mtime.tv_sec = ip->i_inode.i_ctime.tv_sec = get_seconds(); |
135 | gfs2_dinode_out(&ip->i_di, dibh->b_data); | 135 | gfs2_dinode_out(ip, dibh->b_data); |
136 | 136 | ||
137 | brelse(dibh); | 137 | brelse(dibh); |
138 | 138 | ||
@@ -229,10 +229,10 @@ out: | |||
229 | 229 | ||
230 | if (ip->i_di.di_size < offset + copied) | 230 | if (ip->i_di.di_size < offset + copied) |
231 | ip->i_di.di_size = offset + copied; | 231 | ip->i_di.di_size = offset + copied; |
232 | ip->i_di.di_mtime = ip->i_di.di_ctime = get_seconds(); | 232 | ip->i_inode.i_mtime.tv_sec = ip->i_inode.i_ctime.tv_sec = get_seconds(); |
233 | 233 | ||
234 | gfs2_trans_add_bh(ip->i_gl, dibh, 1); | 234 | gfs2_trans_add_bh(ip->i_gl, dibh, 1); |
235 | gfs2_dinode_out(&ip->i_di, dibh->b_data); | 235 | gfs2_dinode_out(ip, dibh->b_data); |
236 | brelse(dibh); | 236 | brelse(dibh); |
237 | 237 | ||
238 | return copied; | 238 | return copied; |
@@ -340,10 +340,15 @@ fail: | |||
340 | return (copied) ? copied : error; | 340 | return (copied) ? copied : error; |
341 | } | 341 | } |
342 | 342 | ||
343 | static inline int gfs2_dirent_sentinel(const struct gfs2_dirent *dent) | ||
344 | { | ||
345 | return dent->de_inum.no_addr == 0 || dent->de_inum.no_formal_ino == 0; | ||
346 | } | ||
347 | |||
343 | static inline int __gfs2_dirent_find(const struct gfs2_dirent *dent, | 348 | static inline int __gfs2_dirent_find(const struct gfs2_dirent *dent, |
344 | const struct qstr *name, int ret) | 349 | const struct qstr *name, int ret) |
345 | { | 350 | { |
346 | if (dent->de_inum.no_addr != 0 && | 351 | if (!gfs2_dirent_sentinel(dent) && |
347 | be32_to_cpu(dent->de_hash) == name->hash && | 352 | be32_to_cpu(dent->de_hash) == name->hash && |
348 | be16_to_cpu(dent->de_name_len) == name->len && | 353 | be16_to_cpu(dent->de_name_len) == name->len && |
349 | memcmp(dent+1, name->name, name->len) == 0) | 354 | memcmp(dent+1, name->name, name->len) == 0) |
@@ -388,7 +393,7 @@ static int gfs2_dirent_find_space(const struct gfs2_dirent *dent, | |||
388 | unsigned actual = GFS2_DIRENT_SIZE(be16_to_cpu(dent->de_name_len)); | 393 | unsigned actual = GFS2_DIRENT_SIZE(be16_to_cpu(dent->de_name_len)); |
389 | unsigned totlen = be16_to_cpu(dent->de_rec_len); | 394 | unsigned totlen = be16_to_cpu(dent->de_rec_len); |
390 | 395 | ||
391 | if (!dent->de_inum.no_addr) | 396 | if (gfs2_dirent_sentinel(dent)) |
392 | actual = GFS2_DIRENT_SIZE(0); | 397 | actual = GFS2_DIRENT_SIZE(0); |
393 | if (totlen - actual >= required) | 398 | if (totlen - actual >= required) |
394 | return 1; | 399 | return 1; |
@@ -405,7 +410,7 @@ static int gfs2_dirent_gather(const struct gfs2_dirent *dent, | |||
405 | void *opaque) | 410 | void *opaque) |
406 | { | 411 | { |
407 | struct dirent_gather *g = opaque; | 412 | struct dirent_gather *g = opaque; |
408 | if (dent->de_inum.no_addr) { | 413 | if (!gfs2_dirent_sentinel(dent)) { |
409 | g->pdent[g->offset++] = dent; | 414 | g->pdent[g->offset++] = dent; |
410 | } | 415 | } |
411 | return 0; | 416 | return 0; |
@@ -433,10 +438,10 @@ static int gfs2_check_dirent(struct gfs2_dirent *dent, unsigned int offset, | |||
433 | if (unlikely(offset + size > len)) | 438 | if (unlikely(offset + size > len)) |
434 | goto error; | 439 | goto error; |
435 | msg = "zero inode number"; | 440 | msg = "zero inode number"; |
436 | if (unlikely(!first && !dent->de_inum.no_addr)) | 441 | if (unlikely(!first && gfs2_dirent_sentinel(dent))) |
437 | goto error; | 442 | goto error; |
438 | msg = "name length is greater than space in dirent"; | 443 | msg = "name length is greater than space in dirent"; |
439 | if (dent->de_inum.no_addr && | 444 | if (!gfs2_dirent_sentinel(dent) && |
440 | unlikely(sizeof(struct gfs2_dirent)+be16_to_cpu(dent->de_name_len) > | 445 | unlikely(sizeof(struct gfs2_dirent)+be16_to_cpu(dent->de_name_len) > |
441 | size)) | 446 | size)) |
442 | goto error; | 447 | goto error; |
@@ -598,7 +603,7 @@ static int dirent_next(struct gfs2_inode *dip, struct buffer_head *bh, | |||
598 | return ret; | 603 | return ret; |
599 | 604 | ||
600 | /* Only the first dent could ever have de_inum.no_addr == 0 */ | 605 | /* Only the first dent could ever have de_inum.no_addr == 0 */ |
601 | if (!tmp->de_inum.no_addr) { | 606 | if (gfs2_dirent_sentinel(tmp)) { |
602 | gfs2_consist_inode(dip); | 607 | gfs2_consist_inode(dip); |
603 | return -EIO; | 608 | return -EIO; |
604 | } | 609 | } |
@@ -621,7 +626,7 @@ static void dirent_del(struct gfs2_inode *dip, struct buffer_head *bh, | |||
621 | { | 626 | { |
622 | u16 cur_rec_len, prev_rec_len; | 627 | u16 cur_rec_len, prev_rec_len; |
623 | 628 | ||
624 | if (!cur->de_inum.no_addr) { | 629 | if (gfs2_dirent_sentinel(cur)) { |
625 | gfs2_consist_inode(dip); | 630 | gfs2_consist_inode(dip); |
626 | return; | 631 | return; |
627 | } | 632 | } |
@@ -633,7 +638,8 @@ static void dirent_del(struct gfs2_inode *dip, struct buffer_head *bh, | |||
633 | out the inode number and return. */ | 638 | out the inode number and return. */ |
634 | 639 | ||
635 | if (!prev) { | 640 | if (!prev) { |
636 | cur->de_inum.no_addr = 0; /* No endianess worries */ | 641 | cur->de_inum.no_addr = 0; |
642 | cur->de_inum.no_formal_ino = 0; | ||
637 | return; | 643 | return; |
638 | } | 644 | } |
639 | 645 | ||
@@ -664,7 +670,7 @@ static struct gfs2_dirent *gfs2_init_dirent(struct inode *inode, | |||
664 | struct gfs2_dirent *ndent; | 670 | struct gfs2_dirent *ndent; |
665 | unsigned offset = 0, totlen; | 671 | unsigned offset = 0, totlen; |
666 | 672 | ||
667 | if (dent->de_inum.no_addr) | 673 | if (!gfs2_dirent_sentinel(dent)) |
668 | offset = GFS2_DIRENT_SIZE(be16_to_cpu(dent->de_name_len)); | 674 | offset = GFS2_DIRENT_SIZE(be16_to_cpu(dent->de_name_len)); |
669 | totlen = be16_to_cpu(dent->de_rec_len); | 675 | totlen = be16_to_cpu(dent->de_rec_len); |
670 | BUG_ON(offset + name->len > totlen); | 676 | BUG_ON(offset + name->len > totlen); |
@@ -713,12 +719,12 @@ static int get_leaf(struct gfs2_inode *dip, u64 leaf_no, | |||
713 | static int get_leaf_nr(struct gfs2_inode *dip, u32 index, | 719 | static int get_leaf_nr(struct gfs2_inode *dip, u32 index, |
714 | u64 *leaf_out) | 720 | u64 *leaf_out) |
715 | { | 721 | { |
716 | u64 leaf_no; | 722 | __be64 leaf_no; |
717 | int error; | 723 | int error; |
718 | 724 | ||
719 | error = gfs2_dir_read_data(dip, (char *)&leaf_no, | 725 | error = gfs2_dir_read_data(dip, (char *)&leaf_no, |
720 | index * sizeof(u64), | 726 | index * sizeof(__be64), |
721 | sizeof(u64), 0); | 727 | sizeof(__be64), 0); |
722 | if (error != sizeof(u64)) | 728 | if (error != sizeof(u64)) |
723 | return (error < 0) ? error : -EIO; | 729 | return (error < 0) ? error : -EIO; |
724 | 730 | ||
@@ -837,7 +843,8 @@ static int dir_make_exhash(struct inode *inode) | |||
837 | struct gfs2_leaf *leaf; | 843 | struct gfs2_leaf *leaf; |
838 | int y; | 844 | int y; |
839 | u32 x; | 845 | u32 x; |
840 | u64 *lp, bn; | 846 | __be64 *lp; |
847 | u64 bn; | ||
841 | int error; | 848 | int error; |
842 | 849 | ||
843 | error = gfs2_meta_inode_buffer(dip, &dibh); | 850 | error = gfs2_meta_inode_buffer(dip, &dibh); |
@@ -893,20 +900,20 @@ static int dir_make_exhash(struct inode *inode) | |||
893 | gfs2_trans_add_bh(dip->i_gl, dibh, 1); | 900 | gfs2_trans_add_bh(dip->i_gl, dibh, 1); |
894 | gfs2_buffer_clear_tail(dibh, sizeof(struct gfs2_dinode)); | 901 | gfs2_buffer_clear_tail(dibh, sizeof(struct gfs2_dinode)); |
895 | 902 | ||
896 | lp = (u64 *)(dibh->b_data + sizeof(struct gfs2_dinode)); | 903 | lp = (__be64 *)(dibh->b_data + sizeof(struct gfs2_dinode)); |
897 | 904 | ||
898 | for (x = sdp->sd_hash_ptrs; x--; lp++) | 905 | for (x = sdp->sd_hash_ptrs; x--; lp++) |
899 | *lp = cpu_to_be64(bn); | 906 | *lp = cpu_to_be64(bn); |
900 | 907 | ||
901 | dip->i_di.di_size = sdp->sd_sb.sb_bsize / 2; | 908 | dip->i_di.di_size = sdp->sd_sb.sb_bsize / 2; |
902 | dip->i_di.di_blocks++; | 909 | dip->i_di.di_blocks++; |
910 | gfs2_set_inode_blocks(&dip->i_inode); | ||
903 | dip->i_di.di_flags |= GFS2_DIF_EXHASH; | 911 | dip->i_di.di_flags |= GFS2_DIF_EXHASH; |
904 | dip->i_di.di_payload_format = 0; | ||
905 | 912 | ||
906 | for (x = sdp->sd_hash_ptrs, y = -1; x; x >>= 1, y++) ; | 913 | for (x = sdp->sd_hash_ptrs, y = -1; x; x >>= 1, y++) ; |
907 | dip->i_di.di_depth = y; | 914 | dip->i_di.di_depth = y; |
908 | 915 | ||
909 | gfs2_dinode_out(&dip->i_di, dibh->b_data); | 916 | gfs2_dinode_out(dip, dibh->b_data); |
910 | 917 | ||
911 | brelse(dibh); | 918 | brelse(dibh); |
912 | 919 | ||
@@ -929,7 +936,8 @@ static int dir_split_leaf(struct inode *inode, const struct qstr *name) | |||
929 | struct gfs2_leaf *nleaf, *oleaf; | 936 | struct gfs2_leaf *nleaf, *oleaf; |
930 | struct gfs2_dirent *dent = NULL, *prev = NULL, *next = NULL, *new; | 937 | struct gfs2_dirent *dent = NULL, *prev = NULL, *next = NULL, *new; |
931 | u32 start, len, half_len, divider; | 938 | u32 start, len, half_len, divider; |
932 | u64 bn, *lp, leaf_no; | 939 | u64 bn, leaf_no; |
940 | __be64 *lp; | ||
933 | u32 index; | 941 | u32 index; |
934 | int x, moved = 0; | 942 | int x, moved = 0; |
935 | int error; | 943 | int error; |
@@ -974,7 +982,7 @@ static int dir_split_leaf(struct inode *inode, const struct qstr *name) | |||
974 | /* Change the pointers. | 982 | /* Change the pointers. |
975 | Don't bother distinguishing stuffed from non-stuffed. | 983 | Don't bother distinguishing stuffed from non-stuffed. |
976 | This code is complicated enough already. */ | 984 | This code is complicated enough already. */ |
977 | lp = kmalloc(half_len * sizeof(u64), GFP_NOFS | __GFP_NOFAIL); | 985 | lp = kmalloc(half_len * sizeof(__be64), GFP_NOFS | __GFP_NOFAIL); |
978 | /* Change the pointers */ | 986 | /* Change the pointers */ |
979 | for (x = 0; x < half_len; x++) | 987 | for (x = 0; x < half_len; x++) |
980 | lp[x] = cpu_to_be64(bn); | 988 | lp[x] = cpu_to_be64(bn); |
@@ -1000,7 +1008,7 @@ static int dir_split_leaf(struct inode *inode, const struct qstr *name) | |||
1000 | if (dirent_next(dip, obh, &next)) | 1008 | if (dirent_next(dip, obh, &next)) |
1001 | next = NULL; | 1009 | next = NULL; |
1002 | 1010 | ||
1003 | if (dent->de_inum.no_addr && | 1011 | if (!gfs2_dirent_sentinel(dent) && |
1004 | be32_to_cpu(dent->de_hash) < divider) { | 1012 | be32_to_cpu(dent->de_hash) < divider) { |
1005 | struct qstr str; | 1013 | struct qstr str; |
1006 | str.name = (char*)(dent+1); | 1014 | str.name = (char*)(dent+1); |
@@ -1037,7 +1045,8 @@ static int dir_split_leaf(struct inode *inode, const struct qstr *name) | |||
1037 | error = gfs2_meta_inode_buffer(dip, &dibh); | 1045 | error = gfs2_meta_inode_buffer(dip, &dibh); |
1038 | if (!gfs2_assert_withdraw(GFS2_SB(&dip->i_inode), !error)) { | 1046 | if (!gfs2_assert_withdraw(GFS2_SB(&dip->i_inode), !error)) { |
1039 | dip->i_di.di_blocks++; | 1047 | dip->i_di.di_blocks++; |
1040 | gfs2_dinode_out(&dip->i_di, dibh->b_data); | 1048 | gfs2_set_inode_blocks(&dip->i_inode); |
1049 | gfs2_dinode_out(dip, dibh->b_data); | ||
1041 | brelse(dibh); | 1050 | brelse(dibh); |
1042 | } | 1051 | } |
1043 | 1052 | ||
@@ -1117,7 +1126,7 @@ static int dir_double_exhash(struct gfs2_inode *dip) | |||
1117 | error = gfs2_meta_inode_buffer(dip, &dibh); | 1126 | error = gfs2_meta_inode_buffer(dip, &dibh); |
1118 | if (!gfs2_assert_withdraw(sdp, !error)) { | 1127 | if (!gfs2_assert_withdraw(sdp, !error)) { |
1119 | dip->i_di.di_depth++; | 1128 | dip->i_di.di_depth++; |
1120 | gfs2_dinode_out(&dip->i_di, dibh->b_data); | 1129 | gfs2_dinode_out(dip, dibh->b_data); |
1121 | brelse(dibh); | 1130 | brelse(dibh); |
1122 | } | 1131 | } |
1123 | 1132 | ||
@@ -1194,7 +1203,7 @@ static int do_filldir_main(struct gfs2_inode *dip, u64 *offset, | |||
1194 | int *copied) | 1203 | int *copied) |
1195 | { | 1204 | { |
1196 | const struct gfs2_dirent *dent, *dent_next; | 1205 | const struct gfs2_dirent *dent, *dent_next; |
1197 | struct gfs2_inum inum; | 1206 | struct gfs2_inum_host inum; |
1198 | u64 off, off_next; | 1207 | u64 off, off_next; |
1199 | unsigned int x, y; | 1208 | unsigned int x, y; |
1200 | int run = 0; | 1209 | int run = 0; |
@@ -1341,7 +1350,7 @@ static int dir_e_read(struct inode *inode, u64 *offset, void *opaque, | |||
1341 | u32 hsize, len = 0; | 1350 | u32 hsize, len = 0; |
1342 | u32 ht_offset, lp_offset, ht_offset_cur = -1; | 1351 | u32 ht_offset, lp_offset, ht_offset_cur = -1; |
1343 | u32 hash, index; | 1352 | u32 hash, index; |
1344 | u64 *lp; | 1353 | __be64 *lp; |
1345 | int copied = 0; | 1354 | int copied = 0; |
1346 | int error = 0; | 1355 | int error = 0; |
1347 | unsigned depth = 0; | 1356 | unsigned depth = 0; |
@@ -1365,7 +1374,7 @@ static int dir_e_read(struct inode *inode, u64 *offset, void *opaque, | |||
1365 | 1374 | ||
1366 | if (ht_offset_cur != ht_offset) { | 1375 | if (ht_offset_cur != ht_offset) { |
1367 | error = gfs2_dir_read_data(dip, (char *)lp, | 1376 | error = gfs2_dir_read_data(dip, (char *)lp, |
1368 | ht_offset * sizeof(u64), | 1377 | ht_offset * sizeof(__be64), |
1369 | sdp->sd_hash_bsize, 1); | 1378 | sdp->sd_hash_bsize, 1); |
1370 | if (error != sdp->sd_hash_bsize) { | 1379 | if (error != sdp->sd_hash_bsize) { |
1371 | if (error >= 0) | 1380 | if (error >= 0) |
@@ -1456,7 +1465,7 @@ out: | |||
1456 | */ | 1465 | */ |
1457 | 1466 | ||
1458 | int gfs2_dir_search(struct inode *dir, const struct qstr *name, | 1467 | int gfs2_dir_search(struct inode *dir, const struct qstr *name, |
1459 | struct gfs2_inum *inum, unsigned int *type) | 1468 | struct gfs2_inum_host *inum, unsigned int *type) |
1460 | { | 1469 | { |
1461 | struct buffer_head *bh; | 1470 | struct buffer_head *bh; |
1462 | struct gfs2_dirent *dent; | 1471 | struct gfs2_dirent *dent; |
@@ -1515,7 +1524,8 @@ static int dir_new_leaf(struct inode *inode, const struct qstr *name) | |||
1515 | return error; | 1524 | return error; |
1516 | gfs2_trans_add_bh(ip->i_gl, bh, 1); | 1525 | gfs2_trans_add_bh(ip->i_gl, bh, 1); |
1517 | ip->i_di.di_blocks++; | 1526 | ip->i_di.di_blocks++; |
1518 | gfs2_dinode_out(&ip->i_di, bh->b_data); | 1527 | gfs2_set_inode_blocks(&ip->i_inode); |
1528 | gfs2_dinode_out(ip, bh->b_data); | ||
1519 | brelse(bh); | 1529 | brelse(bh); |
1520 | return 0; | 1530 | return 0; |
1521 | } | 1531 | } |
@@ -1531,7 +1541,7 @@ static int dir_new_leaf(struct inode *inode, const struct qstr *name) | |||
1531 | */ | 1541 | */ |
1532 | 1542 | ||
1533 | int gfs2_dir_add(struct inode *inode, const struct qstr *name, | 1543 | int gfs2_dir_add(struct inode *inode, const struct qstr *name, |
1534 | const struct gfs2_inum *inum, unsigned type) | 1544 | const struct gfs2_inum_host *inum, unsigned type) |
1535 | { | 1545 | { |
1536 | struct gfs2_inode *ip = GFS2_I(inode); | 1546 | struct gfs2_inode *ip = GFS2_I(inode); |
1537 | struct buffer_head *bh; | 1547 | struct buffer_head *bh; |
@@ -1558,8 +1568,8 @@ int gfs2_dir_add(struct inode *inode, const struct qstr *name, | |||
1558 | break; | 1568 | break; |
1559 | gfs2_trans_add_bh(ip->i_gl, bh, 1); | 1569 | gfs2_trans_add_bh(ip->i_gl, bh, 1); |
1560 | ip->i_di.di_entries++; | 1570 | ip->i_di.di_entries++; |
1561 | ip->i_di.di_mtime = ip->i_di.di_ctime = get_seconds(); | 1571 | ip->i_inode.i_mtime.tv_sec = ip->i_inode.i_ctime.tv_sec = get_seconds(); |
1562 | gfs2_dinode_out(&ip->i_di, bh->b_data); | 1572 | gfs2_dinode_out(ip, bh->b_data); |
1563 | brelse(bh); | 1573 | brelse(bh); |
1564 | error = 0; | 1574 | error = 0; |
1565 | break; | 1575 | break; |
@@ -1644,8 +1654,8 @@ int gfs2_dir_del(struct gfs2_inode *dip, const struct qstr *name) | |||
1644 | gfs2_consist_inode(dip); | 1654 | gfs2_consist_inode(dip); |
1645 | gfs2_trans_add_bh(dip->i_gl, bh, 1); | 1655 | gfs2_trans_add_bh(dip->i_gl, bh, 1); |
1646 | dip->i_di.di_entries--; | 1656 | dip->i_di.di_entries--; |
1647 | dip->i_di.di_mtime = dip->i_di.di_ctime = get_seconds(); | 1657 | dip->i_inode.i_mtime.tv_sec = dip->i_inode.i_ctime.tv_sec = get_seconds(); |
1648 | gfs2_dinode_out(&dip->i_di, bh->b_data); | 1658 | gfs2_dinode_out(dip, bh->b_data); |
1649 | brelse(bh); | 1659 | brelse(bh); |
1650 | mark_inode_dirty(&dip->i_inode); | 1660 | mark_inode_dirty(&dip->i_inode); |
1651 | 1661 | ||
@@ -1666,7 +1676,7 @@ int gfs2_dir_del(struct gfs2_inode *dip, const struct qstr *name) | |||
1666 | */ | 1676 | */ |
1667 | 1677 | ||
1668 | int gfs2_dir_mvino(struct gfs2_inode *dip, const struct qstr *filename, | 1678 | int gfs2_dir_mvino(struct gfs2_inode *dip, const struct qstr *filename, |
1669 | struct gfs2_inum *inum, unsigned int new_type) | 1679 | struct gfs2_inum_host *inum, unsigned int new_type) |
1670 | { | 1680 | { |
1671 | struct buffer_head *bh; | 1681 | struct buffer_head *bh; |
1672 | struct gfs2_dirent *dent; | 1682 | struct gfs2_dirent *dent; |
@@ -1692,8 +1702,8 @@ int gfs2_dir_mvino(struct gfs2_inode *dip, const struct qstr *filename, | |||
1692 | gfs2_trans_add_bh(dip->i_gl, bh, 1); | 1702 | gfs2_trans_add_bh(dip->i_gl, bh, 1); |
1693 | } | 1703 | } |
1694 | 1704 | ||
1695 | dip->i_di.di_mtime = dip->i_di.di_ctime = get_seconds(); | 1705 | dip->i_inode.i_mtime.tv_sec = dip->i_inode.i_ctime.tv_sec = get_seconds(); |
1696 | gfs2_dinode_out(&dip->i_di, bh->b_data); | 1706 | gfs2_dinode_out(dip, bh->b_data); |
1697 | brelse(bh); | 1707 | brelse(bh); |
1698 | return 0; | 1708 | return 0; |
1699 | } | 1709 | } |
@@ -1715,7 +1725,7 @@ static int foreach_leaf(struct gfs2_inode *dip, leaf_call_t lc, void *data) | |||
1715 | u32 hsize, len; | 1725 | u32 hsize, len; |
1716 | u32 ht_offset, lp_offset, ht_offset_cur = -1; | 1726 | u32 ht_offset, lp_offset, ht_offset_cur = -1; |
1717 | u32 index = 0; | 1727 | u32 index = 0; |
1718 | u64 *lp; | 1728 | __be64 *lp; |
1719 | u64 leaf_no; | 1729 | u64 leaf_no; |
1720 | int error = 0; | 1730 | int error = 0; |
1721 | 1731 | ||
@@ -1735,7 +1745,7 @@ static int foreach_leaf(struct gfs2_inode *dip, leaf_call_t lc, void *data) | |||
1735 | 1745 | ||
1736 | if (ht_offset_cur != ht_offset) { | 1746 | if (ht_offset_cur != ht_offset) { |
1737 | error = gfs2_dir_read_data(dip, (char *)lp, | 1747 | error = gfs2_dir_read_data(dip, (char *)lp, |
1738 | ht_offset * sizeof(u64), | 1748 | ht_offset * sizeof(__be64), |
1739 | sdp->sd_hash_bsize, 1); | 1749 | sdp->sd_hash_bsize, 1); |
1740 | if (error != sdp->sd_hash_bsize) { | 1750 | if (error != sdp->sd_hash_bsize) { |
1741 | if (error >= 0) | 1751 | if (error >= 0) |
@@ -1859,6 +1869,7 @@ static int leaf_dealloc(struct gfs2_inode *dip, u32 index, u32 len, | |||
1859 | if (!dip->i_di.di_blocks) | 1869 | if (!dip->i_di.di_blocks) |
1860 | gfs2_consist_inode(dip); | 1870 | gfs2_consist_inode(dip); |
1861 | dip->i_di.di_blocks--; | 1871 | dip->i_di.di_blocks--; |
1872 | gfs2_set_inode_blocks(&dip->i_inode); | ||
1862 | } | 1873 | } |
1863 | 1874 | ||
1864 | error = gfs2_dir_write_data(dip, ht, index * sizeof(u64), size); | 1875 | error = gfs2_dir_write_data(dip, ht, index * sizeof(u64), size); |
@@ -1873,7 +1884,7 @@ static int leaf_dealloc(struct gfs2_inode *dip, u32 index, u32 len, | |||
1873 | goto out_end_trans; | 1884 | goto out_end_trans; |
1874 | 1885 | ||
1875 | gfs2_trans_add_bh(dip->i_gl, dibh, 1); | 1886 | gfs2_trans_add_bh(dip->i_gl, dibh, 1); |
1876 | gfs2_dinode_out(&dip->i_di, dibh->b_data); | 1887 | gfs2_dinode_out(dip, dibh->b_data); |
1877 | brelse(dibh); | 1888 | brelse(dibh); |
1878 | 1889 | ||
1879 | out_end_trans: | 1890 | out_end_trans: |