| To: | xfs@xxxxxxxxxxx |
|---|---|
| Subject: | [PATCH 02/27] xfs: remove impossible to read code in xfs_bmap_add_extent_delay_real |
| From: | Christoph Hellwig <hch@xxxxxxxxxxxxx> |
| Date: | Sun, 18 Sep 2011 16:40:42 -0400 |
| References: | <20110918204040.266805129@xxxxxxxxxxxxxxxxxxxxxx> |
| User-agent: | quilt/0.48-1 |
We already have the worst case blocks reserved, so xfs_icsb_modify_counters
won't fail in xfs_bmap_add_extent_delay_real. In fact we've had an assert
to catch this case since day and it never triggered. So remove the code
to try smaller reservations, and just return the error for that case in
addition to keeping the assert.
Signed-off-by: Christoph Hellwig <hch@xxxxxx>
Reviewed-by: Alex Elder <aelder@xxxxxxx>
Index: xfs/fs/xfs/xfs_bmap.c
===================================================================
--- xfs.orig/fs/xfs/xfs_bmap.c 2011-07-15 11:29:03.408815322 -0700
+++ xfs/fs/xfs/xfs_bmap.c 2011-07-15 11:29:16.985408438 -0700
@@ -1045,34 +1045,15 @@ xfs_bmap_add_extent_delay_real(
temp2 = xfs_bmap_worst_indlen(ip, temp2);
diff = (int)(temp + temp2 - startblockval(PREV.br_startblock) -
(cur ? cur->bc_private.b.allocated : 0));
- if (diff > 0 &&
- xfs_icsb_modify_counters(ip->i_mount, XFS_SBS_FDBLOCKS,
- -((int64_t)diff), 0)) {
- /*
- * Ick gross gag me with a spoon.
- */
- ASSERT(0); /* want to see if this ever happens! */
- while (diff > 0) {
- if (temp) {
- temp--;
- diff--;
- if (!diff ||
-
!xfs_icsb_modify_counters(ip->i_mount,
- XFS_SBS_FDBLOCKS,
- -((int64_t)diff), 0))
- break;
- }
- if (temp2) {
- temp2--;
- diff--;
- if (!diff ||
-
!xfs_icsb_modify_counters(ip->i_mount,
- XFS_SBS_FDBLOCKS,
- -((int64_t)diff), 0))
- break;
- }
- }
+ if (diff > 0) {
+ error = xfs_icsb_modify_counters(ip->i_mount,
+ XFS_SBS_FDBLOCKS,
+ -((int64_t)diff), 0);
+ ASSERT(!error);
+ if (error)
+ goto done;
}
+
ep = xfs_iext_get_ext(ifp, *idx);
xfs_bmbt_set_startblock(ep, nullstartblock((int)temp));
trace_xfs_bmap_post_update(ip, *idx, state, _THIS_IP_);
|
| Previous by Date: | [PATCH 07/27] xfs: factor delalloc reservations out of xfs_bmapi, Christoph Hellwig |
|---|---|
| Next by Date: | [PATCH 09/27] xfs: do not use xfs_bmap_add_extent for adding delalloc extents, Christoph Hellwig |
| Previous by Thread: | [PATCH 07/27] xfs: factor delalloc reservations out of xfs_bmapi, Christoph Hellwig |
| Next by Thread: | [PATCH 09/27] xfs: do not use xfs_bmap_add_extent for adding delalloc extents, Christoph Hellwig |
| Indexes: | [Date] [Thread] [Top] [All Lists] |