aboutsummaryrefslogtreecommitdiffstats
path: root/fs/xfs/xfs_bmap.c
diff options
context:
space:
mode:
authorChristoph Hellwig <hch@infradead.org>2011-05-11 11:04:03 -0400
committerAlex Elder <aelder@sgi.com>2011-05-25 11:48:36 -0400
commit548932739b16e623601f6d7dfb31a1fe28cda050 (patch)
tree6966aeb6ad9c6e066e37b1b86c9a95df8f4f5957 /fs/xfs/xfs_bmap.c
parent55a7bc5a30ff2d30d8a34fea2af9fc601b32e61a (diff)
xfs: remove the unused XFS_BMAPI_RSVBLOCKS flag
The XFS_BMAPI_RSVBLOCKS is unused, and as far as I can see has always been. Remove it to simplify the bmapi implementation and conserve stack space. Signed-off-by: Christoph Hellwig <hch@lst.de> Signed-off-by: Alex Elder <aelder@sgi.com>
Diffstat (limited to 'fs/xfs/xfs_bmap.c')
-rw-r--r--fs/xfs/xfs_bmap.c94
1 files changed, 33 insertions, 61 deletions
diff --git a/fs/xfs/xfs_bmap.c b/fs/xfs/xfs_bmap.c
index fa00788de2f5..d4fc8ccafa08 100644
--- a/fs/xfs/xfs_bmap.c
+++ b/fs/xfs/xfs_bmap.c
@@ -101,8 +101,7 @@ xfs_bmap_add_extent(
101 xfs_fsblock_t *first, /* pointer to firstblock variable */ 101 xfs_fsblock_t *first, /* pointer to firstblock variable */
102 xfs_bmap_free_t *flist, /* list of extents to be freed */ 102 xfs_bmap_free_t *flist, /* list of extents to be freed */
103 int *logflagsp, /* inode logging flags */ 103 int *logflagsp, /* inode logging flags */
104 int whichfork, /* data or attr fork */ 104 int whichfork); /* data or attr fork */
105 int rsvd); /* OK to allocate reserved blocks */
106 105
107/* 106/*
108 * Called by xfs_bmap_add_extent to handle cases converting a delayed 107 * Called by xfs_bmap_add_extent to handle cases converting a delayed
@@ -117,8 +116,7 @@ xfs_bmap_add_extent_delay_real(
117 xfs_filblks_t *dnew, /* new delayed-alloc indirect blocks */ 116 xfs_filblks_t *dnew, /* new delayed-alloc indirect blocks */
118 xfs_fsblock_t *first, /* pointer to firstblock variable */ 117 xfs_fsblock_t *first, /* pointer to firstblock variable */
119 xfs_bmap_free_t *flist, /* list of extents to be freed */ 118 xfs_bmap_free_t *flist, /* list of extents to be freed */
120 int *logflagsp, /* inode logging flags */ 119 int *logflagsp); /* inode logging flags */
121 int rsvd); /* OK to allocate reserved blocks */
122 120
123/* 121/*
124 * Called by xfs_bmap_add_extent to handle cases converting a hole 122 * Called by xfs_bmap_add_extent to handle cases converting a hole
@@ -129,8 +127,7 @@ xfs_bmap_add_extent_hole_delay(
129 xfs_inode_t *ip, /* incore inode pointer */ 127 xfs_inode_t *ip, /* incore inode pointer */
130 xfs_extnum_t idx, /* extent number to update/insert */ 128 xfs_extnum_t idx, /* extent number to update/insert */
131 xfs_bmbt_irec_t *new, /* new data to add to file extents */ 129 xfs_bmbt_irec_t *new, /* new data to add to file extents */
132 int *logflagsp,/* inode logging flags */ 130 int *logflagsp); /* inode logging flags */
133 int rsvd); /* OK to allocate reserved blocks */
134 131
135/* 132/*
136 * Called by xfs_bmap_add_extent to handle cases converting a hole 133 * Called by xfs_bmap_add_extent to handle cases converting a hole
@@ -180,22 +177,6 @@ xfs_bmap_btree_to_extents(
180 int whichfork); /* data or attr fork */ 177 int whichfork); /* data or attr fork */
181 178
182/* 179/*
183 * Called by xfs_bmapi to update file extent records and the btree
184 * after removing space (or undoing a delayed allocation).
185 */
186STATIC int /* error */
187xfs_bmap_del_extent(
188 xfs_inode_t *ip, /* incore inode pointer */
189 xfs_trans_t *tp, /* current trans pointer */
190 xfs_extnum_t idx, /* extent number to update/insert */
191 xfs_bmap_free_t *flist, /* list of extents to be freed */
192 xfs_btree_cur_t *cur, /* if null, not a btree */
193 xfs_bmbt_irec_t *new, /* new data to add to file extents */
194 int *logflagsp,/* inode logging flags */
195 int whichfork, /* data or attr fork */
196 int rsvd); /* OK to allocate reserved blocks */
197
198/*
199 * Remove the entry "free" from the free item list. Prev points to the 180 * Remove the entry "free" from the free item list. Prev points to the
200 * previous entry, unless "free" is the head of the list. 181 * previous entry, unless "free" is the head of the list.
201 */ 182 */
@@ -480,8 +461,7 @@ xfs_bmap_add_extent(
480 xfs_fsblock_t *first, /* pointer to firstblock variable */ 461 xfs_fsblock_t *first, /* pointer to firstblock variable */
481 xfs_bmap_free_t *flist, /* list of extents to be freed */ 462 xfs_bmap_free_t *flist, /* list of extents to be freed */
482 int *logflagsp, /* inode logging flags */ 463 int *logflagsp, /* inode logging flags */
483 int whichfork, /* data or attr fork */ 464 int whichfork) /* data or attr fork */
484 int rsvd) /* OK to use reserved data blocks */
485{ 465{
486 xfs_btree_cur_t *cur; /* btree cursor or null */ 466 xfs_btree_cur_t *cur; /* btree cursor or null */
487 xfs_filblks_t da_new; /* new count del alloc blocks used */ 467 xfs_filblks_t da_new; /* new count del alloc blocks used */
@@ -522,8 +502,8 @@ xfs_bmap_add_extent(
522 if (cur) 502 if (cur)
523 ASSERT((cur->bc_private.b.flags & 503 ASSERT((cur->bc_private.b.flags &
524 XFS_BTCUR_BPRV_WASDEL) == 0); 504 XFS_BTCUR_BPRV_WASDEL) == 0);
525 if ((error = xfs_bmap_add_extent_hole_delay(ip, idx, new, 505 error = xfs_bmap_add_extent_hole_delay(ip, idx, new, &logflags);
526 &logflags, rsvd))) 506 if (error)
527 goto done; 507 goto done;
528 } 508 }
529 /* 509 /*
@@ -557,9 +537,10 @@ xfs_bmap_add_extent(
557 if (cur) 537 if (cur)
558 ASSERT(cur->bc_private.b.flags & 538 ASSERT(cur->bc_private.b.flags &
559 XFS_BTCUR_BPRV_WASDEL); 539 XFS_BTCUR_BPRV_WASDEL);
560 if ((error = xfs_bmap_add_extent_delay_real(ip, 540 error = xfs_bmap_add_extent_delay_real(ip, idx,
561 idx, &cur, new, &da_new, first, flist, 541 &cur, new, &da_new, first,
562 &logflags, rsvd))) 542 flist, &logflags);
543 if (error)
563 goto done; 544 goto done;
564 } else if (new->br_state == XFS_EXT_NORM) { 545 } else if (new->br_state == XFS_EXT_NORM) {
565 ASSERT(new->br_state == XFS_EXT_NORM); 546 ASSERT(new->br_state == XFS_EXT_NORM);
@@ -615,7 +596,7 @@ xfs_bmap_add_extent(
615 ASSERT(nblks <= da_old); 596 ASSERT(nblks <= da_old);
616 if (nblks < da_old) 597 if (nblks < da_old)
617 xfs_icsb_modify_counters(ip->i_mount, XFS_SBS_FDBLOCKS, 598 xfs_icsb_modify_counters(ip->i_mount, XFS_SBS_FDBLOCKS,
618 (int64_t)(da_old - nblks), rsvd); 599 (int64_t)(da_old - nblks), 0);
619 } 600 }
620 /* 601 /*
621 * Clear out the allocated field, done with it now in any case. 602 * Clear out the allocated field, done with it now in any case.
@@ -646,8 +627,7 @@ xfs_bmap_add_extent_delay_real(
646 xfs_filblks_t *dnew, /* new delayed-alloc indirect blocks */ 627 xfs_filblks_t *dnew, /* new delayed-alloc indirect blocks */
647 xfs_fsblock_t *first, /* pointer to firstblock variable */ 628 xfs_fsblock_t *first, /* pointer to firstblock variable */
648 xfs_bmap_free_t *flist, /* list of extents to be freed */ 629 xfs_bmap_free_t *flist, /* list of extents to be freed */
649 int *logflagsp, /* inode logging flags */ 630 int *logflagsp) /* inode logging flags */
650 int rsvd) /* OK to use reserved data block allocation */
651{ 631{
652 xfs_btree_cur_t *cur; /* btree cursor */ 632 xfs_btree_cur_t *cur; /* btree cursor */
653 int diff; /* temp value */ 633 int diff; /* temp value */
@@ -1097,7 +1077,7 @@ xfs_bmap_add_extent_delay_real(
1097 (cur ? cur->bc_private.b.allocated : 0)); 1077 (cur ? cur->bc_private.b.allocated : 0));
1098 if (diff > 0 && 1078 if (diff > 0 &&
1099 xfs_icsb_modify_counters(ip->i_mount, XFS_SBS_FDBLOCKS, 1079 xfs_icsb_modify_counters(ip->i_mount, XFS_SBS_FDBLOCKS,
1100 -((int64_t)diff), rsvd)) { 1080 -((int64_t)diff), 0)) {
1101 /* 1081 /*
1102 * Ick gross gag me with a spoon. 1082 * Ick gross gag me with a spoon.
1103 */ 1083 */
@@ -1109,7 +1089,7 @@ xfs_bmap_add_extent_delay_real(
1109 if (!diff || 1089 if (!diff ||
1110 !xfs_icsb_modify_counters(ip->i_mount, 1090 !xfs_icsb_modify_counters(ip->i_mount,
1111 XFS_SBS_FDBLOCKS, 1091 XFS_SBS_FDBLOCKS,
1112 -((int64_t)diff), rsvd)) 1092 -((int64_t)diff), 0))
1113 break; 1093 break;
1114 } 1094 }
1115 if (temp2) { 1095 if (temp2) {
@@ -1118,7 +1098,7 @@ xfs_bmap_add_extent_delay_real(
1118 if (!diff || 1098 if (!diff ||
1119 !xfs_icsb_modify_counters(ip->i_mount, 1099 !xfs_icsb_modify_counters(ip->i_mount,
1120 XFS_SBS_FDBLOCKS, 1100 XFS_SBS_FDBLOCKS,
1121 -((int64_t)diff), rsvd)) 1101 -((int64_t)diff), 0))
1122 break; 1102 break;
1123 } 1103 }
1124 } 1104 }
@@ -1652,8 +1632,7 @@ xfs_bmap_add_extent_hole_delay(
1652 xfs_inode_t *ip, /* incore inode pointer */ 1632 xfs_inode_t *ip, /* incore inode pointer */
1653 xfs_extnum_t idx, /* extent number to update/insert */ 1633 xfs_extnum_t idx, /* extent number to update/insert */
1654 xfs_bmbt_irec_t *new, /* new data to add to file extents */ 1634 xfs_bmbt_irec_t *new, /* new data to add to file extents */
1655 int *logflagsp, /* inode logging flags */ 1635 int *logflagsp) /* inode logging flags */
1656 int rsvd) /* OK to allocate reserved blocks */
1657{ 1636{
1658 xfs_bmbt_rec_host_t *ep; /* extent record for idx */ 1637 xfs_bmbt_rec_host_t *ep; /* extent record for idx */
1659 xfs_ifork_t *ifp; /* inode fork pointer */ 1638 xfs_ifork_t *ifp; /* inode fork pointer */
@@ -1787,7 +1766,7 @@ xfs_bmap_add_extent_hole_delay(
1787 if (oldlen != newlen) { 1766 if (oldlen != newlen) {
1788 ASSERT(oldlen > newlen); 1767 ASSERT(oldlen > newlen);
1789 xfs_icsb_modify_counters(ip->i_mount, XFS_SBS_FDBLOCKS, 1768 xfs_icsb_modify_counters(ip->i_mount, XFS_SBS_FDBLOCKS,
1790 (int64_t)(oldlen - newlen), rsvd); 1769 (int64_t)(oldlen - newlen), 0);
1791 /* 1770 /*
1792 * Nothing to do for disk quota accounting here. 1771 * Nothing to do for disk quota accounting here.
1793 */ 1772 */
@@ -2838,8 +2817,7 @@ xfs_bmap_del_extent(
2838 xfs_btree_cur_t *cur, /* if null, not a btree */ 2817 xfs_btree_cur_t *cur, /* if null, not a btree */
2839 xfs_bmbt_irec_t *del, /* data to remove from extents */ 2818 xfs_bmbt_irec_t *del, /* data to remove from extents */
2840 int *logflagsp, /* inode logging flags */ 2819 int *logflagsp, /* inode logging flags */
2841 int whichfork, /* data or attr fork */ 2820 int whichfork) /* data or attr fork */
2842 int rsvd) /* OK to allocate reserved blocks */
2843{ 2821{
2844 xfs_filblks_t da_new; /* new delay-alloc indirect blocks */ 2822 xfs_filblks_t da_new; /* new delay-alloc indirect blocks */
2845 xfs_filblks_t da_old; /* old delay-alloc indirect blocks */ 2823 xfs_filblks_t da_old; /* old delay-alloc indirect blocks */
@@ -3142,7 +3120,7 @@ xfs_bmap_del_extent(
3142 ASSERT(da_old >= da_new); 3120 ASSERT(da_old >= da_new);
3143 if (da_old > da_new) { 3121 if (da_old > da_new) {
3144 xfs_icsb_modify_counters(mp, XFS_SBS_FDBLOCKS, 3122 xfs_icsb_modify_counters(mp, XFS_SBS_FDBLOCKS,
3145 (int64_t)(da_old - da_new), rsvd); 3123 (int64_t)(da_old - da_new), 0);
3146 } 3124 }
3147done: 3125done:
3148 *logflagsp = flags; 3126 *logflagsp = flags;
@@ -4562,29 +4540,24 @@ xfs_bmapi(
4562 if (rt) { 4540 if (rt) {
4563 error = xfs_mod_incore_sb(mp, 4541 error = xfs_mod_incore_sb(mp,
4564 XFS_SBS_FREXTENTS, 4542 XFS_SBS_FREXTENTS,
4565 -((int64_t)extsz), (flags & 4543 -((int64_t)extsz), 0);
4566 XFS_BMAPI_RSVBLOCKS));
4567 } else { 4544 } else {
4568 error = xfs_icsb_modify_counters(mp, 4545 error = xfs_icsb_modify_counters(mp,
4569 XFS_SBS_FDBLOCKS, 4546 XFS_SBS_FDBLOCKS,
4570 -((int64_t)alen), (flags & 4547 -((int64_t)alen), 0);
4571 XFS_BMAPI_RSVBLOCKS));
4572 } 4548 }
4573 if (!error) { 4549 if (!error) {
4574 error = xfs_icsb_modify_counters(mp, 4550 error = xfs_icsb_modify_counters(mp,
4575 XFS_SBS_FDBLOCKS, 4551 XFS_SBS_FDBLOCKS,
4576 -((int64_t)indlen), (flags & 4552 -((int64_t)indlen), 0);
4577 XFS_BMAPI_RSVBLOCKS));
4578 if (error && rt) 4553 if (error && rt)
4579 xfs_mod_incore_sb(mp, 4554 xfs_mod_incore_sb(mp,
4580 XFS_SBS_FREXTENTS, 4555 XFS_SBS_FREXTENTS,
4581 (int64_t)extsz, (flags & 4556 (int64_t)extsz, 0);
4582 XFS_BMAPI_RSVBLOCKS));
4583 else if (error) 4557 else if (error)
4584 xfs_icsb_modify_counters(mp, 4558 xfs_icsb_modify_counters(mp,
4585 XFS_SBS_FDBLOCKS, 4559 XFS_SBS_FDBLOCKS,
4586 (int64_t)alen, (flags & 4560 (int64_t)alen, 0);
4587 XFS_BMAPI_RSVBLOCKS));
4588 } 4561 }
4589 4562
4590 if (error) { 4563 if (error) {
@@ -4703,7 +4676,7 @@ xfs_bmapi(
4703 } 4676 }
4704 error = xfs_bmap_add_extent(ip, lastx, &cur, &got, 4677 error = xfs_bmap_add_extent(ip, lastx, &cur, &got,
4705 firstblock, flist, &tmp_logflags, 4678 firstblock, flist, &tmp_logflags,
4706 whichfork, (flags & XFS_BMAPI_RSVBLOCKS)); 4679 whichfork);
4707 logflags |= tmp_logflags; 4680 logflags |= tmp_logflags;
4708 if (error) 4681 if (error)
4709 goto error0; 4682 goto error0;
@@ -4805,7 +4778,7 @@ xfs_bmapi(
4805 : XFS_EXT_UNWRITTEN; 4778 : XFS_EXT_UNWRITTEN;
4806 error = xfs_bmap_add_extent(ip, lastx, &cur, mval, 4779 error = xfs_bmap_add_extent(ip, lastx, &cur, mval,
4807 firstblock, flist, &tmp_logflags, 4780 firstblock, flist, &tmp_logflags,
4808 whichfork, (flags & XFS_BMAPI_RSVBLOCKS)); 4781 whichfork);
4809 logflags |= tmp_logflags; 4782 logflags |= tmp_logflags;
4810 if (error) 4783 if (error)
4811 goto error0; 4784 goto error0;
@@ -5026,7 +4999,6 @@ xfs_bunmapi(
5026 int tmp_logflags; /* partial logging flags */ 4999 int tmp_logflags; /* partial logging flags */
5027 int wasdel; /* was a delayed alloc extent */ 5000 int wasdel; /* was a delayed alloc extent */
5028 int whichfork; /* data or attribute fork */ 5001 int whichfork; /* data or attribute fork */
5029 int rsvd; /* OK to allocate reserved blocks */
5030 xfs_fsblock_t sum; 5002 xfs_fsblock_t sum;
5031 5003
5032 trace_xfs_bunmap(ip, bno, len, flags, _RET_IP_); 5004 trace_xfs_bunmap(ip, bno, len, flags, _RET_IP_);
@@ -5044,7 +5016,7 @@ xfs_bunmapi(
5044 mp = ip->i_mount; 5016 mp = ip->i_mount;
5045 if (XFS_FORCED_SHUTDOWN(mp)) 5017 if (XFS_FORCED_SHUTDOWN(mp))
5046 return XFS_ERROR(EIO); 5018 return XFS_ERROR(EIO);
5047 rsvd = (flags & XFS_BMAPI_RSVBLOCKS) != 0; 5019
5048 ASSERT(len > 0); 5020 ASSERT(len > 0);
5049 ASSERT(nexts >= 0); 5021 ASSERT(nexts >= 0);
5050 ASSERT(ifp->if_ext_max == 5022 ASSERT(ifp->if_ext_max ==
@@ -5162,7 +5134,7 @@ xfs_bunmapi(
5162 del.br_state = XFS_EXT_UNWRITTEN; 5134 del.br_state = XFS_EXT_UNWRITTEN;
5163 error = xfs_bmap_add_extent(ip, lastx, &cur, &del, 5135 error = xfs_bmap_add_extent(ip, lastx, &cur, &del,
5164 firstblock, flist, &logflags, 5136 firstblock, flist, &logflags,
5165 XFS_DATA_FORK, 0); 5137 XFS_DATA_FORK);
5166 if (error) 5138 if (error)
5167 goto error0; 5139 goto error0;
5168 goto nodelete; 5140 goto nodelete;
@@ -5216,7 +5188,7 @@ xfs_bunmapi(
5216 prev.br_state = XFS_EXT_UNWRITTEN; 5188 prev.br_state = XFS_EXT_UNWRITTEN;
5217 error = xfs_bmap_add_extent(ip, lastx - 1, &cur, 5189 error = xfs_bmap_add_extent(ip, lastx - 1, &cur,
5218 &prev, firstblock, flist, &logflags, 5190 &prev, firstblock, flist, &logflags,
5219 XFS_DATA_FORK, 0); 5191 XFS_DATA_FORK);
5220 if (error) 5192 if (error)
5221 goto error0; 5193 goto error0;
5222 goto nodelete; 5194 goto nodelete;
@@ -5225,7 +5197,7 @@ xfs_bunmapi(
5225 del.br_state = XFS_EXT_UNWRITTEN; 5197 del.br_state = XFS_EXT_UNWRITTEN;
5226 error = xfs_bmap_add_extent(ip, lastx, &cur, 5198 error = xfs_bmap_add_extent(ip, lastx, &cur,
5227 &del, firstblock, flist, &logflags, 5199 &del, firstblock, flist, &logflags,
5228 XFS_DATA_FORK, 0); 5200 XFS_DATA_FORK);
5229 if (error) 5201 if (error)
5230 goto error0; 5202 goto error0;
5231 goto nodelete; 5203 goto nodelete;
@@ -5240,13 +5212,13 @@ xfs_bunmapi(
5240 rtexts = XFS_FSB_TO_B(mp, del.br_blockcount); 5212 rtexts = XFS_FSB_TO_B(mp, del.br_blockcount);
5241 do_div(rtexts, mp->m_sb.sb_rextsize); 5213 do_div(rtexts, mp->m_sb.sb_rextsize);
5242 xfs_mod_incore_sb(mp, XFS_SBS_FREXTENTS, 5214 xfs_mod_incore_sb(mp, XFS_SBS_FREXTENTS,
5243 (int64_t)rtexts, rsvd); 5215 (int64_t)rtexts, 0);
5244 (void)xfs_trans_reserve_quota_nblks(NULL, 5216 (void)xfs_trans_reserve_quota_nblks(NULL,
5245 ip, -((long)del.br_blockcount), 0, 5217 ip, -((long)del.br_blockcount), 0,
5246 XFS_QMOPT_RES_RTBLKS); 5218 XFS_QMOPT_RES_RTBLKS);
5247 } else { 5219 } else {
5248 xfs_icsb_modify_counters(mp, XFS_SBS_FDBLOCKS, 5220 xfs_icsb_modify_counters(mp, XFS_SBS_FDBLOCKS,
5249 (int64_t)del.br_blockcount, rsvd); 5221 (int64_t)del.br_blockcount, 0);
5250 (void)xfs_trans_reserve_quota_nblks(NULL, 5222 (void)xfs_trans_reserve_quota_nblks(NULL,
5251 ip, -((long)del.br_blockcount), 0, 5223 ip, -((long)del.br_blockcount), 0,
5252 XFS_QMOPT_RES_REGBLKS); 5224 XFS_QMOPT_RES_REGBLKS);
@@ -5278,7 +5250,7 @@ xfs_bunmapi(
5278 goto error0; 5250 goto error0;
5279 } 5251 }
5280 error = xfs_bmap_del_extent(ip, tp, lastx, flist, cur, &del, 5252 error = xfs_bmap_del_extent(ip, tp, lastx, flist, cur, &del,
5281 &tmp_logflags, whichfork, rsvd); 5253 &tmp_logflags, whichfork);
5282 logflags |= tmp_logflags; 5254 logflags |= tmp_logflags;
5283 if (error) 5255 if (error)
5284 goto error0; 5256 goto error0;