diff options
author | Al Viro <viro@zeniv.linux.org.uk> | 2006-10-14 10:46:30 -0400 |
---|---|---|
committer | Steven Whitehouse <swhiteho@redhat.com> | 2006-11-30 10:33:46 -0500 |
commit | b44b84d765b02f813a67b96bf79e3b5d4d621631 (patch) | |
tree | cc5353f1c7f4cacf8560d52c47f108333f179792 /fs/gfs2 | |
parent | b62f963e1fdf838fed91faec21228d421a834f2d (diff) |
[GFS2] gfs2 misc endianness annotations
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Signed-off-by: Steven Whitehouse <swhiteho@redhat.com>
Diffstat (limited to 'fs/gfs2')
-rw-r--r-- | fs/gfs2/bmap.c | 32 | ||||
-rw-r--r-- | fs/gfs2/dir.c | 24 | ||||
-rw-r--r-- | fs/gfs2/eattr.c | 27 | ||||
-rw-r--r-- | fs/gfs2/eattr.h | 6 | ||||
-rw-r--r-- | fs/gfs2/inode.c | 9 | ||||
-rw-r--r-- | fs/gfs2/ops_export.c | 30 | ||||
-rw-r--r-- | fs/gfs2/quota.c | 3 | ||||
-rw-r--r-- | fs/gfs2/util.h | 6 |
8 files changed, 66 insertions, 71 deletions
diff --git a/fs/gfs2/bmap.c b/fs/gfs2/bmap.c index 06e9a8cb45e..51f6356bdcb 100644 --- a/fs/gfs2/bmap.c +++ b/fs/gfs2/bmap.c | |||
@@ -38,8 +38,8 @@ struct metapath { | |||
38 | }; | 38 | }; |
39 | 39 | ||
40 | typedef int (*block_call_t) (struct gfs2_inode *ip, struct buffer_head *dibh, | 40 | typedef int (*block_call_t) (struct gfs2_inode *ip, struct buffer_head *dibh, |
41 | struct buffer_head *bh, u64 *top, | 41 | struct buffer_head *bh, __be64 *top, |
42 | u64 *bottom, unsigned int height, | 42 | __be64 *bottom, unsigned int height, |
43 | void *data); | 43 | void *data); |
44 | 44 | ||
45 | struct strip_mine { | 45 | struct strip_mine { |
@@ -230,7 +230,7 @@ static int build_height(struct inode *inode, unsigned height) | |||
230 | struct buffer_head *blocks[GFS2_MAX_META_HEIGHT]; | 230 | struct buffer_head *blocks[GFS2_MAX_META_HEIGHT]; |
231 | struct gfs2_dinode *di; | 231 | struct gfs2_dinode *di; |
232 | int error; | 232 | int error; |
233 | u64 *bp; | 233 | __be64 *bp; |
234 | u64 bn; | 234 | u64 bn; |
235 | unsigned n; | 235 | unsigned n; |
236 | 236 | ||
@@ -255,7 +255,7 @@ static int build_height(struct inode *inode, unsigned height) | |||
255 | GFS2_FORMAT_IN); | 255 | GFS2_FORMAT_IN); |
256 | gfs2_buffer_clear_tail(blocks[n], | 256 | gfs2_buffer_clear_tail(blocks[n], |
257 | sizeof(struct gfs2_meta_header)); | 257 | sizeof(struct gfs2_meta_header)); |
258 | bp = (u64 *)(blocks[n]->b_data + | 258 | bp = (__be64 *)(blocks[n]->b_data + |
259 | sizeof(struct gfs2_meta_header)); | 259 | sizeof(struct gfs2_meta_header)); |
260 | *bp = cpu_to_be64(blocks[n+1]->b_blocknr); | 260 | *bp = cpu_to_be64(blocks[n+1]->b_blocknr); |
261 | brelse(blocks[n]); | 261 | brelse(blocks[n]); |
@@ -360,15 +360,15 @@ static void find_metapath(struct gfs2_inode *ip, u64 block, | |||
360 | * metadata tree. | 360 | * metadata tree. |
361 | */ | 361 | */ |
362 | 362 | ||
363 | static inline u64 *metapointer(struct buffer_head *bh, int *boundary, | 363 | static inline __be64 *metapointer(struct buffer_head *bh, int *boundary, |
364 | unsigned int height, const struct metapath *mp) | 364 | unsigned int height, const struct metapath *mp) |
365 | { | 365 | { |
366 | unsigned int head_size = (height > 0) ? | 366 | unsigned int head_size = (height > 0) ? |
367 | sizeof(struct gfs2_meta_header) : sizeof(struct gfs2_dinode); | 367 | sizeof(struct gfs2_meta_header) : sizeof(struct gfs2_dinode); |
368 | u64 *ptr; | 368 | __be64 *ptr; |
369 | *boundary = 0; | 369 | *boundary = 0; |
370 | ptr = ((u64 *)(bh->b_data + head_size)) + mp->mp_list[height]; | 370 | ptr = ((__be64 *)(bh->b_data + head_size)) + mp->mp_list[height]; |
371 | if (ptr + 1 == (u64 *)(bh->b_data + bh->b_size)) | 371 | if (ptr + 1 == (__be64 *)(bh->b_data + bh->b_size)) |
372 | *boundary = 1; | 372 | *boundary = 1; |
373 | return ptr; | 373 | return ptr; |
374 | } | 374 | } |
@@ -394,7 +394,7 @@ static int lookup_block(struct gfs2_inode *ip, struct buffer_head *bh, | |||
394 | int *new, u64 *block) | 394 | int *new, u64 *block) |
395 | { | 395 | { |
396 | int boundary; | 396 | int boundary; |
397 | u64 *ptr = metapointer(bh, &boundary, height, mp); | 397 | __be64 *ptr = metapointer(bh, &boundary, height, mp); |
398 | 398 | ||
399 | if (*ptr) { | 399 | if (*ptr) { |
400 | *block = be64_to_cpu(*ptr); | 400 | *block = be64_to_cpu(*ptr); |
@@ -600,7 +600,7 @@ static int recursive_scan(struct gfs2_inode *ip, struct buffer_head *dibh, | |||
600 | { | 600 | { |
601 | struct gfs2_sbd *sdp = GFS2_SB(&ip->i_inode); | 601 | struct gfs2_sbd *sdp = GFS2_SB(&ip->i_inode); |
602 | struct buffer_head *bh = NULL; | 602 | struct buffer_head *bh = NULL; |
603 | u64 *top, *bottom; | 603 | __be64 *top, *bottom; |
604 | u64 bn; | 604 | u64 bn; |
605 | int error; | 605 | int error; |
606 | int mh_size = sizeof(struct gfs2_meta_header); | 606 | int mh_size = sizeof(struct gfs2_meta_header); |
@@ -611,17 +611,17 @@ static int recursive_scan(struct gfs2_inode *ip, struct buffer_head *dibh, | |||
611 | return error; | 611 | return error; |
612 | dibh = bh; | 612 | dibh = bh; |
613 | 613 | ||
614 | top = (u64 *)(bh->b_data + sizeof(struct gfs2_dinode)) + mp->mp_list[0]; | 614 | top = (__be64 *)(bh->b_data + sizeof(struct gfs2_dinode)) + mp->mp_list[0]; |
615 | bottom = (u64 *)(bh->b_data + sizeof(struct gfs2_dinode)) + sdp->sd_diptrs; | 615 | bottom = (__be64 *)(bh->b_data + sizeof(struct gfs2_dinode)) + sdp->sd_diptrs; |
616 | } else { | 616 | } else { |
617 | error = gfs2_meta_indirect_buffer(ip, height, block, 0, &bh); | 617 | error = gfs2_meta_indirect_buffer(ip, height, block, 0, &bh); |
618 | if (error) | 618 | if (error) |
619 | return error; | 619 | return error; |
620 | 620 | ||
621 | top = (u64 *)(bh->b_data + mh_size) + | 621 | top = (__be64 *)(bh->b_data + mh_size) + |
622 | (first ? mp->mp_list[height] : 0); | 622 | (first ? mp->mp_list[height] : 0); |
623 | 623 | ||
624 | bottom = (u64 *)(bh->b_data + mh_size) + sdp->sd_inptrs; | 624 | bottom = (__be64 *)(bh->b_data + mh_size) + sdp->sd_inptrs; |
625 | } | 625 | } |
626 | 626 | ||
627 | error = bc(ip, dibh, bh, top, bottom, height, data); | 627 | error = bc(ip, dibh, bh, top, bottom, height, data); |
@@ -660,7 +660,7 @@ out: | |||
660 | */ | 660 | */ |
661 | 661 | ||
662 | static int do_strip(struct gfs2_inode *ip, struct buffer_head *dibh, | 662 | static int do_strip(struct gfs2_inode *ip, struct buffer_head *dibh, |
663 | struct buffer_head *bh, u64 *top, u64 *bottom, | 663 | struct buffer_head *bh, __be64 *top, __be64 *bottom, |
664 | unsigned int height, void *data) | 664 | unsigned int height, void *data) |
665 | { | 665 | { |
666 | struct strip_mine *sm = data; | 666 | struct strip_mine *sm = data; |
@@ -668,7 +668,7 @@ static int do_strip(struct gfs2_inode *ip, struct buffer_head *dibh, | |||
668 | struct gfs2_rgrp_list rlist; | 668 | struct gfs2_rgrp_list rlist; |
669 | u64 bn, bstart; | 669 | u64 bn, bstart; |
670 | u32 blen; | 670 | u32 blen; |
671 | u64 *p; | 671 | __be64 *p; |
672 | unsigned int rg_blocks = 0; | 672 | unsigned int rg_blocks = 0; |
673 | int metadata; | 673 | int metadata; |
674 | unsigned int revokes = 0; | 674 | unsigned int revokes = 0; |
diff --git a/fs/gfs2/dir.c b/fs/gfs2/dir.c index d67a3760ca3..59dc823c283 100644 --- a/fs/gfs2/dir.c +++ b/fs/gfs2/dir.c | |||
@@ -713,12 +713,12 @@ static int get_leaf(struct gfs2_inode *dip, u64 leaf_no, | |||
713 | static int get_leaf_nr(struct gfs2_inode *dip, u32 index, | 713 | static int get_leaf_nr(struct gfs2_inode *dip, u32 index, |
714 | u64 *leaf_out) | 714 | u64 *leaf_out) |
715 | { | 715 | { |
716 | u64 leaf_no; | 716 | __be64 leaf_no; |
717 | int error; | 717 | int error; |
718 | 718 | ||
719 | error = gfs2_dir_read_data(dip, (char *)&leaf_no, | 719 | error = gfs2_dir_read_data(dip, (char *)&leaf_no, |
720 | index * sizeof(u64), | 720 | index * sizeof(__be64), |
721 | sizeof(u64), 0); | 721 | sizeof(__be64), 0); |
722 | if (error != sizeof(u64)) | 722 | if (error != sizeof(u64)) |
723 | return (error < 0) ? error : -EIO; | 723 | return (error < 0) ? error : -EIO; |
724 | 724 | ||
@@ -837,7 +837,8 @@ static int dir_make_exhash(struct inode *inode) | |||
837 | struct gfs2_leaf *leaf; | 837 | struct gfs2_leaf *leaf; |
838 | int y; | 838 | int y; |
839 | u32 x; | 839 | u32 x; |
840 | u64 *lp, bn; | 840 | __be64 *lp; |
841 | u64 bn; | ||
841 | int error; | 842 | int error; |
842 | 843 | ||
843 | error = gfs2_meta_inode_buffer(dip, &dibh); | 844 | error = gfs2_meta_inode_buffer(dip, &dibh); |
@@ -893,7 +894,7 @@ static int dir_make_exhash(struct inode *inode) | |||
893 | gfs2_trans_add_bh(dip->i_gl, dibh, 1); | 894 | gfs2_trans_add_bh(dip->i_gl, dibh, 1); |
894 | gfs2_buffer_clear_tail(dibh, sizeof(struct gfs2_dinode)); | 895 | gfs2_buffer_clear_tail(dibh, sizeof(struct gfs2_dinode)); |
895 | 896 | ||
896 | lp = (u64 *)(dibh->b_data + sizeof(struct gfs2_dinode)); | 897 | lp = (__be64 *)(dibh->b_data + sizeof(struct gfs2_dinode)); |
897 | 898 | ||
898 | for (x = sdp->sd_hash_ptrs; x--; lp++) | 899 | for (x = sdp->sd_hash_ptrs; x--; lp++) |
899 | *lp = cpu_to_be64(bn); | 900 | *lp = cpu_to_be64(bn); |
@@ -929,7 +930,8 @@ static int dir_split_leaf(struct inode *inode, const struct qstr *name) | |||
929 | struct gfs2_leaf *nleaf, *oleaf; | 930 | struct gfs2_leaf *nleaf, *oleaf; |
930 | struct gfs2_dirent *dent = NULL, *prev = NULL, *next = NULL, *new; | 931 | struct gfs2_dirent *dent = NULL, *prev = NULL, *next = NULL, *new; |
931 | u32 start, len, half_len, divider; | 932 | u32 start, len, half_len, divider; |
932 | u64 bn, *lp, leaf_no; | 933 | u64 bn, leaf_no; |
934 | __be64 *lp; | ||
933 | u32 index; | 935 | u32 index; |
934 | int x, moved = 0; | 936 | int x, moved = 0; |
935 | int error; | 937 | int error; |
@@ -974,7 +976,7 @@ static int dir_split_leaf(struct inode *inode, const struct qstr *name) | |||
974 | /* Change the pointers. | 976 | /* Change the pointers. |
975 | Don't bother distinguishing stuffed from non-stuffed. | 977 | Don't bother distinguishing stuffed from non-stuffed. |
976 | This code is complicated enough already. */ | 978 | This code is complicated enough already. */ |
977 | lp = kmalloc(half_len * sizeof(u64), GFP_NOFS | __GFP_NOFAIL); | 979 | lp = kmalloc(half_len * sizeof(__be64), GFP_NOFS | __GFP_NOFAIL); |
978 | /* Change the pointers */ | 980 | /* Change the pointers */ |
979 | for (x = 0; x < half_len; x++) | 981 | for (x = 0; x < half_len; x++) |
980 | lp[x] = cpu_to_be64(bn); | 982 | lp[x] = cpu_to_be64(bn); |
@@ -1341,7 +1343,7 @@ static int dir_e_read(struct inode *inode, u64 *offset, void *opaque, | |||
1341 | u32 hsize, len = 0; | 1343 | u32 hsize, len = 0; |
1342 | u32 ht_offset, lp_offset, ht_offset_cur = -1; | 1344 | u32 ht_offset, lp_offset, ht_offset_cur = -1; |
1343 | u32 hash, index; | 1345 | u32 hash, index; |
1344 | u64 *lp; | 1346 | __be64 *lp; |
1345 | int copied = 0; | 1347 | int copied = 0; |
1346 | int error = 0; | 1348 | int error = 0; |
1347 | unsigned depth = 0; | 1349 | unsigned depth = 0; |
@@ -1365,7 +1367,7 @@ static int dir_e_read(struct inode *inode, u64 *offset, void *opaque, | |||
1365 | 1367 | ||
1366 | if (ht_offset_cur != ht_offset) { | 1368 | if (ht_offset_cur != ht_offset) { |
1367 | error = gfs2_dir_read_data(dip, (char *)lp, | 1369 | error = gfs2_dir_read_data(dip, (char *)lp, |
1368 | ht_offset * sizeof(u64), | 1370 | ht_offset * sizeof(__be64), |
1369 | sdp->sd_hash_bsize, 1); | 1371 | sdp->sd_hash_bsize, 1); |
1370 | if (error != sdp->sd_hash_bsize) { | 1372 | if (error != sdp->sd_hash_bsize) { |
1371 | if (error >= 0) | 1373 | if (error >= 0) |
@@ -1715,7 +1717,7 @@ static int foreach_leaf(struct gfs2_inode *dip, leaf_call_t lc, void *data) | |||
1715 | u32 hsize, len; | 1717 | u32 hsize, len; |
1716 | u32 ht_offset, lp_offset, ht_offset_cur = -1; | 1718 | u32 ht_offset, lp_offset, ht_offset_cur = -1; |
1717 | u32 index = 0; | 1719 | u32 index = 0; |
1718 | u64 *lp; | 1720 | __be64 *lp; |
1719 | u64 leaf_no; | 1721 | u64 leaf_no; |
1720 | int error = 0; | 1722 | int error = 0; |
1721 | 1723 | ||
@@ -1735,7 +1737,7 @@ static int foreach_leaf(struct gfs2_inode *dip, leaf_call_t lc, void *data) | |||
1735 | 1737 | ||
1736 | if (ht_offset_cur != ht_offset) { | 1738 | if (ht_offset_cur != ht_offset) { |
1737 | error = gfs2_dir_read_data(dip, (char *)lp, | 1739 | error = gfs2_dir_read_data(dip, (char *)lp, |
1738 | ht_offset * sizeof(u64), | 1740 | ht_offset * sizeof(__be64), |
1739 | sdp->sd_hash_bsize, 1); | 1741 | sdp->sd_hash_bsize, 1); |
1740 | if (error != sdp->sd_hash_bsize) { | 1742 | if (error != sdp->sd_hash_bsize) { |
1741 | if (error >= 0) | 1743 | if (error >= 0) |
diff --git a/fs/gfs2/eattr.c b/fs/gfs2/eattr.c index a65a4ccfd4d..518f0c0786c 100644 --- a/fs/gfs2/eattr.c +++ b/fs/gfs2/eattr.c | |||
@@ -112,7 +112,7 @@ fail: | |||
112 | static int ea_foreach(struct gfs2_inode *ip, ea_call_t ea_call, void *data) | 112 | static int ea_foreach(struct gfs2_inode *ip, ea_call_t ea_call, void *data) |
113 | { | 113 | { |
114 | struct buffer_head *bh, *eabh; | 114 | struct buffer_head *bh, *eabh; |
115 | u64 *eablk, *end; | 115 | __be64 *eablk, *end; |
116 | int error; | 116 | int error; |
117 | 117 | ||
118 | error = gfs2_meta_read(ip->i_gl, ip->i_di.di_eattr, DIO_WAIT, &bh); | 118 | error = gfs2_meta_read(ip->i_gl, ip->i_di.di_eattr, DIO_WAIT, &bh); |
@@ -129,7 +129,7 @@ static int ea_foreach(struct gfs2_inode *ip, ea_call_t ea_call, void *data) | |||
129 | goto out; | 129 | goto out; |
130 | } | 130 | } |
131 | 131 | ||
132 | eablk = (u64 *)(bh->b_data + sizeof(struct gfs2_meta_header)); | 132 | eablk = (__be64 *)(bh->b_data + sizeof(struct gfs2_meta_header)); |
133 | end = eablk + GFS2_SB(&ip->i_inode)->sd_inptrs; | 133 | end = eablk + GFS2_SB(&ip->i_inode)->sd_inptrs; |
134 | 134 | ||
135 | for (; eablk < end; eablk++) { | 135 | for (; eablk < end; eablk++) { |
@@ -224,7 +224,8 @@ static int ea_dealloc_unstuffed(struct gfs2_inode *ip, struct buffer_head *bh, | |||
224 | struct gfs2_rgrpd *rgd; | 224 | struct gfs2_rgrpd *rgd; |
225 | struct gfs2_holder rg_gh; | 225 | struct gfs2_holder rg_gh; |
226 | struct buffer_head *dibh; | 226 | struct buffer_head *dibh; |
227 | u64 *dataptrs, bn = 0; | 227 | __be64 *dataptrs; |
228 | u64 bn = 0; | ||
228 | u64 bstart = 0; | 229 | u64 bstart = 0; |
229 | unsigned int blen = 0; | 230 | unsigned int blen = 0; |
230 | unsigned int blks = 0; | 231 | unsigned int blks = 0; |
@@ -444,7 +445,7 @@ static int ea_get_unstuffed(struct gfs2_inode *ip, struct gfs2_ea_header *ea, | |||
444 | struct buffer_head **bh; | 445 | struct buffer_head **bh; |
445 | unsigned int amount = GFS2_EA_DATA_LEN(ea); | 446 | unsigned int amount = GFS2_EA_DATA_LEN(ea); |
446 | unsigned int nptrs = DIV_ROUND_UP(amount, sdp->sd_jbsize); | 447 | unsigned int nptrs = DIV_ROUND_UP(amount, sdp->sd_jbsize); |
447 | u64 *dataptrs = GFS2_EA2DATAPTRS(ea); | 448 | __be64 *dataptrs = GFS2_EA2DATAPTRS(ea); |
448 | unsigned int x; | 449 | unsigned int x; |
449 | int error = 0; | 450 | int error = 0; |
450 | 451 | ||
@@ -629,7 +630,7 @@ static int ea_write(struct gfs2_inode *ip, struct gfs2_ea_header *ea, | |||
629 | ea->ea_num_ptrs = 0; | 630 | ea->ea_num_ptrs = 0; |
630 | memcpy(GFS2_EA2DATA(ea), er->er_data, er->er_data_len); | 631 | memcpy(GFS2_EA2DATA(ea), er->er_data, er->er_data_len); |
631 | } else { | 632 | } else { |
632 | u64 *dataptr = GFS2_EA2DATAPTRS(ea); | 633 | __be64 *dataptr = GFS2_EA2DATAPTRS(ea); |
633 | const char *data = er->er_data; | 634 | const char *data = er->er_data; |
634 | unsigned int data_len = er->er_data_len; | 635 | unsigned int data_len = er->er_data_len; |
635 | unsigned int copy; | 636 | unsigned int copy; |
@@ -931,12 +932,12 @@ static int ea_set_block(struct gfs2_inode *ip, struct gfs2_ea_request *er, | |||
931 | { | 932 | { |
932 | struct gfs2_sbd *sdp = GFS2_SB(&ip->i_inode); | 933 | struct gfs2_sbd *sdp = GFS2_SB(&ip->i_inode); |
933 | struct buffer_head *indbh, *newbh; | 934 | struct buffer_head *indbh, *newbh; |
934 | u64 *eablk; | 935 | __be64 *eablk; |
935 | int error; | 936 | int error; |
936 | int mh_size = sizeof(struct gfs2_meta_header); | 937 | int mh_size = sizeof(struct gfs2_meta_header); |
937 | 938 | ||
938 | if (ip->i_di.di_flags & GFS2_DIF_EA_INDIRECT) { | 939 | if (ip->i_di.di_flags & GFS2_DIF_EA_INDIRECT) { |
939 | u64 *end; | 940 | __be64 *end; |
940 | 941 | ||
941 | error = gfs2_meta_read(ip->i_gl, ip->i_di.di_eattr, DIO_WAIT, | 942 | error = gfs2_meta_read(ip->i_gl, ip->i_di.di_eattr, DIO_WAIT, |
942 | &indbh); | 943 | &indbh); |
@@ -948,7 +949,7 @@ static int ea_set_block(struct gfs2_inode *ip, struct gfs2_ea_request *er, | |||
948 | goto out; | 949 | goto out; |
949 | } | 950 | } |
950 | 951 | ||
951 | eablk = (u64 *)(indbh->b_data + mh_size); | 952 | eablk = (__be64 *)(indbh->b_data + mh_size); |
952 | end = eablk + sdp->sd_inptrs; | 953 | end = eablk + sdp->sd_inptrs; |
953 | 954 | ||
954 | for (; eablk < end; eablk++) | 955 | for (; eablk < end; eablk++) |
@@ -971,7 +972,7 @@ static int ea_set_block(struct gfs2_inode *ip, struct gfs2_ea_request *er, | |||
971 | gfs2_metatype_set(indbh, GFS2_METATYPE_IN, GFS2_FORMAT_IN); | 972 | gfs2_metatype_set(indbh, GFS2_METATYPE_IN, GFS2_FORMAT_IN); |
972 | gfs2_buffer_clear_tail(indbh, mh_size); | 973 | gfs2_buffer_clear_tail(indbh, mh_size); |
973 | 974 | ||
974 | eablk = (u64 *)(indbh->b_data + mh_size); | 975 | eablk = (__be64 *)(indbh->b_data + mh_size); |
975 | *eablk = cpu_to_be64(ip->i_di.di_eattr); | 976 | *eablk = cpu_to_be64(ip->i_di.di_eattr); |
976 | ip->i_di.di_eattr = blk; | 977 | ip->i_di.di_eattr = blk; |
977 | ip->i_di.di_flags |= GFS2_DIF_EA_INDIRECT; | 978 | ip->i_di.di_flags |= GFS2_DIF_EA_INDIRECT; |
@@ -1202,7 +1203,7 @@ static int ea_acl_chmod_unstuffed(struct gfs2_inode *ip, | |||
1202 | struct buffer_head **bh; | 1203 | struct buffer_head **bh; |
1203 | unsigned int amount = GFS2_EA_DATA_LEN(ea); | 1204 | unsigned int amount = GFS2_EA_DATA_LEN(ea); |
1204 | unsigned int nptrs = DIV_ROUND_UP(amount, sdp->sd_jbsize); | 1205 | unsigned int nptrs = DIV_ROUND_UP(amount, sdp->sd_jbsize); |
1205 | u64 *dataptrs = GFS2_EA2DATAPTRS(ea); | 1206 | __be64 *dataptrs = GFS2_EA2DATAPTRS(ea); |
1206 | unsigned int x; | 1207 | unsigned int x; |
1207 | int error; | 1208 | int error; |
1208 | 1209 | ||
@@ -1300,7 +1301,7 @@ static int ea_dealloc_indirect(struct gfs2_inode *ip) | |||
1300 | struct gfs2_sbd *sdp = GFS2_SB(&ip->i_inode); | 1301 | struct gfs2_sbd *sdp = GFS2_SB(&ip->i_inode); |
1301 | struct gfs2_rgrp_list rlist; | 1302 | struct gfs2_rgrp_list rlist; |
1302 | struct buffer_head *indbh, *dibh; | 1303 | struct buffer_head *indbh, *dibh; |
1303 | u64 *eablk, *end; | 1304 | __be64 *eablk, *end; |
1304 | unsigned int rg_blocks = 0; | 1305 | unsigned int rg_blocks = 0; |
1305 | u64 bstart = 0; | 1306 | u64 bstart = 0; |
1306 | unsigned int blen = 0; | 1307 | unsigned int blen = 0; |
@@ -1319,7 +1320,7 @@ static int ea_dealloc_indirect(struct gfs2_inode *ip) | |||
1319 | goto out; | 1320 | goto out; |
1320 | } | 1321 | } |
1321 | 1322 | ||
1322 | eablk = (u64 *)(indbh->b_data + sizeof(struct gfs2_meta_header)); | 1323 | eablk = (__be64 *)(indbh->b_data + sizeof(struct gfs2_meta_header)); |
1323 | end = eablk + sdp->sd_inptrs; | 1324 | end = eablk + sdp->sd_inptrs; |
1324 | 1325 | ||
1325 | for (; eablk < end; eablk++) { | 1326 | for (; eablk < end; eablk++) { |
@@ -1363,7 +1364,7 @@ static int ea_dealloc_indirect(struct gfs2_inode *ip) | |||
1363 | 1364 | ||
1364 | gfs2_trans_add_bh(ip->i_gl, indbh, 1); | 1365 | gfs2_trans_add_bh(ip->i_gl, indbh, 1); |
1365 | 1366 | ||
1366 | eablk = (u64 *)(indbh->b_data + sizeof(struct gfs2_meta_header)); | 1367 | eablk = (__be64 *)(indbh->b_data + sizeof(struct gfs2_meta_header)); |
1367 | bstart = 0; | 1368 | bstart = 0; |
1368 | blen = 0; | 1369 | blen = 0; |
1369 | 1370 | ||
diff --git a/fs/gfs2/eattr.h b/fs/gfs2/eattr.h index ffa65947d68..c82dbe01d71 100644 --- a/fs/gfs2/eattr.h +++ b/fs/gfs2/eattr.h | |||
@@ -19,7 +19,7 @@ struct iattr; | |||
19 | #define GFS2_EA_SIZE(ea) \ | 19 | #define GFS2_EA_SIZE(ea) \ |
20 | ALIGN(sizeof(struct gfs2_ea_header) + (ea)->ea_name_len + \ | 20 | ALIGN(sizeof(struct gfs2_ea_header) + (ea)->ea_name_len + \ |
21 | ((GFS2_EA_IS_STUFFED(ea)) ? GFS2_EA_DATA_LEN(ea) : \ | 21 | ((GFS2_EA_IS_STUFFED(ea)) ? GFS2_EA_DATA_LEN(ea) : \ |
22 | (sizeof(u64) * (ea)->ea_num_ptrs)), 8) | 22 | (sizeof(__be64) * (ea)->ea_num_ptrs)), 8) |
23 | 23 | ||
24 | #define GFS2_EA_IS_STUFFED(ea) (!(ea)->ea_num_ptrs) | 24 | #define GFS2_EA_IS_STUFFED(ea) (!(ea)->ea_num_ptrs) |
25 | #define GFS2_EA_IS_LAST(ea) ((ea)->ea_flags & GFS2_EAFLAG_LAST) | 25 | #define GFS2_EA_IS_LAST(ea) ((ea)->ea_flags & GFS2_EAFLAG_LAST) |
@@ -29,13 +29,13 @@ ALIGN(sizeof(struct gfs2_ea_header) + (er)->er_name_len + (er)->er_data_len, 8) | |||
29 | 29 | ||
30 | #define GFS2_EAREQ_SIZE_UNSTUFFED(sdp, er) \ | 30 | #define GFS2_EAREQ_SIZE_UNSTUFFED(sdp, er) \ |
31 | ALIGN(sizeof(struct gfs2_ea_header) + (er)->er_name_len + \ | 31 | ALIGN(sizeof(struct gfs2_ea_header) + (er)->er_name_len + \ |
32 | sizeof(u64) * DIV_ROUND_UP((er)->er_data_len, (sdp)->sd_jbsize), 8) | 32 | sizeof(__be64) * DIV_ROUND_UP((er)->er_data_len, (sdp)->sd_jbsize), 8) |
33 | 33 | ||
34 | #define GFS2_EA2NAME(ea) ((char *)((struct gfs2_ea_header *)(ea) + 1)) | 34 | #define GFS2_EA2NAME(ea) ((char *)((struct gfs2_ea_header *)(ea) + 1)) |
35 | #define GFS2_EA2DATA(ea) (GFS2_EA2NAME(ea) + (ea)->ea_name_len) | 35 | #define GFS2_EA2DATA(ea) (GFS2_EA2NAME(ea) + (ea)->ea_name_len) |
36 | 36 | ||
37 | #define GFS2_EA2DATAPTRS(ea) \ | 37 | #define GFS2_EA2DATAPTRS(ea) \ |
38 | ((u64 *)(GFS2_EA2NAME(ea) + ALIGN((ea)->ea_name_len, 8))) | 38 | ((__be64 *)(GFS2_EA2NAME(ea) + ALIGN((ea)->ea_name_len, 8))) |
39 | 39 | ||
40 | #define GFS2_EA2NEXT(ea) \ | 40 | #define GFS2_EA2NEXT(ea) \ |
41 | ((struct gfs2_ea_header *)((char *)(ea) + GFS2_EA_REC_LEN(ea))) | 41 | ((struct gfs2_ea_header *)((char *)(ea) + GFS2_EA_REC_LEN(ea))) |
diff --git a/fs/gfs2/inode.c b/fs/gfs2/inode.c index dadd1f35c86..fb969302f18 100644 --- a/fs/gfs2/inode.c +++ b/fs/gfs2/inode.c | |||
@@ -500,21 +500,22 @@ static int pick_formal_ino_2(struct gfs2_sbd *sdp, u64 *formal_ino) | |||
500 | if (!ir.ir_length) { | 500 | if (!ir.ir_length) { |
501 | struct buffer_head *m_bh; | 501 | struct buffer_head *m_bh; |
502 | u64 x, y; | 502 | u64 x, y; |
503 | __be64 z; | ||
503 | 504 | ||
504 | error = gfs2_meta_inode_buffer(m_ip, &m_bh); | 505 | error = gfs2_meta_inode_buffer(m_ip, &m_bh); |
505 | if (error) | 506 | if (error) |
506 | goto out_brelse; | 507 | goto out_brelse; |
507 | 508 | ||
508 | x = *(u64 *)(m_bh->b_data + sizeof(struct gfs2_dinode)); | 509 | z = *(__be64 *)(m_bh->b_data + sizeof(struct gfs2_dinode)); |
509 | x = y = be64_to_cpu(x); | 510 | x = y = be64_to_cpu(z); |
510 | ir.ir_start = x; | 511 | ir.ir_start = x; |
511 | ir.ir_length = GFS2_INUM_QUANTUM; | 512 | ir.ir_length = GFS2_INUM_QUANTUM; |
512 | x += GFS2_INUM_QUANTUM; | 513 | x += GFS2_INUM_QUANTUM; |
513 | if (x < y) | 514 | if (x < y) |
514 | gfs2_consist_inode(m_ip); | 515 | gfs2_consist_inode(m_ip); |
515 | x = cpu_to_be64(x); | 516 | z = cpu_to_be64(x); |
516 | gfs2_trans_add_bh(m_ip->i_gl, m_bh, 1); | 517 | gfs2_trans_add_bh(m_ip->i_gl, m_bh, 1); |
517 | *(u64 *)(m_bh->b_data + sizeof(struct gfs2_dinode)) = x; | 518 | *(__be64 *)(m_bh->b_data + sizeof(struct gfs2_dinode)) = z; |
518 | 519 | ||
519 | brelse(m_bh); | 520 | brelse(m_bh); |
520 | } | 521 | } |
diff --git a/fs/gfs2/ops_export.c b/fs/gfs2/ops_export.c index 33423a5c329..b4e7b877531 100644 --- a/fs/gfs2/ops_export.c +++ b/fs/gfs2/ops_export.c | |||
@@ -27,13 +27,14 @@ | |||
27 | #include "util.h" | 27 | #include "util.h" |
28 | 28 | ||
29 | static struct dentry *gfs2_decode_fh(struct super_block *sb, | 29 | static struct dentry *gfs2_decode_fh(struct super_block *sb, |
30 | __u32 *fh, | 30 | __u32 *p, |
31 | int fh_len, | 31 | int fh_len, |
32 | int fh_type, | 32 | int fh_type, |
33 | int (*acceptable)(void *context, | 33 | int (*acceptable)(void *context, |
34 | struct dentry *dentry), | 34 | struct dentry *dentry), |
35 | void *context) | 35 | void *context) |
36 | { | 36 | { |
37 | __be32 *fh = (__force __be32 *)p; | ||
37 | struct gfs2_fh_obj fh_obj; | 38 | struct gfs2_fh_obj fh_obj; |
38 | struct gfs2_inum_host *this, parent; | 39 | struct gfs2_inum_host *this, parent; |
39 | 40 | ||
@@ -65,9 +66,10 @@ static struct dentry *gfs2_decode_fh(struct super_block *sb, | |||
65 | acceptable, context); | 66 | acceptable, context); |
66 | } | 67 | } |
67 | 68 | ||
68 | static int gfs2_encode_fh(struct dentry *dentry, __u32 *fh, int *len, | 69 | static int gfs2_encode_fh(struct dentry *dentry, __u32 *p, int *len, |
69 | int connectable) | 70 | int connectable) |
70 | { | 71 | { |
72 | __be32 *fh = (__force __be32 *)p; | ||
71 | struct inode *inode = dentry->d_inode; | 73 | struct inode *inode = dentry->d_inode; |
72 | struct super_block *sb = inode->i_sb; | 74 | struct super_block *sb = inode->i_sb; |
73 | struct gfs2_inode *ip = GFS2_I(inode); | 75 | struct gfs2_inode *ip = GFS2_I(inode); |
@@ -76,14 +78,10 @@ static int gfs2_encode_fh(struct dentry *dentry, __u32 *fh, int *len, | |||
76 | (connectable && *len < GFS2_LARGE_FH_SIZE)) | 78 | (connectable && *len < GFS2_LARGE_FH_SIZE)) |
77 | return 255; | 79 | return 255; |
78 | 80 | ||
79 | fh[0] = ip->i_num.no_formal_ino >> 32; | 81 | fh[0] = cpu_to_be32(ip->i_num.no_formal_ino >> 32); |
80 | fh[0] = cpu_to_be32(fh[0]); | 82 | fh[1] = cpu_to_be32(ip->i_num.no_formal_ino & 0xFFFFFFFF); |
81 | fh[1] = ip->i_num.no_formal_ino & 0xFFFFFFFF; | 83 | fh[2] = cpu_to_be32(ip->i_num.no_addr >> 32); |
82 | fh[1] = cpu_to_be32(fh[1]); | 84 | fh[3] = cpu_to_be32(ip->i_num.no_addr & 0xFFFFFFFF); |
83 | fh[2] = ip->i_num.no_addr >> 32; | ||
84 | fh[2] = cpu_to_be32(fh[2]); | ||
85 | fh[3] = ip->i_num.no_addr & 0xFFFFFFFF; | ||
86 | fh[3] = cpu_to_be32(fh[3]); | ||
87 | *len = GFS2_SMALL_FH_SIZE; | 85 | *len = GFS2_SMALL_FH_SIZE; |
88 | 86 | ||
89 | if (!connectable || inode == sb->s_root->d_inode) | 87 | if (!connectable || inode == sb->s_root->d_inode) |
@@ -95,14 +93,10 @@ static int gfs2_encode_fh(struct dentry *dentry, __u32 *fh, int *len, | |||
95 | igrab(inode); | 93 | igrab(inode); |
96 | spin_unlock(&dentry->d_lock); | 94 | spin_unlock(&dentry->d_lock); |
97 | 95 | ||
98 | fh[4] = ip->i_num.no_formal_ino >> 32; | 96 | fh[4] = cpu_to_be32(ip->i_num.no_formal_ino >> 32); |
99 | fh[4] = cpu_to_be32(fh[4]); | 97 | fh[5] = cpu_to_be32(ip->i_num.no_formal_ino & 0xFFFFFFFF); |
100 | fh[5] = ip->i_num.no_formal_ino & 0xFFFFFFFF; | 98 | fh[6] = cpu_to_be32(ip->i_num.no_addr >> 32); |
101 | fh[5] = cpu_to_be32(fh[5]); | 99 | fh[7] = cpu_to_be32(ip->i_num.no_addr & 0xFFFFFFFF); |
102 | fh[6] = ip->i_num.no_addr >> 32; | ||
103 | fh[6] = cpu_to_be32(fh[6]); | ||
104 | fh[7] = ip->i_num.no_addr & 0xFFFFFFFF; | ||
105 | fh[7] = cpu_to_be32(fh[7]); | ||
106 | 100 | ||
107 | fh[8] = cpu_to_be32(inode->i_mode); | 101 | fh[8] = cpu_to_be32(inode->i_mode); |
108 | fh[9] = 0; /* pad to double word */ | 102 | fh[9] = 0; /* pad to double word */ |
diff --git a/fs/gfs2/quota.c b/fs/gfs2/quota.c index 009d86c0008..5d00e9b2097 100644 --- a/fs/gfs2/quota.c +++ b/fs/gfs2/quota.c | |||
@@ -539,8 +539,7 @@ static void do_qc(struct gfs2_quota_data *qd, s64 change) | |||
539 | qc->qc_id = cpu_to_be32(qd->qd_id); | 539 | qc->qc_id = cpu_to_be32(qd->qd_id); |
540 | } | 540 | } |
541 | 541 | ||
542 | x = qc->qc_change; | 542 | x = be64_to_cpu(qc->qc_change) + change; |
543 | x = be64_to_cpu(x) + change; | ||
544 | qc->qc_change = cpu_to_be64(x); | 543 | qc->qc_change = cpu_to_be64(x); |
545 | 544 | ||
546 | spin_lock(&sdp->sd_quota_spin); | 545 | spin_lock(&sdp->sd_quota_spin); |
diff --git a/fs/gfs2/util.h b/fs/gfs2/util.h index 76a50899fe9..ca8667c3ed0 100644 --- a/fs/gfs2/util.h +++ b/fs/gfs2/util.h | |||
@@ -83,8 +83,7 @@ static inline int gfs2_meta_check_i(struct gfs2_sbd *sdp, | |||
83 | char *file, unsigned int line) | 83 | char *file, unsigned int line) |
84 | { | 84 | { |
85 | struct gfs2_meta_header *mh = (struct gfs2_meta_header *)bh->b_data; | 85 | struct gfs2_meta_header *mh = (struct gfs2_meta_header *)bh->b_data; |
86 | u32 magic = mh->mh_magic; | 86 | u32 magic = be32_to_cpu(mh->mh_magic); |
87 | magic = be32_to_cpu(magic); | ||
88 | if (unlikely(magic != GFS2_MAGIC)) | 87 | if (unlikely(magic != GFS2_MAGIC)) |
89 | return gfs2_meta_check_ii(sdp, bh, "magic number", function, | 88 | return gfs2_meta_check_ii(sdp, bh, "magic number", function, |
90 | file, line); | 89 | file, line); |
@@ -107,9 +106,8 @@ static inline int gfs2_metatype_check_i(struct gfs2_sbd *sdp, | |||
107 | char *file, unsigned int line) | 106 | char *file, unsigned int line) |
108 | { | 107 | { |
109 | struct gfs2_meta_header *mh = (struct gfs2_meta_header *)bh->b_data; | 108 | struct gfs2_meta_header *mh = (struct gfs2_meta_header *)bh->b_data; |
110 | u32 magic = mh->mh_magic; | 109 | u32 magic = be32_to_cpu(mh->mh_magic); |
111 | u16 t = be32_to_cpu(mh->mh_type); | 110 | u16 t = be32_to_cpu(mh->mh_type); |
112 | magic = be32_to_cpu(magic); | ||
113 | if (unlikely(magic != GFS2_MAGIC)) | 111 | if (unlikely(magic != GFS2_MAGIC)) |
114 | return gfs2_meta_check_ii(sdp, bh, "magic number", function, | 112 | return gfs2_meta_check_ii(sdp, bh, "magic number", function, |
115 | file, line); | 113 | file, line); |