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.c70
1 files changed, 35 insertions, 35 deletions
diff --git a/fs/gfs2/eattr.c b/fs/gfs2/eattr.c
index 2e114c075707..96736932260f 100644
--- a/fs/gfs2/eattr.c
+++ b/fs/gfs2/eattr.c
@@ -80,7 +80,7 @@ static int ea_foreach_i(struct gfs2_inode *ip, struct buffer_head *bh,
80 struct gfs2_ea_header *ea, *prev = NULL; 80 struct gfs2_ea_header *ea, *prev = NULL;
81 int error = 0; 81 int error = 0;
82 82
83 if (gfs2_metatype_check(ip->i_sbd, bh, GFS2_METATYPE_EA)) 83 if (gfs2_metatype_check(GFS2_SB(&ip->i_inode), bh, GFS2_METATYPE_EA))
84 return -EIO; 84 return -EIO;
85 85
86 for (ea = GFS2_EA_BH2FIRST(bh);; prev = ea, ea = GFS2_EA2NEXT(ea)) { 86 for (ea = GFS2_EA_BH2FIRST(bh);; prev = ea, ea = GFS2_EA2NEXT(ea)) {
@@ -128,13 +128,13 @@ static int ea_foreach(struct gfs2_inode *ip, ea_call_t ea_call, void *data)
128 goto out; 128 goto out;
129 } 129 }
130 130
131 if (gfs2_metatype_check(ip->i_sbd, bh, GFS2_METATYPE_IN)) { 131 if (gfs2_metatype_check(GFS2_SB(&ip->i_inode), bh, GFS2_METATYPE_IN)) {
132 error = -EIO; 132 error = -EIO;
133 goto out; 133 goto out;
134 } 134 }
135 135
136 eablk = (uint64_t *)(bh->b_data + sizeof(struct gfs2_meta_header)); 136 eablk = (uint64_t *)(bh->b_data + sizeof(struct gfs2_meta_header));
137 end = eablk + ip->i_sbd->sd_inptrs; 137 end = eablk + GFS2_SB(&ip->i_inode)->sd_inptrs;
138 138
139 for (; eablk < end; eablk++) { 139 for (; eablk < end; eablk++) {
140 uint64_t bn; 140 uint64_t bn;
@@ -232,7 +232,7 @@ static int ea_dealloc_unstuffed(struct gfs2_inode *ip, struct buffer_head *bh,
232 struct gfs2_ea_header *prev, void *private) 232 struct gfs2_ea_header *prev, void *private)
233{ 233{
234 int *leave = private; 234 int *leave = private;
235 struct gfs2_sbd *sdp = ip->i_sbd; 235 struct gfs2_sbd *sdp = GFS2_SB(&ip->i_inode);
236 struct gfs2_rgrpd *rgd; 236 struct gfs2_rgrpd *rgd;
237 struct gfs2_holder rg_gh; 237 struct gfs2_holder rg_gh;
238 struct buffer_head *dibh; 238 struct buffer_head *dibh;
@@ -338,7 +338,7 @@ static int ea_remove_unstuffed(struct gfs2_inode *ip, struct buffer_head *bh,
338 if (error) 338 if (error)
339 goto out_alloc; 339 goto out_alloc;
340 340
341 error = gfs2_rindex_hold(ip->i_sbd, &al->al_ri_gh); 341 error = gfs2_rindex_hold(GFS2_SB(&ip->i_inode), &al->al_ri_gh);
342 if (error) 342 if (error)
343 goto out_quota; 343 goto out_quota;
344 344
@@ -459,7 +459,7 @@ int gfs2_ea_list(struct gfs2_inode *ip, struct gfs2_ea_request *er)
459static int ea_get_unstuffed(struct gfs2_inode *ip, struct gfs2_ea_header *ea, 459static int ea_get_unstuffed(struct gfs2_inode *ip, struct gfs2_ea_header *ea,
460 char *data) 460 char *data)
461{ 461{
462 struct gfs2_sbd *sdp = ip->i_sbd; 462 struct gfs2_sbd *sdp = GFS2_SB(&ip->i_inode);
463 struct buffer_head **bh; 463 struct buffer_head **bh;
464 unsigned int amount = GFS2_EA_DATA_LEN(ea); 464 unsigned int amount = GFS2_EA_DATA_LEN(ea);
465 unsigned int nptrs = DIV_ROUND_UP(amount, sdp->sd_jbsize); 465 unsigned int nptrs = DIV_ROUND_UP(amount, sdp->sd_jbsize);
@@ -604,7 +604,7 @@ int gfs2_ea_get(struct gfs2_inode *ip, struct gfs2_ea_request *er)
604 604
605static int ea_alloc_blk(struct gfs2_inode *ip, struct buffer_head **bhp) 605static int ea_alloc_blk(struct gfs2_inode *ip, struct buffer_head **bhp)
606{ 606{
607 struct gfs2_sbd *sdp = ip->i_sbd; 607 struct gfs2_sbd *sdp = GFS2_SB(&ip->i_inode);
608 struct gfs2_ea_header *ea; 608 struct gfs2_ea_header *ea;
609 uint64_t block; 609 uint64_t block;
610 610
@@ -641,7 +641,7 @@ static int ea_alloc_blk(struct gfs2_inode *ip, struct buffer_head **bhp)
641static int ea_write(struct gfs2_inode *ip, struct gfs2_ea_header *ea, 641static int ea_write(struct gfs2_inode *ip, struct gfs2_ea_header *ea,
642 struct gfs2_ea_request *er) 642 struct gfs2_ea_request *er)
643{ 643{
644 struct gfs2_sbd *sdp = ip->i_sbd; 644 struct gfs2_sbd *sdp = GFS2_SB(&ip->i_inode);
645 645
646 ea->ea_data_len = cpu_to_be32(er->er_data_len); 646 ea->ea_data_len = cpu_to_be32(er->er_data_len);
647 ea->ea_name_len = er->er_name_len; 647 ea->ea_name_len = er->er_name_len;
@@ -723,7 +723,7 @@ static int ea_alloc_skeleton(struct gfs2_inode *ip, struct gfs2_ea_request *er,
723 if (error) 723 if (error)
724 goto out_gunlock_q; 724 goto out_gunlock_q;
725 725
726 error = gfs2_trans_begin(ip->i_sbd, 726 error = gfs2_trans_begin(GFS2_SB(&ip->i_inode),
727 blks + al->al_rgd->rd_ri.ri_length + 727 blks + al->al_rgd->rd_ri.ri_length +
728 RES_DINODE + RES_STATFS + RES_QUOTA, 0); 728 RES_DINODE + RES_STATFS + RES_QUOTA, 0);
729 if (error) 729 if (error)
@@ -736,7 +736,7 @@ static int ea_alloc_skeleton(struct gfs2_inode *ip, struct gfs2_ea_request *er,
736 error = gfs2_meta_inode_buffer(ip, &dibh); 736 error = gfs2_meta_inode_buffer(ip, &dibh);
737 if (!error) { 737 if (!error) {
738 if (er->er_flags & GFS2_ERF_MODE) { 738 if (er->er_flags & GFS2_ERF_MODE) {
739 gfs2_assert_withdraw(ip->i_sbd, 739 gfs2_assert_withdraw(GFS2_SB(&ip->i_inode),
740 (ip->i_di.di_mode & S_IFMT) == 740 (ip->i_di.di_mode & S_IFMT) ==
741 (er->er_mode & S_IFMT)); 741 (er->er_mode & S_IFMT));
742 ip->i_di.di_mode = er->er_mode; 742 ip->i_di.di_mode = er->er_mode;
@@ -748,7 +748,7 @@ static int ea_alloc_skeleton(struct gfs2_inode *ip, struct gfs2_ea_request *er,
748 } 748 }
749 749
750 out_end_trans: 750 out_end_trans:
751 gfs2_trans_end(ip->i_sbd); 751 gfs2_trans_end(GFS2_SB(&ip->i_inode));
752 752
753 out_ipres: 753 out_ipres:
754 gfs2_inplace_release(ip); 754 gfs2_inplace_release(ip);
@@ -790,7 +790,7 @@ static int ea_init_i(struct gfs2_inode *ip, struct gfs2_ea_request *er,
790 790
791static int ea_init(struct gfs2_inode *ip, struct gfs2_ea_request *er) 791static int ea_init(struct gfs2_inode *ip, struct gfs2_ea_request *er)
792{ 792{
793 unsigned int jbsize = ip->i_sbd->sd_jbsize; 793 unsigned int jbsize = GFS2_SB(&ip->i_inode)->sd_jbsize;
794 unsigned int blks = 1; 794 unsigned int blks = 1;
795 795
796 if (GFS2_EAREQ_SIZE_STUFFED(er) > jbsize) 796 if (GFS2_EAREQ_SIZE_STUFFED(er) > jbsize)
@@ -830,7 +830,7 @@ static void ea_set_remove_stuffed(struct gfs2_inode *ip,
830 return; 830 return;
831 } else if (GFS2_EA2NEXT(prev) != ea) { 831 } else if (GFS2_EA2NEXT(prev) != ea) {
832 prev = GFS2_EA2NEXT(prev); 832 prev = GFS2_EA2NEXT(prev);
833 gfs2_assert_withdraw(ip->i_sbd, GFS2_EA2NEXT(prev) == ea); 833 gfs2_assert_withdraw(GFS2_SB(&ip->i_inode), GFS2_EA2NEXT(prev) == ea);
834 } 834 }
835 835
836 len = GFS2_EA_REC_LEN(prev) + GFS2_EA_REC_LEN(ea); 836 len = GFS2_EA_REC_LEN(prev) + GFS2_EA_REC_LEN(ea);
@@ -857,7 +857,7 @@ static int ea_set_simple_noalloc(struct gfs2_inode *ip, struct buffer_head *bh,
857 struct buffer_head *dibh; 857 struct buffer_head *dibh;
858 int error; 858 int error;
859 859
860 error = gfs2_trans_begin(ip->i_sbd, RES_DINODE + 2 * RES_EATTR, 0); 860 error = gfs2_trans_begin(GFS2_SB(&ip->i_inode), RES_DINODE + 2 * RES_EATTR, 0);
861 if (error) 861 if (error)
862 return error; 862 return error;
863 863
@@ -876,7 +876,7 @@ static int ea_set_simple_noalloc(struct gfs2_inode *ip, struct buffer_head *bh,
876 goto out; 876 goto out;
877 877
878 if (er->er_flags & GFS2_ERF_MODE) { 878 if (er->er_flags & GFS2_ERF_MODE) {
879 gfs2_assert_withdraw(ip->i_sbd, 879 gfs2_assert_withdraw(GFS2_SB(&ip->i_inode),
880 (ip->i_di.di_mode & S_IFMT) == (er->er_mode & S_IFMT)); 880 (ip->i_di.di_mode & S_IFMT) == (er->er_mode & S_IFMT));
881 ip->i_di.di_mode = er->er_mode; 881 ip->i_di.di_mode = er->er_mode;
882 } 882 }
@@ -885,7 +885,7 @@ static int ea_set_simple_noalloc(struct gfs2_inode *ip, struct buffer_head *bh,
885 gfs2_dinode_out(&ip->i_di, dibh->b_data); 885 gfs2_dinode_out(&ip->i_di, dibh->b_data);
886 brelse(dibh); 886 brelse(dibh);
887 out: 887 out:
888 gfs2_trans_end(ip->i_sbd); 888 gfs2_trans_end(GFS2_SB(&ip->i_inode));
889 889
890 return error; 890 return error;
891} 891}
@@ -921,7 +921,7 @@ static int ea_set_simple(struct gfs2_inode *ip, struct buffer_head *bh,
921 int stuffed; 921 int stuffed;
922 int error; 922 int error;
923 923
924 stuffed = ea_calc_size(ip->i_sbd, es->es_er, &size); 924 stuffed = ea_calc_size(GFS2_SB(&ip->i_inode), es->es_er, &size);
925 925
926 if (ea->ea_type == GFS2_EATYPE_UNUSED) { 926 if (ea->ea_type == GFS2_EATYPE_UNUSED) {
927 if (GFS2_EA_REC_LEN(ea) < size) 927 if (GFS2_EA_REC_LEN(ea) < size)
@@ -947,7 +947,7 @@ static int ea_set_simple(struct gfs2_inode *ip, struct buffer_head *bh,
947 es->es_bh = bh; 947 es->es_bh = bh;
948 es->es_ea = ea; 948 es->es_ea = ea;
949 blks = 2 + DIV_ROUND_UP(es->es_er->er_data_len, 949 blks = 2 + DIV_ROUND_UP(es->es_er->er_data_len,
950 ip->i_sbd->sd_jbsize); 950 GFS2_SB(&ip->i_inode)->sd_jbsize);
951 951
952 error = ea_alloc_skeleton(ip, es->es_er, blks, 952 error = ea_alloc_skeleton(ip, es->es_er, blks,
953 ea_set_simple_alloc, es); 953 ea_set_simple_alloc, es);
@@ -961,7 +961,7 @@ static int ea_set_simple(struct gfs2_inode *ip, struct buffer_head *bh,
961static int ea_set_block(struct gfs2_inode *ip, struct gfs2_ea_request *er, 961static int ea_set_block(struct gfs2_inode *ip, struct gfs2_ea_request *er,
962 void *private) 962 void *private)
963{ 963{
964 struct gfs2_sbd *sdp = ip->i_sbd; 964 struct gfs2_sbd *sdp = GFS2_SB(&ip->i_inode);
965 struct buffer_head *indbh, *newbh; 965 struct buffer_head *indbh, *newbh;
966 uint64_t *eablk; 966 uint64_t *eablk;
967 int error; 967 int error;
@@ -1050,8 +1050,8 @@ static int ea_set_i(struct gfs2_inode *ip, struct gfs2_ea_request *er,
1050 1050
1051 if (!(ip->i_di.di_flags & GFS2_DIF_EA_INDIRECT)) 1051 if (!(ip->i_di.di_flags & GFS2_DIF_EA_INDIRECT))
1052 blks++; 1052 blks++;
1053 if (GFS2_EAREQ_SIZE_STUFFED(er) > ip->i_sbd->sd_jbsize) 1053 if (GFS2_EAREQ_SIZE_STUFFED(er) > GFS2_SB(&ip->i_inode)->sd_jbsize)
1054 blks += DIV_ROUND_UP(er->er_data_len, ip->i_sbd->sd_jbsize); 1054 blks += DIV_ROUND_UP(er->er_data_len, GFS2_SB(&ip->i_inode)->sd_jbsize);
1055 1055
1056 return ea_alloc_skeleton(ip, er, blks, ea_set_block, el); 1056 return ea_alloc_skeleton(ip, er, blks, ea_set_block, el);
1057} 1057}
@@ -1061,7 +1061,7 @@ static int ea_set_remove_unstuffed(struct gfs2_inode *ip,
1061{ 1061{
1062 if (el->el_prev && GFS2_EA2NEXT(el->el_prev) != el->el_ea) { 1062 if (el->el_prev && GFS2_EA2NEXT(el->el_prev) != el->el_ea) {
1063 el->el_prev = GFS2_EA2NEXT(el->el_prev); 1063 el->el_prev = GFS2_EA2NEXT(el->el_prev);
1064 gfs2_assert_withdraw(ip->i_sbd, 1064 gfs2_assert_withdraw(GFS2_SB(&ip->i_inode),
1065 GFS2_EA2NEXT(el->el_prev) == el->el_ea); 1065 GFS2_EA2NEXT(el->el_prev) == el->el_ea);
1066 } 1066 }
1067 1067
@@ -1119,7 +1119,7 @@ int gfs2_ea_set(struct gfs2_inode *ip, struct gfs2_ea_request *er)
1119 er->er_data = NULL; 1119 er->er_data = NULL;
1120 er->er_data_len = 0; 1120 er->er_data_len = 0;
1121 } 1121 }
1122 error = ea_check_size(ip->i_sbd, er); 1122 error = ea_check_size(GFS2_SB(&ip->i_inode), er);
1123 if (error) 1123 if (error)
1124 return error; 1124 return error;
1125 1125
@@ -1127,7 +1127,7 @@ int gfs2_ea_set(struct gfs2_inode *ip, struct gfs2_ea_request *er)
1127 if (error) 1127 if (error)
1128 return error; 1128 return error;
1129 1129
1130 if (IS_IMMUTABLE(ip->i_vnode)) 1130 if (IS_IMMUTABLE(&ip->i_inode))
1131 error = -EPERM; 1131 error = -EPERM;
1132 else 1132 else
1133 error = gfs2_ea_ops[er->er_type]->eo_set(ip, er); 1133 error = gfs2_ea_ops[er->er_type]->eo_set(ip, er);
@@ -1144,7 +1144,7 @@ static int ea_remove_stuffed(struct gfs2_inode *ip, struct gfs2_ea_location *el)
1144 struct buffer_head *dibh; 1144 struct buffer_head *dibh;
1145 int error; 1145 int error;
1146 1146
1147 error = gfs2_trans_begin(ip->i_sbd, RES_DINODE + RES_EATTR, 0); 1147 error = gfs2_trans_begin(GFS2_SB(&ip->i_inode), RES_DINODE + RES_EATTR, 0);
1148 if (error) 1148 if (error)
1149 return error; 1149 return error;
1150 1150
@@ -1169,7 +1169,7 @@ static int ea_remove_stuffed(struct gfs2_inode *ip, struct gfs2_ea_location *el)
1169 brelse(dibh); 1169 brelse(dibh);
1170 } 1170 }
1171 1171
1172 gfs2_trans_end(ip->i_sbd); 1172 gfs2_trans_end(GFS2_SB(&ip->i_inode));
1173 1173
1174 return error; 1174 return error;
1175} 1175}
@@ -1219,7 +1219,7 @@ int gfs2_ea_remove(struct gfs2_inode *ip, struct gfs2_ea_request *er)
1219 if (error) 1219 if (error)
1220 return error; 1220 return error;
1221 1221
1222 if (IS_IMMUTABLE(ip->i_vnode) || IS_APPEND(ip->i_vnode)) 1222 if (IS_IMMUTABLE(&ip->i_inode) || IS_APPEND(&ip->i_inode))
1223 error = -EPERM; 1223 error = -EPERM;
1224 else 1224 else
1225 error = gfs2_ea_ops[er->er_type]->eo_remove(ip, er); 1225 error = gfs2_ea_ops[er->er_type]->eo_remove(ip, er);
@@ -1232,7 +1232,7 @@ int gfs2_ea_remove(struct gfs2_inode *ip, struct gfs2_ea_request *er)
1232static int ea_acl_chmod_unstuffed(struct gfs2_inode *ip, 1232static int ea_acl_chmod_unstuffed(struct gfs2_inode *ip,
1233 struct gfs2_ea_header *ea, char *data) 1233 struct gfs2_ea_header *ea, char *data)
1234{ 1234{
1235 struct gfs2_sbd *sdp = ip->i_sbd; 1235 struct gfs2_sbd *sdp = GFS2_SB(&ip->i_inode);
1236 struct buffer_head **bh; 1236 struct buffer_head **bh;
1237 unsigned int amount = GFS2_EA_DATA_LEN(ea); 1237 unsigned int amount = GFS2_EA_DATA_LEN(ea);
1238 unsigned int nptrs = DIV_ROUND_UP(amount, sdp->sd_jbsize); 1238 unsigned int nptrs = DIV_ROUND_UP(amount, sdp->sd_jbsize);
@@ -1304,7 +1304,7 @@ int gfs2_ea_acl_chmod(struct gfs2_inode *ip, struct gfs2_ea_location *el,
1304 int error; 1304 int error;
1305 1305
1306 if (GFS2_EA_IS_STUFFED(el->el_ea)) { 1306 if (GFS2_EA_IS_STUFFED(el->el_ea)) {
1307 error = gfs2_trans_begin(ip->i_sbd, RES_DINODE + RES_EATTR, 0); 1307 error = gfs2_trans_begin(GFS2_SB(&ip->i_inode), RES_DINODE + RES_EATTR, 0);
1308 if (error) 1308 if (error)
1309 return error; 1309 return error;
1310 1310
@@ -1320,22 +1320,22 @@ int gfs2_ea_acl_chmod(struct gfs2_inode *ip, struct gfs2_ea_location *el,
1320 1320
1321 error = gfs2_meta_inode_buffer(ip, &dibh); 1321 error = gfs2_meta_inode_buffer(ip, &dibh);
1322 if (!error) { 1322 if (!error) {
1323 error = inode_setattr(ip->i_vnode, attr); 1323 error = inode_setattr(&ip->i_inode, attr);
1324 gfs2_assert_warn(ip->i_sbd, !error); 1324 gfs2_assert_warn(GFS2_SB(&ip->i_inode), !error);
1325 gfs2_inode_attr_out(ip); 1325 gfs2_inode_attr_out(ip);
1326 gfs2_trans_add_bh(ip->i_gl, dibh, 1); 1326 gfs2_trans_add_bh(ip->i_gl, dibh, 1);
1327 gfs2_dinode_out(&ip->i_di, dibh->b_data); 1327 gfs2_dinode_out(&ip->i_di, dibh->b_data);
1328 brelse(dibh); 1328 brelse(dibh);
1329 } 1329 }
1330 1330
1331 gfs2_trans_end(ip->i_sbd); 1331 gfs2_trans_end(GFS2_SB(&ip->i_inode));
1332 1332
1333 return error; 1333 return error;
1334} 1334}
1335 1335
1336static int ea_dealloc_indirect(struct gfs2_inode *ip) 1336static int ea_dealloc_indirect(struct gfs2_inode *ip)
1337{ 1337{
1338 struct gfs2_sbd *sdp = ip->i_sbd; 1338 struct gfs2_sbd *sdp = GFS2_SB(&ip->i_inode);
1339 struct gfs2_rgrp_list rlist; 1339 struct gfs2_rgrp_list rlist;
1340 struct buffer_head *indbh, *dibh; 1340 struct buffer_head *indbh, *dibh;
1341 uint64_t *eablk, *end; 1341 uint64_t *eablk, *end;
@@ -1456,7 +1456,7 @@ static int ea_dealloc_indirect(struct gfs2_inode *ip)
1456 1456
1457static int ea_dealloc_block(struct gfs2_inode *ip) 1457static int ea_dealloc_block(struct gfs2_inode *ip)
1458{ 1458{
1459 struct gfs2_sbd *sdp = ip->i_sbd; 1459 struct gfs2_sbd *sdp = GFS2_SB(&ip->i_inode);
1460 struct gfs2_alloc *al = &ip->i_alloc; 1460 struct gfs2_alloc *al = &ip->i_alloc;
1461 struct gfs2_rgrpd *rgd; 1461 struct gfs2_rgrpd *rgd;
1462 struct buffer_head *dibh; 1462 struct buffer_head *dibh;
@@ -1518,7 +1518,7 @@ int gfs2_ea_dealloc(struct gfs2_inode *ip)
1518 if (error) 1518 if (error)
1519 goto out_alloc; 1519 goto out_alloc;
1520 1520
1521 error = gfs2_rindex_hold(ip->i_sbd, &al->al_ri_gh); 1521 error = gfs2_rindex_hold(GFS2_SB(&ip->i_inode), &al->al_ri_gh);
1522 if (error) 1522 if (error)
1523 goto out_quota; 1523 goto out_quota;
1524 1524