aboutsummaryrefslogtreecommitdiffstats
path: root/fs/gfs2/inode.c
diff options
context:
space:
mode:
authorSteven Whitehouse <swhiteho@redhat.com>2006-05-18 16:25:27 -0400
committerSteven Whitehouse <swhiteho@redhat.com>2006-05-18 16:25:27 -0400
commit320dd101e2d595a03439adb92b319f3af53dd1d0 (patch)
tree56a88401a218622018030045fec009bafdc4ce76 /fs/gfs2/inode.c
parent3a8a9a1034813aa99f5ae3150f652d490c5ff10d (diff)
[GFS2] glock debugging and inode cache changes
This adds some extra debugging to glock.c and changes inode.c's deallocation code to call the debugging code at a suitable moment. I'm chasing down a particular bug to do with deallocation at the moment and the code can go again once the bug is fixed. Also this includes the first part of some changes to unify the Linux struct inode and GFS2's struct gfs2_inode. This transformation will happen in small parts over the next short period. Signed-off-by: Steven Whitehouse <swhiteho@redhat.com>
Diffstat (limited to 'fs/gfs2/inode.c')
-rw-r--r--fs/gfs2/inode.c58
1 files changed, 21 insertions, 37 deletions
diff --git a/fs/gfs2/inode.c b/fs/gfs2/inode.c
index 27fbcd9b12f0..c2c7d2b63a57 100644
--- a/fs/gfs2/inode.c
+++ b/fs/gfs2/inode.c
@@ -504,7 +504,7 @@ static int inode_dealloc(struct gfs2_sbd *sdp, struct gfs2_unlinked *ul,
504 504
505 error = gfs2_glock_nq_num(sdp, ul->ul_ut.ut_inum.no_addr, 505 error = gfs2_glock_nq_num(sdp, ul->ul_ut.ut_inum.no_addr,
506 &gfs2_inode_glops, LM_ST_EXCLUSIVE, 506 &gfs2_inode_glops, LM_ST_EXCLUSIVE,
507 LM_FLAG_TRY_1CB, &i_gh); 507 LM_FLAG_TRY_1CB|GL_DUMP, &i_gh);
508 switch(error) { 508 switch(error) {
509 case 0: 509 case 0:
510 break; 510 break;
@@ -724,9 +724,8 @@ struct inode *gfs2_lookupi(struct inode *dir, struct qstr *name, int is_root,
724 if ((name->len == 1 && memcmp(name->name, ".", 1) == 0) || 724 if ((name->len == 1 && memcmp(name->name, ".", 1) == 0) ||
725 (name->len == 2 && memcmp(name->name, "..", 2) == 0 && 725 (name->len == 2 && memcmp(name->name, "..", 2) == 0 &&
726 dir == sb->s_root->d_inode)) { 726 dir == sb->s_root->d_inode)) {
727 gfs2_inode_hold(dip); 727 igrab(dir);
728 ipp = dip; 728 return dir;
729 goto done;
730 } 729 }
731 730
732 error = gfs2_glock_nq_init(dip->i_gl, LM_ST_SHARED, 0, &d_gh); 731 error = gfs2_glock_nq_init(dip->i_gl, LM_ST_SHARED, 0, &d_gh);
@@ -734,7 +733,7 @@ struct inode *gfs2_lookupi(struct inode *dir, struct qstr *name, int is_root,
734 return ERR_PTR(error); 733 return ERR_PTR(error);
735 734
736 if (!is_root) { 735 if (!is_root) {
737 error = gfs2_repermission(dip->i_vnode, MAY_EXEC, NULL); 736 error = gfs2_repermission(dir, MAY_EXEC, NULL);
738 if (error) 737 if (error)
739 goto out; 738 goto out;
740 } 739 }
@@ -756,7 +755,6 @@ struct inode *gfs2_lookupi(struct inode *dir, struct qstr *name, int is_root,
756 755
757out: 756out:
758 gfs2_glock_dq_uninit(&d_gh); 757 gfs2_glock_dq_uninit(&d_gh);
759done:
760 if (error == -ENOENT) 758 if (error == -ENOENT)
761 return NULL; 759 return NULL;
762 if (error == 0) { 760 if (error == 0) {
@@ -1058,7 +1056,6 @@ static int make_dinode(struct gfs2_inode *dip, struct gfs2_glock *gl,
1058 int error; 1056 int error;
1059 1057
1060 munge_mode_uid_gid(dip, &mode, &uid, &gid); 1058 munge_mode_uid_gid(dip, &mode, &uid, &gid);
1061
1062 gfs2_alloc_get(dip); 1059 gfs2_alloc_get(dip);
1063 1060
1064 error = gfs2_quota_lock(dip, uid, gid); 1061 error = gfs2_quota_lock(dip, uid, gid);
@@ -1069,19 +1066,14 @@ static int make_dinode(struct gfs2_inode *dip, struct gfs2_glock *gl,
1069 if (error) 1066 if (error)
1070 goto out_quota; 1067 goto out_quota;
1071 1068
1072 error = gfs2_trans_begin(sdp, RES_DINODE + RES_UNLINKED + 1069 error = gfs2_trans_begin(sdp, RES_DINODE + RES_UNLINKED + RES_QUOTA, 0);
1073 RES_QUOTA, 0);
1074 if (error) 1070 if (error)
1075 goto out_quota; 1071 goto out_quota;
1076 1072
1077 ul->ul_ut.ut_flags = 0; 1073 ul->ul_ut.ut_flags = 0;
1078 error = gfs2_unlinked_ondisk_munge(sdp, ul); 1074 error = gfs2_unlinked_ondisk_munge(sdp, ul);
1079 1075 init_dinode(dip, gl, &ul->ul_ut.ut_inum, mode, uid, gid);
1080 init_dinode(dip, gl, &ul->ul_ut.ut_inum,
1081 mode, uid, gid);
1082
1083 gfs2_quota_change(dip, +1, uid, gid); 1076 gfs2_quota_change(dip, +1, uid, gid);
1084
1085 gfs2_trans_end(sdp); 1077 gfs2_trans_end(sdp);
1086 1078
1087 out_quota: 1079 out_quota:
@@ -1089,7 +1081,6 @@ static int make_dinode(struct gfs2_inode *dip, struct gfs2_glock *gl,
1089 1081
1090 out: 1082 out:
1091 gfs2_alloc_put(dip); 1083 gfs2_alloc_put(dip);
1092
1093 return error; 1084 return error;
1094} 1085}
1095 1086
@@ -1123,8 +1114,7 @@ static int link_dinode(struct gfs2_inode *dip, struct qstr *name,
1123 if (error) 1114 if (error)
1124 goto fail_quota_locks; 1115 goto fail_quota_locks;
1125 1116
1126 error = gfs2_trans_begin(sdp, 1117 error = gfs2_trans_begin(sdp, sdp->sd_max_dirres +
1127 sdp->sd_max_dirres +
1128 al->al_rgd->rd_ri.ri_length + 1118 al->al_rgd->rd_ri.ri_length +
1129 2 * RES_DINODE + RES_UNLINKED + 1119 2 * RES_DINODE + RES_UNLINKED +
1130 RES_STATFS + RES_QUOTA, 0); 1120 RES_STATFS + RES_QUOTA, 0);
@@ -1157,19 +1147,18 @@ static int link_dinode(struct gfs2_inode *dip, struct qstr *name,
1157 1147
1158 return 0; 1148 return 0;
1159 1149
1160 fail_end_trans: 1150fail_end_trans:
1161 gfs2_trans_end(sdp); 1151 gfs2_trans_end(sdp);
1162 1152
1163 fail_ipreserv: 1153fail_ipreserv:
1164 if (dip->i_alloc.al_rgd) 1154 if (dip->i_alloc.al_rgd)
1165 gfs2_inplace_release(dip); 1155 gfs2_inplace_release(dip);
1166 1156
1167 fail_quota_locks: 1157fail_quota_locks:
1168 gfs2_quota_unlock(dip); 1158 gfs2_quota_unlock(dip);
1169 1159
1170 fail: 1160fail:
1171 gfs2_alloc_put(dip); 1161 gfs2_alloc_put(dip);
1172
1173 return error; 1162 return error;
1174} 1163}
1175 1164
@@ -1226,11 +1215,9 @@ struct inode *gfs2_createi(struct gfs2_holder *ghs, struct qstr *name,
1226 if (ul->ul_ut.ut_inum.no_addr < dip->i_num.no_addr) { 1215 if (ul->ul_ut.ut_inum.no_addr < dip->i_num.no_addr) {
1227 gfs2_glock_dq(ghs); 1216 gfs2_glock_dq(ghs);
1228 1217
1229 error = gfs2_glock_nq_num(sdp, 1218 error = gfs2_glock_nq_num(sdp, ul->ul_ut.ut_inum.no_addr,
1230 ul->ul_ut.ut_inum.no_addr, 1219 &gfs2_inode_glops, LM_ST_EXCLUSIVE,
1231 &gfs2_inode_glops, 1220 GL_SKIP, ghs + 1);
1232 LM_ST_EXCLUSIVE, GL_SKIP,
1233 ghs + 1);
1234 if (error) { 1221 if (error) {
1235 gfs2_unlinked_put(sdp, ul); 1222 gfs2_unlinked_put(sdp, ul);
1236 return ERR_PTR(error); 1223 return ERR_PTR(error);
@@ -1248,11 +1235,9 @@ struct inode *gfs2_createi(struct gfs2_holder *ghs, struct qstr *name,
1248 if (error) 1235 if (error)
1249 goto fail_gunlock2; 1236 goto fail_gunlock2;
1250 } else { 1237 } else {
1251 error = gfs2_glock_nq_num(sdp, 1238 error = gfs2_glock_nq_num(sdp, ul->ul_ut.ut_inum.no_addr,
1252 ul->ul_ut.ut_inum.no_addr, 1239 &gfs2_inode_glops, LM_ST_EXCLUSIVE,
1253 &gfs2_inode_glops, 1240 GL_SKIP, ghs + 1);
1254 LM_ST_EXCLUSIVE, GL_SKIP,
1255 ghs + 1);
1256 if (error) 1241 if (error)
1257 goto fail_gunlock; 1242 goto fail_gunlock;
1258 } 1243 }
@@ -1285,18 +1270,17 @@ struct inode *gfs2_createi(struct gfs2_holder *ghs, struct qstr *name,
1285 return ERR_PTR(-ENOMEM); 1270 return ERR_PTR(-ENOMEM);
1286 return inode; 1271 return inode;
1287 1272
1288 fail_iput: 1273fail_iput:
1289 gfs2_inode_put(ip); 1274 gfs2_inode_put(ip);
1290 1275
1291 fail_gunlock2: 1276fail_gunlock2:
1292 gfs2_glock_dq_uninit(ghs + 1); 1277 gfs2_glock_dq_uninit(ghs + 1);
1293 1278
1294 fail_gunlock: 1279fail_gunlock:
1295 gfs2_glock_dq(ghs); 1280 gfs2_glock_dq(ghs);
1296 1281
1297 fail: 1282fail:
1298 gfs2_unlinked_put(sdp, ul); 1283 gfs2_unlinked_put(sdp, ul);
1299
1300 return ERR_PTR(error); 1284 return ERR_PTR(error);
1301} 1285}
1302 1286