Commit 548932739b16e623601f6d7dfb31a1fe28cda050

Authored by Christoph Hellwig
Committed by Alex Elder
1 parent 55a7bc5a30

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>

Showing 2 changed files with 33 additions and 63 deletions Side-by-side Diff

... ... @@ -101,8 +101,7 @@
101 101 xfs_fsblock_t *first, /* pointer to firstblock variable */
102 102 xfs_bmap_free_t *flist, /* list of extents to be freed */
103 103 int *logflagsp, /* inode logging flags */
104   - int whichfork, /* data or attr fork */
105   - int rsvd); /* OK to allocate reserved blocks */
  104 + int whichfork); /* data or attr fork */
106 105  
107 106 /*
108 107 * Called by xfs_bmap_add_extent to handle cases converting a delayed
... ... @@ -117,8 +116,7 @@
117 116 xfs_filblks_t *dnew, /* new delayed-alloc indirect blocks */
118 117 xfs_fsblock_t *first, /* pointer to firstblock variable */
119 118 xfs_bmap_free_t *flist, /* list of extents to be freed */
120   - int *logflagsp, /* inode logging flags */
121   - int rsvd); /* OK to allocate reserved blocks */
  119 + int *logflagsp); /* inode logging flags */
122 120  
123 121 /*
124 122 * Called by xfs_bmap_add_extent to handle cases converting a hole
... ... @@ -129,8 +127,7 @@
129 127 xfs_inode_t *ip, /* incore inode pointer */
130 128 xfs_extnum_t idx, /* extent number to update/insert */
131 129 xfs_bmbt_irec_t *new, /* new data to add to file extents */
132   - int *logflagsp,/* inode logging flags */
133   - int rsvd); /* OK to allocate reserved blocks */
  130 + int *logflagsp); /* inode logging flags */
134 131  
135 132 /*
136 133 * Called by xfs_bmap_add_extent to handle cases converting a hole
... ... @@ -180,22 +177,6 @@
180 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   - */
186   -STATIC int /* error */
187   -xfs_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 180 * Remove the entry "free" from the free item list. Prev points to the
200 181 * previous entry, unless "free" is the head of the list.
201 182 */
... ... @@ -480,8 +461,7 @@
480 461 xfs_fsblock_t *first, /* pointer to firstblock variable */
481 462 xfs_bmap_free_t *flist, /* list of extents to be freed */
482 463 int *logflagsp, /* inode logging flags */
483   - int whichfork, /* data or attr fork */
484   - int rsvd) /* OK to use reserved data blocks */
  464 + int whichfork) /* data or attr fork */
485 465 {
486 466 xfs_btree_cur_t *cur; /* btree cursor or null */
487 467 xfs_filblks_t da_new; /* new count del alloc blocks used */
... ... @@ -522,8 +502,8 @@
522 502 if (cur)
523 503 ASSERT((cur->bc_private.b.flags &
524 504 XFS_BTCUR_BPRV_WASDEL) == 0);
525   - if ((error = xfs_bmap_add_extent_hole_delay(ip, idx, new,
526   - &logflags, rsvd)))
  505 + error = xfs_bmap_add_extent_hole_delay(ip, idx, new, &logflags);
  506 + if (error)
527 507 goto done;
528 508 }
529 509 /*
... ... @@ -557,9 +537,10 @@
557 537 if (cur)
558 538 ASSERT(cur->bc_private.b.flags &
559 539 XFS_BTCUR_BPRV_WASDEL);
560   - if ((error = xfs_bmap_add_extent_delay_real(ip,
561   - idx, &cur, new, &da_new, first, flist,
562   - &logflags, rsvd)))
  540 + error = xfs_bmap_add_extent_delay_real(ip, idx,
  541 + &cur, new, &da_new, first,
  542 + flist, &logflags);
  543 + if (error)
563 544 goto done;
564 545 } else if (new->br_state == XFS_EXT_NORM) {
565 546 ASSERT(new->br_state == XFS_EXT_NORM);
... ... @@ -615,7 +596,7 @@
615 596 ASSERT(nblks <= da_old);
616 597 if (nblks < da_old)
617 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 602 * Clear out the allocated field, done with it now in any case.
... ... @@ -646,8 +627,7 @@
646 627 xfs_filblks_t *dnew, /* new delayed-alloc indirect blocks */
647 628 xfs_fsblock_t *first, /* pointer to firstblock variable */
648 629 xfs_bmap_free_t *flist, /* list of extents to be freed */
649   - int *logflagsp, /* inode logging flags */
650   - int rsvd) /* OK to use reserved data block allocation */
  630 + int *logflagsp) /* inode logging flags */
