fs/reiser4/plugin/item/extent_flush_ops.c |   14 ++++++++++++--
1 files changed, 12 insertions(+), 2 deletions(-)

diff -puN fs/reiser4/plugin/item/extent_flush_ops.c~reiser4-tmp fs/reiser4/plugin/item/extent_flush_ops.c
--- linux-2.6.12-rc2-mm3/fs/reiser4/plugin/item/extent_flush_ops.c~reiser4-tmp  2005-04-20 13:13:41.079187315 +0400
+++ linux-2.6.12-rc2-mm3-vs/fs/reiser4/plugin/item/extent_flush_ops.c   2005-04-20 16:34:23.764774684 +0400
@@ -279,7 +279,9 @@ exit:
/* ask block allocator for some blocks */
static void
extent_allocate_blocks(reiser4_blocknr_hint *preceder,
-                      reiser4_block_nr wanted_count, reiser4_block_nr *first_allocated, reiser4_block_nr *allocated, block_stage_t block_stage)
+                      reiser4_block_nr wanted_count,
+                      reiser4_block_nr *first_allocated, reiser4_block_nr *allocated,
+                      block_stage_t block_stage)
{
       *allocated = wanted_count;
       preceder->max_dist = 0; /* scan whole disk, if needed */
@@ -288,7 +290,7 @@ extent_allocate_blocks(reiser4_blocknr_h
       preceder->block_stage = block_stage;

       /* FIXME: we do not handle errors here now */
-       check_me("vs-420", reiser4_alloc_blocks (preceder, first_allocated, allocated, BA_PERMANENT) == 0);
+       check_me("vs-420", reiser4_alloc_blocks(preceder, first_allocated, allocated, BA_PERMANENT) == 0);
       /* update flush_pos's preceder to last allocated block number */
       preceder->blk = *first_allocated + *allocated - 1;
}
@@ -795,6 +797,10 @@ alloc_extent(flush_pos_t *flush_pos)
               else
                       block_stage = BLOCK_UNALLOCATED;

+               /* look at previous unit if possible. If it is allocated, make preceder more precise */
+               if (coord->unit_pos && (state_of_extent(ext - 1) == ALLOCATED_EXTENT))
+                       pos_hint(flush_pos)->blk = extent_get_start(ext - 1) + extent_get_width(ext - 1);
+
               /* allocate new block numbers for protected nodes */
               extent_allocate_blocks(pos_hint(flush_pos), protected, &first_allocated, &allocated, block_stage);

@@ -934,6 +940,10 @@ squalloc_extent(znode *left, const coord
               else
                       block_stage = BLOCK_UNALLOCATED;

+               /* look at previous unit if possible. If it is allocated, make preceder more precise */
+               if (coord->unit_pos && (state_of_extent(ext - 1) == ALLOCATED_EXTENT))
+                       pos_hint(flush_pos)->blk = extent_get_start(ext - 1) + extent_get_width(ext - 1);
+
               /* allocate new block numbers for protected nodes */
               extent_allocate_blocks(pos_hint(flush_pos), protected, &first_allocated, &allocated, block_stage);
               if (allocated != protected)

_