1. 09 Feb, 2002 6 commits
    • Alexander Viro's avatar
      [PATCH] ext2_new_block() cleanup · 71803d3b
      Alexander Viro authored
      in ext2_new_block() inode->i_sb can't be NULL.  Dead code removed.
      
      merged returns in ext2_new_block()
      
      in ext2_new_block() added a local variable (sbi) for sb->u.ext2_sb;
      users converted. 
      
      calculation of prealloc_goal moved into beginning of function. 
      
      new local variable (block).  Initialized to 0, set to the number of
      allocated block only when we are known to be successful. 
      ext2_new_block() returns the value of 'block' now.  As the result, out:
      is gone - it's identical to out_unlock now. 
      
      check for block being chosen past the end of disk had been moved up No
      sense to check that after we had done the preallocations... 
      
      quota allocation taken into the beginning of ext2_new_block().  we put
      the number of blocks we'd reserved into dq_alloc and then decrement it
      each time old code would do DQUOT_ALLOC/increment when it would do
      DQUOT_FREE.  On the exit we release dq_alloc blocks I.e.  all
      allocations are pushed into the beginning and all freeing - to the end. 
      
      now that we had moved the last possible point of failure up, we can do
      the same with assignment of final result to block. 
      
      code that does allocation within a group had been taken out into a
      helper - grab_block(map, size, goal). 
      
      decrementing fs-wide free blocks count moved into the beginning of
      function.  We try to reserve up to dq_alloc blocks - amount we _can_
      grab is limited by the actual free space and root-reserved percentage. 
      That logics had been taken into a helper - reserve_blocks(sb, amount). 
      Number of blocks we had managed to reserve is put into es_alloc.  When
      we actually grab a block, es_alloc is decremented.  Upon the exit we
      release the leftovers.  Old code didn't honor 'reserved for root' limit
      when doing prealloc - now that had been fixed. 
      
      EXT2_BLOCKS_PER_GROUP(sb) put into a local variable (group_size)
      
      similar "reserve and release leftovers in the end" scheme for group
      (i.e.  we try to reserve as much as we want in the group, then count how
      much had been used up and release the leftovers in the end). 
      
      cleaned up the preallocation loop. 
      71803d3b
    • Alexander Viro's avatar
      [PATCH] (5/5) ext2_free_blocks() cleanup · f1228ed7
      Alexander Viro authored
      minor cleanup: update 'freed' only after we finish with group
      f1228ed7
    • Alexander Viro's avatar
      [PATCH] (4/5) ext2_free_blocks() cleanup · 4bcb2fc4
      Alexander Viro authored
      in ext2_free_blocks() inode->i_sb can't be NULL; dead code removed.
      4bcb2fc4
    • Alexander Viro's avatar
      [PATCH] (3/5) ext2_free_blocks() cleanup · a3c6da09
      Alexander Viro authored
      new helper - group_release_blocks(desc, bh, count); updates free blocks
      count for given group ext2_free_blocks now counts the blocks freed in
      group and updates the per-group free blocks count at once. 
      a3c6da09
    • Alexander Viro's avatar
      [PATCH] (2/5) ext2_free_blocks() cleanup · ccd8c95a
      Alexander Viro authored
      we postpone releasing the quota until the end of ext2_free_blocks() and
      do that at once. 
      ccd8c95a
    • Alexander Viro's avatar
      [PATCH] (1/5) ext2_free_blocks() cleanup · a12ebfc1
      Alexander Viro authored
      new helper function - release_blocks(sb, n); in ext2_free_blocks() we
      count the blocks we'd freed and update the fs-wide count of free blocks
      in the end - just before unlocking superblock.  instead of doing that
      step at a time.
      
      reviewed by ext2 folks
      a12ebfc1
  2. 08 Feb, 2002 34 commits