aboutsummaryrefslogtreecommitdiffstats
path: root/fs/xfs/xfs_ialloc.c
diff options
context:
space:
mode:
authorChristoph Hellwig <hch@lst.de>2009-08-31 19:56:58 -0400
committerFelix Blyakher <felixb@sgi.com>2009-09-01 13:44:56 -0400
commit2e287a731e0607e0371dc6165b7dd3ebc67fa8e1 (patch)
treed51ee5e646aff15965cb483a0e4236cc140105cc /fs/xfs/xfs_ialloc.c
parent85c0b2ab5e69ca6133380ead1c50e0840d136b39 (diff)
xfs: improve xfs_inobt_get_rec prototype
Most callers of xfs_inobt_get_rec need to fill a xfs_inobt_rec_incore_t, and those who don't yet are fine with a xfs_inobt_rec_incore_t, instead of the three individual variables, too. So just change xfs_inobt_get_rec to write the output into a xfs_inobt_rec_incore_t directly. Signed-off-by: Christoph Hellwig <hch@lst.de> Reviewed-by: Alex Elder <aelder@sgi.com> Signed-off-by: Felix Blyakher <felixb@sgi.com>
Diffstat (limited to 'fs/xfs/xfs_ialloc.c')
-rw-r--r--fs/xfs/xfs_ialloc.c81
1 files changed, 31 insertions, 50 deletions
diff --git a/fs/xfs/xfs_ialloc.c b/fs/xfs/xfs_ialloc.c
index ce9edf7f4cb4..72fa3bfc56eb 100644
--- a/fs/xfs/xfs_ialloc.c
+++ b/fs/xfs/xfs_ialloc.c
@@ -135,9 +135,7 @@ xfs_inobt_update(
135int /* error */ 135int /* error */
136xfs_inobt_get_rec( 136xfs_inobt_get_rec(
137 struct xfs_btree_cur *cur, /* btree cursor */ 137 struct xfs_btree_cur *cur, /* btree cursor */
138 xfs_agino_t *ino, /* output: starting inode of chunk */ 138 xfs_inobt_rec_incore_t *irec, /* btree record */
139 __int32_t *fcnt, /* output: number of free inodes */
140 xfs_inofree_t *free, /* output: free inode mask */
141 int *stat) /* output: success/failure */ 139 int *stat) /* output: success/failure */
142{ 140{
143 union xfs_btree_rec *rec; 141 union xfs_btree_rec *rec;
@@ -145,9 +143,9 @@ xfs_inobt_get_rec(
145 143
146 error = xfs_btree_get_rec(cur, &rec, stat); 144 error = xfs_btree_get_rec(cur, &rec, stat);
147 if (!error && *stat == 1) { 145 if (!error && *stat == 1) {
148 *ino = be32_to_cpu(rec->inobt.ir_startino); 146 irec->ir_startino = be32_to_cpu(rec->inobt.ir_startino);
149 *fcnt = be32_to_cpu(rec->inobt.ir_freecount); 147 irec->ir_freecount = be32_to_cpu(rec->inobt.ir_freecount);
150 *free = be64_to_cpu(rec->inobt.ir_free); 148 irec->ir_free = be64_to_cpu(rec->inobt.ir_free);
151 } 149 }
152 return error; 150 return error;
153} 151}
@@ -746,8 +744,8 @@ nextag:
746 goto error0; 744 goto error0;
747 XFS_WANT_CORRUPTED_GOTO(i == 1, error0); 745 XFS_WANT_CORRUPTED_GOTO(i == 1, error0);
748 do { 746 do {
749 if ((error = xfs_inobt_get_rec(cur, &rec.ir_startino, 747 error = xfs_inobt_get_rec(cur, &rec, &i);
750 &rec.ir_freecount, &rec.ir_free, &i))) 748 if (error)
751 goto error0; 749 goto error0;
752 XFS_WANT_CORRUPTED_GOTO(i == 1, error0); 750 XFS_WANT_CORRUPTED_GOTO(i == 1, error0);
753 freecount += rec.ir_freecount; 751 freecount += rec.ir_freecount;
@@ -766,8 +764,7 @@ nextag:
766 if ((error = xfs_inobt_lookup_le(cur, pagino, 0, 0, &i))) 764 if ((error = xfs_inobt_lookup_le(cur, pagino, 0, 0, &i)))
767 goto error0; 765 goto error0;
768 if (i != 0 && 766 if (i != 0 &&
769 (error = xfs_inobt_get_rec(cur, &rec.ir_startino, 767 (error = xfs_inobt_get_rec(cur, &rec, &j)) == 0 &&
770 &rec.ir_freecount, &rec.ir_free, &j)) == 0 &&
771 j == 1 && 768 j == 1 &&
772 rec.ir_freecount > 0) { 769 rec.ir_freecount > 0) {
773 /* 770 /*
@@ -799,10 +796,8 @@ nextag:
799 goto error1; 796 goto error1;
800 doneleft = !i; 797 doneleft = !i;
801 if (!doneleft) { 798 if (!doneleft) {
802 if ((error = xfs_inobt_get_rec(tcur, 799 error = xfs_inobt_get_rec(tcur, &trec, &i);
803 &trec.ir_startino, 800 if (error)
804 &trec.ir_freecount,
805 &trec.ir_free, &i)))
806 goto error1; 801 goto error1;
807 XFS_WANT_CORRUPTED_GOTO(i == 1, error1); 802 XFS_WANT_CORRUPTED_GOTO(i == 1, error1);
808 } 803 }
@@ -813,10 +808,8 @@ nextag:
813 goto error1; 808 goto error1;
814 doneright = !i; 809 doneright = !i;
815 if (!doneright) { 810 if (!doneright) {
816 if ((error = xfs_inobt_get_rec(cur, 811 error = xfs_inobt_get_rec(cur, &rec, &i);
817 &rec.ir_startino, 812 if (error)
818 &rec.ir_freecount,
819 &rec.ir_free, &i)))
820 goto error1; 813 goto error1;
821 XFS_WANT_CORRUPTED_GOTO(i == 1, error1); 814 XFS_WANT_CORRUPTED_GOTO(i == 1, error1);
822 } 815 }
@@ -876,11 +869,9 @@ nextag:
876 goto error1; 869 goto error1;
877 doneleft = !i; 870 doneleft = !i;
878 if (!doneleft) { 871 if (!doneleft) {
879 if ((error = xfs_inobt_get_rec( 872 error = xfs_inobt_get_rec(
880 tcur, 873 tcur, &trec, &i);
881 &trec.ir_startino, 874 if (error)
882 &trec.ir_freecount,
883 &trec.ir_free, &i)))
884 goto error1; 875 goto error1;
885 XFS_WANT_CORRUPTED_GOTO(i == 1, 876 XFS_WANT_CORRUPTED_GOTO(i == 1,
886 error1); 877 error1);
@@ -896,11 +887,9 @@ nextag:
896 goto error1; 887 goto error1;
897 doneright = !i; 888 doneright = !i;
898 if (!doneright) { 889 if (!doneright) {
899 if ((error = xfs_inobt_get_rec( 890 error = xfs_inobt_get_rec(
900 cur, 891 cur, &rec, &i);
901 &rec.ir_startino, 892 if (error)
902 &rec.ir_freecount,
903 &rec.ir_free, &i)))
904 goto error1; 893 goto error1;
905 XFS_WANT_CORRUPTED_GOTO(i == 1, 894 XFS_WANT_CORRUPTED_GOTO(i == 1,
906 error1); 895 error1);
@@ -919,8 +908,7 @@ nextag:
919 be32_to_cpu(agi->agi_newino), 0, 0, &i))) 908 be32_to_cpu(agi->agi_newino), 0, 0, &i)))
920 goto error0; 909 goto error0;
921 if (i == 1 && 910 if (i == 1 &&
922 (error = xfs_inobt_get_rec(cur, &rec.ir_startino, 911 (error = xfs_inobt_get_rec(cur, &rec, &j)) == 0 &&
923 &rec.ir_freecount, &rec.ir_free, &j)) == 0 &&
924 j == 1 && 912 j == 1 &&
925 rec.ir_freecount > 0) { 913 rec.ir_freecount > 0) {
926 /* 914 /*
@@ -938,10 +926,8 @@ nextag:
938 goto error0; 926 goto error0;
939 ASSERT(i == 1); 927 ASSERT(i == 1);
940 for (;;) { 928 for (;;) {
941 if ((error = xfs_inobt_get_rec(cur, 929 error = xfs_inobt_get_rec(cur, &rec, &i);
942 &rec.ir_startino, 930 if (error)
943 &rec.ir_freecount, &rec.ir_free,
944 &i)))
945 goto error0; 931 goto error0;
946 XFS_WANT_CORRUPTED_GOTO(i == 1, error0); 932 XFS_WANT_CORRUPTED_GOTO(i == 1, error0);
947 if (rec.ir_freecount > 0) 933 if (rec.ir_freecount > 0)
@@ -975,8 +961,8 @@ nextag:
975 if ((error = xfs_inobt_lookup_ge(cur, 0, 0, 0, &i))) 961 if ((error = xfs_inobt_lookup_ge(cur, 0, 0, 0, &i)))
976 goto error0; 962 goto error0;
977 do { 963 do {
978 if ((error = xfs_inobt_get_rec(cur, &rec.ir_startino, 964 error = xfs_inobt_get_rec(cur, &rec, &i);
979 &rec.ir_freecount, &rec.ir_free, &i))) 965 if (error)
980 goto error0; 966 goto error0;
981 XFS_WANT_CORRUPTED_GOTO(i == 1, error0); 967 XFS_WANT_CORRUPTED_GOTO(i == 1, error0);
982 freecount += rec.ir_freecount; 968 freecount += rec.ir_freecount;
@@ -1084,8 +1070,8 @@ xfs_difree(
1084 if ((error = xfs_inobt_lookup_ge(cur, 0, 0, 0, &i))) 1070 if ((error = xfs_inobt_lookup_ge(cur, 0, 0, 0, &i)))
1085 goto error0; 1071 goto error0;
1086 do { 1072 do {
1087 if ((error = xfs_inobt_get_rec(cur, &rec.ir_startino, 1073 error = xfs_inobt_get_rec(cur, &rec, &i);
1088 &rec.ir_freecount, &rec.ir_free, &i))) 1074 if (error)
1089 goto error0; 1075 goto error0;
1090 if (i) { 1076 if (i) {
1091 freecount += rec.ir_freecount; 1077 freecount += rec.ir_freecount;
@@ -1107,8 +1093,8 @@ xfs_difree(
1107 goto error0; 1093 goto error0;
1108 } 1094 }
1109 XFS_WANT_CORRUPTED_GOTO(i == 1, error0); 1095 XFS_WANT_CORRUPTED_GOTO(i == 1, error0);
1110 if ((error = xfs_inobt_get_rec(cur, &rec.ir_startino, &rec.ir_freecount, 1096 error = xfs_inobt_get_rec(cur, &rec, &i);
1111 &rec.ir_free, &i))) { 1097 if (error) {
1112 cmn_err(CE_WARN, 1098 cmn_err(CE_WARN,
1113 "xfs_difree: xfs_inobt_get_rec() returned an error %d on %s. Returning error.", 1099 "xfs_difree: xfs_inobt_get_rec() returned an error %d on %s. Returning error.",
1114 error, mp->m_fsname); 1100 error, mp->m_fsname);
@@ -1187,10 +1173,8 @@ xfs_difree(
1187 if ((error = xfs_inobt_lookup_ge(cur, 0, 0, 0, &i))) 1173 if ((error = xfs_inobt_lookup_ge(cur, 0, 0, 0, &i)))
1188 goto error0; 1174 goto error0;
1189 do { 1175 do {
1190 if ((error = xfs_inobt_get_rec(cur, 1176 error = xfs_inobt_get_rec(cur, &rec, &i);
1191 &rec.ir_startino, 1177 if (error)
1192 &rec.ir_freecount,
1193 &rec.ir_free, &i)))
1194 goto error0; 1178 goto error0;
1195 if (i) { 1179 if (i) {
1196 freecount += rec.ir_freecount; 1180 freecount += rec.ir_freecount;
@@ -1312,9 +1296,7 @@ xfs_imap(
1312 chunk_agbno = agbno - offset_agbno; 1296 chunk_agbno = agbno - offset_agbno;
1313 } else { 1297 } else {
1314 xfs_btree_cur_t *cur; /* inode btree cursor */ 1298 xfs_btree_cur_t *cur; /* inode btree cursor */
1315 xfs_agino_t chunk_agino; /* first agino in inode chunk */ 1299 xfs_inobt_rec_incore_t chunk_rec;
1316 __int32_t chunk_cnt; /* count of free inodes in chunk */
1317 xfs_inofree_t chunk_free; /* mask of free inodes in chunk */
1318 xfs_buf_t *agbp; /* agi buffer */ 1300 xfs_buf_t *agbp; /* agi buffer */
1319 int i; /* temp state */ 1301 int i; /* temp state */
1320 1302
@@ -1337,8 +1319,7 @@ xfs_imap(
1337 goto error0; 1319 goto error0;
1338 } 1320 }
1339 1321
1340 error = xfs_inobt_get_rec(cur, &chunk_agino, &chunk_cnt, 1322 error = xfs_inobt_get_rec(cur, &chunk_rec, &i);
1341 &chunk_free, &i);
1342 if (error) { 1323 if (error) {
1343 xfs_fs_cmn_err(CE_ALERT, mp, "xfs_imap: " 1324 xfs_fs_cmn_err(CE_ALERT, mp, "xfs_imap: "
1344 "xfs_inobt_get_rec() failed"); 1325 "xfs_inobt_get_rec() failed");
@@ -1356,7 +1337,7 @@ xfs_imap(
1356 xfs_btree_del_cursor(cur, XFS_BTREE_NOERROR); 1337 xfs_btree_del_cursor(cur, XFS_BTREE_NOERROR);
1357 if (error) 1338 if (error)
1358 return error; 1339 return error;
1359 chunk_agbno = XFS_AGINO_TO_AGBNO(mp, chunk_agino); 1340 chunk_agbno = XFS_AGINO_TO_AGBNO(mp, chunk_rec.ir_startino);
1360 offset_agbno = agbno - chunk_agbno; 1341 offset_agbno = agbno - chunk_agbno;
1361 } 1342 }
1362 1343