651 631 {
652 632 xfs_btree_cur_t *cur; /* btree cursor */
653 633 int diff; /* temp value */
... ... @@ -1097,7 +1077,7 @@
1097 1077 (cur ? cur->bc_private.b.allocated : 0));
1098 1078 if (diff > 0 &&
1099 1079 xfs_icsb_modify_counters(ip->i_mount, XFS_SBS_FDBLOCKS,
1100   - -((int64_t)diff), rsvd)) {
  1080 + -((int64_t)diff), 0)) {
1101 1081 /*
1102 1082 * Ick gross gag me with a spoon.
1103 1083 */
... ... @@ -1109,7 +1089,7 @@
1109 1089 if (!diff ||
1110 1090 !xfs_icsb_modify_counters(ip->i_mount,
1111 1091 XFS_SBS_FDBLOCKS,
1112   - -((int64_t)diff), rsvd))
  1092 + -((int64_t)diff), 0))
1113 1093 break;
1114 1094 }
1115 1095 if (temp2) {
... ... @@ -1118,7 +1098,7 @@
1118 1098 if (!diff ||
1119 1099 !xfs_icsb_modify_counters(ip->i_mount,
1120 1100 XFS_SBS_FDBLOCKS,
1121   - -((int64_t)diff), rsvd))
  1101 + -((int64_t)diff), 0))
1122 1102 break;
1123 1103 }
1124 1104 }
... ... @@ -1652,8 +1632,7 @@
1652 1632 xfs_inode_t *ip, /* incore inode pointer */
1653 1633 xfs_extnum_t idx, /* extent number to update/insert */
1654 1634 xfs_bmbt_irec_t *new, /* new data to add to file extents */
1655   - int *logflagsp, /* inode logging flags */
1656   - int rsvd) /* OK to allocate reserved blocks */
  1635 + int *logflagsp) /* inode logging flags */
1657 1636 {
1658 1637 xfs_bmbt_rec_host_t *ep; /* extent record for idx */
1659 1638 xfs_ifork_t *ifp; /* inode fork pointer */
... ... @@ -1787,7 +1766,7 @@
1787 1766 if (oldlen != newlen) {
1788 1767 ASSERT(oldlen > newlen);
1789 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 1771 * Nothing to do for disk quota accounting here.
1793 1772 */
... ... @@ -2838,8 +2817,7 @@
2838 2817 xfs_btree_cur_t *cur, /* if null, not a btree */
2839 2818 xfs_bmbt_irec_t *del, /* data to remove from extents */
2840 2819 int *logflagsp, /* inode logging flags */
2841   - int whichfork, /* data or attr fork */
2842   - int rsvd) /* OK to allocate reserved blocks */
  2820 + int whichfork) /* data or attr fork */
