aboutsummaryrefslogtreecommitdiffstats
path: root/fs/gfs2/eattr.c
diff options
context:
space:
mode:
Diffstat (limited to 'fs/gfs2/eattr.c')
-rw-r--r--fs/gfs2/eattr.c66
1 files changed, 36 insertions, 30 deletions
diff --git a/fs/gfs2/eattr.c b/fs/gfs2/eattr.c
index a65a4ccfd4dd..ebebbdcd7057 100644
--- a/fs/gfs2/eattr.c
+++ b/fs/gfs2/eattr.c
@@ -112,7 +112,7 @@ fail:
112static int ea_foreach(struct gfs2_inode *ip, ea_call_t ea_call, void *data) 112static 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;
@@ -280,6 +281,7 @@ static int ea_dealloc_unstuffed(struct gfs2_inode *ip, struct buffer_head *bh,
280 if (!ip->i_di.di_blocks) 281 if (!ip->i_di.di_blocks)
281 gfs2_consist_inode(ip); 282 gfs2_consist_inode(ip);
282 ip->i_di.di_blocks--; 283 ip->i_di.di_blocks--;
284 gfs2_set_inode_blocks(&ip->i_inode);
283 } 285 }
284 if (bstart) 286 if (bstart)
285 gfs2_free_meta(ip, bstart, blen); 287 gfs2_free_meta(ip, bstart, blen);
@@ -299,9 +301,9 @@ static int ea_dealloc_unstuffed(struct gfs2_inode *ip, struct buffer_head *bh,
299 301
300 error = gfs2_meta_inode_buffer(ip, &dibh); 302 error = gfs2_meta_inode_buffer(ip, &dibh);
301 if (!error) { 303 if (!error) {
302 ip->i_di.di_ctime = get_seconds(); 304 ip->i_inode.i_ctime.tv_sec = get_seconds();
303 gfs2_trans_add_bh(ip->i_gl, dibh, 1); 305 gfs2_trans_add_bh(ip->i_gl, dibh, 1);
304 gfs2_dinode_out(&ip->i_di, dibh->b_data); 306 gfs2_dinode_out(ip, dibh->b_data);
305 brelse(dibh); 307 brelse(dibh);
306 } 308 }
307 309
@@ -444,7 +446,7 @@ static int ea_get_unstuffed(struct gfs2_inode *ip, struct gfs2_ea_header *ea,
444 struct buffer_head **bh; 446 struct buffer_head **bh;
445 unsigned int amount = GFS2_EA_DATA_LEN(ea); 447 unsigned int amount = GFS2_EA_DATA_LEN(ea);
446 unsigned int nptrs = DIV_ROUND_UP(amount, sdp->sd_jbsize); 448 unsigned int nptrs = DIV_ROUND_UP(amount, sdp->sd_jbsize);
447 u64 *dataptrs = GFS2_EA2DATAPTRS(ea); 449 __be64 *dataptrs = GFS2_EA2DATAPTRS(ea);
448 unsigned int x; 450 unsigned int x;
449 int error = 0; 451 int error = 0;
450 452
@@ -597,6 +599,7 @@ static int ea_alloc_blk(struct gfs2_inode *ip, struct buffer_head **bhp)
597 ea->ea_num_ptrs = 0; 599 ea->ea_num_ptrs = 0;
598 600
599 ip->i_di.di_blocks++; 601 ip->i_di.di_blocks++;
602 gfs2_set_inode_blocks(&ip->i_inode);
600 603
601 return 0; 604 return 0;
602} 605}
@@ -629,7 +632,7 @@ static int ea_write(struct gfs2_inode *ip, struct gfs2_ea_header *ea,
629 ea->ea_num_ptrs = 0; 632 ea->ea_num_ptrs = 0;
630 memcpy(GFS2_EA2DATA(ea), er->er_data, er->er_data_len); 633 memcpy(GFS2_EA2DATA(ea), er->er_data, er->er_data_len);
631 } else { 634 } else {
632 u64 *dataptr = GFS2_EA2DATAPTRS(ea); 635 __be64 *dataptr = GFS2_EA2DATAPTRS(ea);
633 const char *data = er->er_data; 636 const char *data = er->er_data;
634 unsigned int data_len = er->er_data_len; 637 unsigned int data_len = er->er_data_len;
635 unsigned int copy; 638 unsigned int copy;
@@ -648,6 +651,7 @@ static int ea_write(struct gfs2_inode *ip, struct gfs2_ea_header *ea,
648 gfs2_metatype_set(bh, GFS2_METATYPE_ED, GFS2_FORMAT_ED); 651 gfs2_metatype_set(bh, GFS2_METATYPE_ED, GFS2_FORMAT_ED);
649 652
650 ip->i_di.di_blocks++; 653 ip->i_di.di_blocks++;
654 gfs2_set_inode_blocks(&ip->i_inode);
651 655
652 copy = data_len > sdp->sd_jbsize ? sdp->sd_jbsize : 656 copy = data_len > sdp->sd_jbsize ? sdp->sd_jbsize :
653 data_len; 657 data_len;
@@ -686,7 +690,7 @@ static int ea_alloc_skeleton(struct gfs2_inode *ip, struct gfs2_ea_request *er,
686 if (error) 690 if (error)
687 goto out; 691 goto out;
688 692
689 error = gfs2_quota_check(ip, ip->i_di.di_uid, ip->i_di.di_gid); 693 error = gfs2_quota_check(ip, ip->i_inode.i_uid, ip->i_inode.i_gid);
690 if (error) 694 if (error)
691 goto out_gunlock_q; 695 goto out_gunlock_q;
692 696
@@ -710,13 +714,13 @@ static int ea_alloc_skeleton(struct gfs2_inode *ip, struct gfs2_ea_request *er,
710 if (!error) { 714 if (!error) {
711 if (er->er_flags & GFS2_ERF_MODE) { 715 if (er->er_flags & GFS2_ERF_MODE) {
712 gfs2_assert_withdraw(GFS2_SB(&ip->i_inode), 716 gfs2_assert_withdraw(GFS2_SB(&ip->i_inode),
713 (ip->i_di.di_mode & S_IFMT) == 717 (ip->i_inode.i_mode & S_IFMT) ==
714 (er->er_mode & S_IFMT)); 718 (er->er_mode & S_IFMT));
715 ip->i_di.di_mode = er->er_mode; 719 ip->i_inode.i_mode = er->er_mode;
716 } 720 }
717 ip->i_di.di_ctime = get_seconds(); 721 ip->i_inode.i_ctime.tv_sec = get_seconds();
718 gfs2_trans_add_bh(ip->i_gl, dibh, 1); 722 gfs2_trans_add_bh(ip->i_gl, dibh, 1);
719 gfs2_dinode_out(&ip->i_di, dibh->b_data); 723 gfs2_dinode_out(ip, dibh->b_data);
720 brelse(dibh); 724 brelse(dibh);
721 } 725 }
722 726
@@ -846,12 +850,12 @@ static int ea_set_simple_noalloc(struct gfs2_inode *ip, struct buffer_head *bh,
846 850
847 if (er->er_flags & GFS2_ERF_MODE) { 851 if (er->er_flags & GFS2_ERF_MODE) {
848 gfs2_assert_withdraw(GFS2_SB(&ip->i_inode), 852 gfs2_assert_withdraw(GFS2_SB(&ip->i_inode),
849 (ip->i_di.di_mode & S_IFMT) == (er->er_mode & S_IFMT)); 853 (ip->i_inode.i_mode & S_IFMT) == (er->er_mode & S_IFMT));
850 ip->i_di.di_mode = er->er_mode; 854 ip->i_inode.i_mode = er->er_mode;
851 } 855 }
852 ip->i_di.di_ctime = get_seconds(); 856 ip->i_inode.i_ctime.tv_sec = get_seconds();
853 gfs2_trans_add_bh(ip->i_gl, dibh, 1); 857 gfs2_trans_add_bh(ip->i_gl, dibh, 1);
854 gfs2_dinode_out(&ip->i_di, dibh->b_data); 858 gfs2_dinode_out(ip, dibh->b_data);
855 brelse(dibh); 859 brelse(dibh);
856out: 860out:
857 gfs2_trans_end(GFS2_SB(&ip->i_inode)); 861 gfs2_trans_end(GFS2_SB(&ip->i_inode));
@@ -931,12 +935,12 @@ static int ea_set_block(struct gfs2_inode *ip, struct gfs2_ea_request *er,
931{ 935{
932 struct gfs2_sbd *sdp = GFS2_SB(&ip->i_inode); 936 struct gfs2_sbd *sdp = GFS2_SB(&ip->i_inode);
933 struct buffer_head *indbh, *newbh; 937 struct buffer_head *indbh, *newbh;
934 u64 *eablk; 938 __be64 *eablk;
935 int error; 939 int error;
936 int mh_size = sizeof(struct gfs2_meta_header); 940 int mh_size = sizeof(struct gfs2_meta_header);
937 941
938 if (ip->i_di.di_flags & GFS2_DIF_EA_INDIRECT) { 942 if (ip->i_di.di_flags & GFS2_DIF_EA_INDIRECT) {
939 u64 *end; 943 __be64 *end;
940 944
941 error = gfs2_meta_read(ip->i_gl, ip->i_di.di_eattr, DIO_WAIT, 945 error = gfs2_meta_read(ip->i_gl, ip->i_di.di_eattr, DIO_WAIT,
942 &indbh); 946 &indbh);
@@ -948,7 +952,7 @@ static int ea_set_block(struct gfs2_inode *ip, struct gfs2_ea_request *er,
948 goto out; 952 goto out;
949 } 953 }
950 954
951 eablk = (u64 *)(indbh->b_data + mh_size); 955 eablk = (__be64 *)(indbh->b_data + mh_size);
952 end = eablk + sdp->sd_inptrs; 956 end = eablk + sdp->sd_inptrs;
953 957
954 for (; eablk < end; eablk++) 958 for (; eablk < end; eablk++)
@@ -971,11 +975,12 @@ 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); 975 gfs2_metatype_set(indbh, GFS2_METATYPE_IN, GFS2_FORMAT_IN);
972 gfs2_buffer_clear_tail(indbh, mh_size); 976 gfs2_buffer_clear_tail(indbh, mh_size);
973 977
974 eablk = (u64 *)(indbh->b_data + mh_size); 978 eablk = (__be64 *)(indbh->b_data + mh_size);
975 *eablk = cpu_to_be64(ip->i_di.di_eattr); 979 *eablk = cpu_to_be64(ip->i_di.di_eattr);
976 ip->i_di.di_eattr = blk; 980 ip->i_di.di_eattr = blk;
977 ip->i_di.di_flags |= GFS2_DIF_EA_INDIRECT; 981 ip->i_di.di_flags |= GFS2_DIF_EA_INDIRECT;
978 ip->i_di.di_blocks++; 982 ip->i_di.di_blocks++;
983 gfs2_set_inode_blocks(&ip->i_inode);
979 984
980 eablk++; 985 eablk++;
981 } 986 }
@@ -1129,9 +1134,9 @@ static int ea_remove_stuffed(struct gfs2_inode *ip, struct gfs2_ea_location *el)
1129 1134
1130 error = gfs2_meta_inode_buffer(ip, &dibh); 1135 error = gfs2_meta_inode_buffer(ip, &dibh);
1131 if (!error) { 1136 if (!error) {
1132 ip->i_di.di_ctime = get_seconds(); 1137 ip->i_inode.i_ctime.tv_sec = get_seconds();
1133 gfs2_trans_add_bh(ip->i_gl, dibh, 1); 1138 gfs2_trans_add_bh(ip->i_gl, dibh, 1);
1134 gfs2_dinode_out(&ip->i_di, dibh->b_data); 1139 gfs2_dinode_out(ip, dibh->b_data);
1135 brelse(dibh); 1140 brelse(dibh);
1136 } 1141 }
1137 1142
@@ -1202,7 +1207,7 @@ static int ea_acl_chmod_unstuffed(struct gfs2_inode *ip,
1202 struct buffer_head **bh; 1207 struct buffer_head **bh;
1203 unsigned int amount = GFS2_EA_DATA_LEN(ea); 1208 unsigned int amount = GFS2_EA_DATA_LEN(ea);
1204 unsigned int nptrs = DIV_ROUND_UP(amount, sdp->sd_jbsize); 1209 unsigned int nptrs = DIV_ROUND_UP(amount, sdp->sd_jbsize);
1205 u64 *dataptrs = GFS2_EA2DATAPTRS(ea); 1210 __be64 *dataptrs = GFS2_EA2DATAPTRS(ea);
1206 unsigned int x; 1211 unsigned int x;
1207 int error; 1212 int error;
1208 1213
@@ -1284,9 +1289,8 @@ int gfs2_ea_acl_chmod(struct gfs2_inode *ip, struct gfs2_ea_location *el,
1284 if (!error) { 1289 if (!error) {
1285 error = inode_setattr(&ip->i_inode, attr); 1290 error = inode_setattr(&ip->i_inode, attr);
1286 gfs2_assert_warn(GFS2_SB(&ip->i_inode), !error); 1291 gfs2_assert_warn(GFS2_SB(&ip->i_inode), !error);
1287 gfs2_inode_attr_out(ip);
1288 gfs2_trans_add_bh(ip->i_gl, dibh, 1); 1292 gfs2_trans_add_bh(ip->i_gl, dibh, 1);
1289 gfs2_dinode_out(&ip->i_di, dibh->b_data); 1293 gfs2_dinode_out(ip, dibh->b_data);
1290 brelse(dibh); 1294 brelse(dibh);
1291 } 1295 }
1292 1296
@@ -1300,7 +1304,7 @@ static int ea_dealloc_indirect(struct gfs2_inode *ip)
1300 struct gfs2_sbd *sdp = GFS2_SB(&ip->i_inode); 1304 struct gfs2_sbd *sdp = GFS2_SB(&ip->i_inode);
1301 struct gfs2_rgrp_list rlist; 1305 struct gfs2_rgrp_list rlist;
1302 struct buffer_head *indbh, *dibh; 1306 struct buffer_head *indbh, *dibh;
1303 u64 *eablk, *end; 1307 __be64 *eablk, *end;
1304 unsigned int rg_blocks = 0; 1308 unsigned int rg_blocks = 0;
1305 u64 bstart = 0; 1309 u64 bstart = 0;
1306 unsigned int blen = 0; 1310 unsigned int blen = 0;
@@ -1319,7 +1323,7 @@ static int ea_dealloc_indirect(struct gfs2_inode *ip)
1319 goto out; 1323 goto out;
1320 } 1324 }
1321 1325
1322 eablk = (u64 *)(indbh->b_data + sizeof(struct gfs2_meta_header)); 1326 eablk = (__be64 *)(indbh->b_data + sizeof(struct gfs2_meta_header));
1323 end = eablk + sdp->sd_inptrs; 1327 end = eablk + sdp->sd_inptrs;
1324 1328
1325 for (; eablk < end; eablk++) { 1329 for (; eablk < end; eablk++) {
@@ -1363,7 +1367,7 @@ static int ea_dealloc_indirect(struct gfs2_inode *ip)
1363 1367
1364 gfs2_trans_add_bh(ip->i_gl, indbh, 1); 1368 gfs2_trans_add_bh(ip->i_gl, indbh, 1);
1365 1369
1366 eablk = (u64 *)(indbh->b_data + sizeof(struct gfs2_meta_header)); 1370 eablk = (__be64 *)(indbh->b_data + sizeof(struct gfs2_meta_header));
1367 bstart = 0; 1371 bstart = 0;
1368 blen = 0; 1372 blen = 0;
1369 1373
@@ -1387,6 +1391,7 @@ static int ea_dealloc_indirect(struct gfs2_inode *ip)
1387 if (!ip->i_di.di_blocks) 1391 if (!ip->i_di.di_blocks)
1388 gfs2_consist_inode(ip); 1392 gfs2_consist_inode(ip);
1389 ip->i_di.di_blocks--; 1393 ip->i_di.di_blocks--;
1394 gfs2_set_inode_blocks(&ip->i_inode);
1390 } 1395 }
1391 if (bstart) 1396 if (bstart)
1392 gfs2_free_meta(ip, bstart, blen); 1397 gfs2_free_meta(ip, bstart, blen);
@@ -1396,7 +1401,7 @@ static int ea_dealloc_indirect(struct gfs2_inode *ip)
1396 error = gfs2_meta_inode_buffer(ip, &dibh); 1401 error = gfs2_meta_inode_buffer(ip, &dibh);
1397 if (!error) { 1402 if (!error) {
1398 gfs2_trans_add_bh(ip->i_gl, dibh, 1); 1403 gfs2_trans_add_bh(ip->i_gl, dibh, 1);
1399 gfs2_dinode_out(&ip->i_di, dibh->b_data); 1404 gfs2_dinode_out(ip, dibh->b_data);
1400 brelse(dibh); 1405 brelse(dibh);
1401 } 1406 }
1402 1407
@@ -1441,11 +1446,12 @@ static int ea_dealloc_block(struct gfs2_inode *ip)
1441 if (!ip->i_di.di_blocks) 1446 if (!ip->i_di.di_blocks)
1442 gfs2_consist_inode(ip); 1447 gfs2_consist_inode(ip);
1443 ip->i_di.di_blocks--; 1448 ip->i_di.di_blocks--;
1449 gfs2_set_inode_blocks(&ip->i_inode);
1444 1450
1445 error = gfs2_meta_inode_buffer(ip, &dibh); 1451 error = gfs2_meta_inode_buffer(ip, &dibh);
1446 if (!error) { 1452 if (!error) {
1447 gfs2_trans_add_bh(ip->i_gl, dibh, 1); 1453 gfs2_trans_add_bh(ip->i_gl, dibh, 1);
1448 gfs2_dinode_out(&ip->i_di, dibh->b_data); 1454 gfs2_dinode_out(ip, dibh->b_data);
1449 brelse(dibh); 1455 brelse(dibh);
1450 } 1456 }
1451 1457