[PATCH] xfs_bmap_add_extent_delay_real should set br_startoff

Ben Myers
2011-01-12T19:38:50Z

When filling in the middle of a previous delayed allocation, set
br_startoff of the new delay extent to the right to NULLSTARTBLOCK so that
it is ignored by xfs_bmap_extent_to_btree. This prevents a forced shutdown
when that in-core extent is converted from delay to real and is found to be
already in the btree. The value is overwritten below.

SGI-PV: 1013221

Signed-off-by: Ben Myers <bpm@sgi.com>
---
fs/xfs/xfs_bmap.c | 5 +++--
1 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/fs/xfs/xfs_bmap.c b/fs/xfs/xfs_bmap.c
index 4111cd3..cd75c77 100644
--- a/fs/xfs/xfs_bmap.c
+++ b/fs/xfs/xfs_bmap.c
@@ -1040,13 +1040,14 @@ xfs_bmap_add_extent_delay_real(
* This case is avoided almost all the time.
*/
temp = new->br_startoff - PREV.br_startoff;
+ temp2 = PREV.br_startoff + PREV.br_blockcount - new_endoff;
trace_xfs_bmap_pre_update(ip, idx, 0, _THIS_IP_);
xfs_bmbt_set_blockcount(ep, temp);
r[0] = *new;
r[1].br_state = PREV.br_state;
- r[1].br_startblock = 0;
+ r[1].br_startblock = nullstartblock(
+ (int)xfs_bmap_worst_indlen(ip, temp2));
r[1].br_startoff = new_endoff;
- temp2 = PREV.br_startoff + PREV.br_blockcount - new_endoff;
r[1].br_blockcount = temp2;
xfs_iext_insert(ip, idx + 1, 2, &r[0], state);
ip->i_df.if_lastex = idx + 1;