2843 2821 {
2844 2822 xfs_filblks_t da_new; /* new delay-alloc indirect blocks */
2845 2823 xfs_filblks_t da_old; /* old delay-alloc indirect blocks */
... ... @@ -3142,7 +3120,7 @@
3142 3120 ASSERT(da_old >= da_new);
3143 3121 if (da_old > da_new) {
3144 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 }
3147 3125 done:
3148 3126 *logflagsp = flags;
3149 3127  
3150 3128  
3151 3129  
3152 3130  
... ... @@ -4562,29 +4540,24 @@
4562 4540 if (rt) {
4563 4541 error = xfs_mod_incore_sb(mp,
4564 4542 XFS_SBS_FREXTENTS,
4565   - -((int64_t)extsz), (flags &
4566   - XFS_BMAPI_RSVBLOCKS));
  4543 + -((int64_t)extsz), 0);
4567 4544 } else {
4568 4545 error = xfs_icsb_modify_counters(mp,
4569 4546 XFS_SBS_FDBLOCKS,
4570   - -((int64_t)alen), (flags &
4571   - XFS_BMAPI_RSVBLOCKS));
  4547 + -((int64_t)alen), 0);
4572 4548 }
4573 4549 if (!error) {
4574 4550 error = xfs_icsb_modify_counters(mp,
4575 4551 XFS_SBS_FDBLOCKS,
4576   - -((int64_t)indlen), (flags &
4577   - XFS_BMAPI_RSVBLOCKS));
  4552 + -((int64_t)indlen), 0);
4578 4553 if (error && rt)
4579 4554 xfs_mod_incore_sb(mp,
4580 4555 XFS_SBS_FREXTENTS,
4581   - (int64_t)extsz, (flags &
4582   - XFS_BMAPI_RSVBLOCKS));
  4556 + (int64_t)extsz, 0);
4583 4557 else if (error)
4584 4558 xfs_icsb_modify_counters(mp,
4585 4559 XFS_SBS_FDBLOCKS,
4586   - (int64_t)alen, (flags &
4587   - XFS_BMAPI_RSVBLOCKS));
  4560 + (int64_t)alen, 0);
4588 4561 }
4589 4562  
4590 4563 if (error) {
... ... @@ -4703,7 +4676,7 @@
4703 4676 }
4704 4677 error = xfs_bmap_add_extent(ip, lastx, &cur, &got,
4705 4678 firstblock, flist, &tmp_logflags,
4706   - whichfork, (flags & XFS_BMAPI_RSVBLOCKS));
  4679 + whichfork);
4707 4680 logflags |= tmp_logflags;
4708 4681 if (error)
4709 4682 goto error0;
... ... @@ -4805,7 +4778,7 @@
4805 4778 : XFS_EXT_UNWRITTEN;
4806 4779 error = xfs_bmap_add_extent(ip, lastx, &cur, mval,
4807 4780 firstblock, flist, &tmp_logflags,
4808   - whichfork, (flags & XFS_BMAPI_RSVBLOCKS));
  4781 + whichfork);
4809 4782 logflags |= tmp_logflags;
4810 4783 if (error)
4811 4784 goto error0;
... ... @@ -5026,7 +4999,6 @@
5026 4999 int tmp_logflags; /* partial logging flags */
5027 5000 int wasdel; /* was a delayed alloc extent */
5028 5001 int whichfork; /* data or attribute fork */
5029   - int rsvd; /* OK to allocate reserved blocks */
5030 5002 xfs_fsblock_t sum;
5031 5003  
5032 5004 trace_xfs_bunmap(ip, bno, len, flags, _RET_IP_);
... ... @@ -5044,7 +5016,7 @@
5044 5016 mp = ip->i_mount;
5045 5017 if (XFS_FORCED_SHUTDOWN(mp))
5046 5018 return XFS_ERROR(EIO);
5047   - rsvd = (flags & XFS_BMAPI_RSVBLOCKS) != 0;
  5019 +
5048 5020 ASSERT(len > 0);
5049 5021 ASSERT(nexts >= 0);
5050 5022 ASSERT(ifp->if_ext_max ==
... ... @@ -5162,7 +5134,7 @@
5162 5134 del.br_state = XFS_EXT_UNWRITTEN;
5163 5135 error = xfs_bmap_add_extent(ip, lastx, &cur, &del,
5164 5136 firstblock, flist, &logflags,
5165   - XFS_DATA_FORK, 0);
  5137 + XFS_DATA_FORK);
5166 5138 if (error)
5167 5139 goto error0;
5168 5140 goto nodelete;
... ... @@ -5216,7 +5188,7 @@
5216 5188 prev.br_state = XFS_EXT_UNWRITTEN;
5217 5189 error = xfs_bmap_add_extent(ip, lastx - 1, &cur,
5218 5190 &prev, firstblock, flist, &logflags,
5219   - XFS_DATA_FORK, 0);
  5191 + XFS_DATA_FORK);
5220 5192 if (error)
5221 5193 goto error0;
5222 5194 goto nodelete;
... ... @@ -5225,7 +5197,7 @@
5225 5197 del.br_state = XFS_EXT_UNWRITTEN;
5226 5198 error = xfs_bmap_add_extent(ip, lastx, &cur,
5227 5199 &del, firstblock, flist, &logflags,
5228   - XFS_DATA_FORK, 0);
  5200 + XFS_DATA_FORK);
5229 5201 if (error)
5230 5202 goto error0;
5231 5203 goto nodelete;
5232 5204  
... ... @@ -5240,13 +5212,13 @@
5240 5212 rtexts = XFS_FSB_TO_B(mp, del.br_blockcount);
5241 5213 do_div(rtexts, mp->m_sb.sb_rextsize);
5242 5214 xfs_mod_incore_sb(mp, XFS_SBS_FREXTENTS,
5243   - (int64_t)rtexts, rsvd);
  5215 + (int64_t)rtexts, 0);
5244 5216 (void)xfs_trans_reserve_quota_nblks(NULL,
5245 5217 ip, -((long)del.br_blockcount), 0,
5246 5218 XFS_QMOPT_RES_RTBLKS);
5247 5219 } else {
5248 5220 xfs_icsb_modify_counters(mp, XFS_SBS_FDBLOCKS,
5249   - (int64_t)del.br_blockcount, rsvd);
  5221 + (int64_t)del.br_blockcount, 0);
5250 5222 (void)xfs_trans_reserve_quota_nblks(NULL,
5251 5223 ip, -((long)del.br_blockcount), 0,
5252 5224 XFS_QMOPT_RES_REGBLKS);
... ... @@ -5278,7 +5250,7 @@
5278 5250 goto error0;
5279 5251 }
5280 5252 error = xfs_bmap_del_extent(ip, tp, lastx, flist, cur, &del,
5281   - &tmp_logflags, whichfork, rsvd);
  5253 + &tmp_logflags, whichfork);
5282 5254 logflags |= tmp_logflags;
5283 5255 if (error)
5284 5256 goto error0;
... ... @@ -69,7 +69,6 @@
69 69 #define XFS_BMAPI_ENTIRE 0x004 /* return entire extent, not trimmed */
70 70 #define XFS_BMAPI_METADATA 0x008 /* mapping metadata not user data */
71 71 #define XFS_BMAPI_ATTRFORK 0x010 /* use attribute fork not data */
72   -#define XFS_BMAPI_RSVBLOCKS 0x020 /* OK to alloc. reserved data blocks */
73 72 #define XFS_BMAPI_PREALLOC 0x040 /* preallocation op: unwritten space */
74 73 #define XFS_BMAPI_IGSTATE 0x080 /* Ignore state - */
75 74 /* combine contig. space */
... ... @@ -87,7 +86,6 @@
87 86 { XFS_BMAPI_ENTIRE, "ENTIRE" }, \
88 87 { XFS_BMAPI_METADATA, "METADATA" }, \
89 88 { XFS_BMAPI_ATTRFORK, "ATTRFORK" }, \
90   - { XFS_BMAPI_RSVBLOCKS, "RSVBLOCKS" }, \
91 89 { XFS_BMAPI_PREALLOC, "PREALLOC" }, \
92 90 { XFS_BMAPI_IGSTATE, "IGSTATE" }, \
93 91 { XFS_BMAPI_CONTIG, "CONTIG" }, \