1. 20 8月, 2008 9 次提交
    • A
      ext4: Initialize writeback_index to 0 when allocating a new inode · 91246c00
      Aneesh Kumar K.V 提交于
      The write_cache_pages() function uses the mapping->writeback_index as
      the starting index to write out when range_cyclic is set.  Properly
      initialize writeback_index so that we start the writeout at index 0.
      
      This was found when debugging the small file fragmentation on ext4.
      Signed-off-by: NAneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>
      Signed-off-by: N"Theodore Ts'o" <tytso@mit.edu>
      91246c00
    • A
      ext4: make sure ext4_has_free_blocks returns 0 for ENOSPC · 16eb7295
      Aneesh Kumar K.V 提交于
      Fix ext4_has_free_blocks() to return 0 when we don't have enough space.
      Signed-off-by: NAneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>
      Signed-off-by: NMingming Cao <cmm@us.ibm.com>
      Signed-off-by: N"Theodore Ts'o" <tytso@mit.edu>
      16eb7295
    • M
      ext4: journal credit fix for the delayed allocation's writepages() function · 525f4ed8
      Mingming Cao 提交于
      Previous delalloc writepages implementation started a new transaction
      outside of a loop which called get_block() to do the block allocation.
      Since we didn't know exactly how many blocks would need to be allocated,
      the estimated journal credits required was very conservative and caused
      many issues.
      
      With the reworked delayed allocation, a new transaction is created for
      each get_block(), thus we don't need to guess how many credits for the
      multiple chunk of allocation.  We start every transaction with enough
      credits for inserting a single exent.  When estimate the credits for
      indirect blocks to allocate a chunk of blocks, we need to know the
      number of data blocks to allocate.  We use the total number of reserved
      delalloc datablocks; if that is too big, for non-extent files, we need
      to limit the number of blocks to EXT4_MAX_TRANS_BLOCKS.
      
      Code cleanup from Aneesh.
      Signed-off-by: NMingming Cao <cmm@us.ibm.com>
      Reviewed-off-by: NAneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>
      Signed-off-by: N"Theodore Ts'o" <tytso@mit.edu>
      525f4ed8
    • A
      ext4: Rework the ext4_da_writepages() function · a1d6cc56
      Aneesh Kumar K.V 提交于
      With the below changes we reserve credit needed to insert only one
      extent resulting from a call to single get_block.  This makes sure we
      don't take too much journal credits during writeout.  We also don't
      limit the pages to write.  That means we loop through the dirty pages
      building largest possible contiguous block request.  Then we issue a
      single get_block request.  We may get less block that we requested.  If
      so we would end up not mapping some of the buffer_heads.  That means
      those buffer_heads are still marked delay.  Later in the writepage
      callback via __mpage_writepage we redirty those pages.
      
      We should also not limit/throttle wbc->nr_to_write in the filesystem
      writepages callback. That cause wrong behaviour in
      generic_sync_sb_inodes caused by wbc->nr_to_write being <= 0
      Signed-off-by: NAneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>
      Reviewed-by: NMingming Cao <cmm@us.ibm.com>
      Signed-off-by: N"Theodore Ts'o" <tytso@mit.edu>
      a1d6cc56
    • M
      ext4: journal credits reservation fixes for DIO, fallocate · f3bd1f3f
      Mingming Cao 提交于
      DIO and fallocate credit calculation is different than writepage, as
      they do start a new journal right for each call to ext4_get_blocks_wrap().
      This patch uses the helper function in DIO and fallocate case, passing
      a flag indicating that the modified data are contigous thus could account
      less indirect/index blocks.
      
      This patch also fixed the journal credit reservation for direct I/O
      (DIO).  Previously the estimated credits for DIO only was calculated for
      non-extent files, which was not enough if the file is extent-based.
      
      Also fixed was fallocate double-counting credits for modifying the the
      superblock.
      Signed-off-by: NMingming Cao <cmm@us.ibm.com>
      Reviewed-by: NAneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>
      Signed-off-by: N"Theodore Ts'o" <tytso@mit.edu>
      f3bd1f3f
    • M
      ext4: journal credits reservation fixes for extent file writepage · ee12b630
      Mingming Cao 提交于
      This patch modified the writepage/write_begin credit calculation for
      extent files, to use the credits caculation helper function.
      
      The current calculation of how many index/leaf blocks should be
      accounted is too conservetive, it always considered the worse case,
      where the tree level is 5, and in the case of multiple chunk
      allocations, it always assumed no blocks were dirtied in common across
      the allocations. This path uses the accurate depth of the inode with
      some extras to calculate the index blocks, and also less conservative in
      the case of multiple allocation accounting.
      Signed-off-by: NMingming Cao <cmm@us.ibm.com>
      Reviewed-by: NAneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>
      Signed-off-by: N"Theodore Ts'o" <tytso@mit.edu>
      ee12b630
    • M
      ext4: journal credits calulation cleanup and fix for non-extent writepage · a02908f1
      Mingming Cao 提交于
      When considering how many journal credits are needed for modifying a
      chunk of data, we need to account for the super block, inode block,
      quota blocks and xattr block, indirect/index blocks, also, group bitmap
      and group descriptor blocks for new allocation (including data and
      indirect/index blocks). There are many places in ext4 do the calculation
      on their own and often missed one or two meta blocks, and often they
      assume single block allocation, and did not considering the multile
      chunk of allocation case.
      
      This patch is trying to cleanup current journal credit code, provides
      some common helper funtion to calculate the journal credits, to be used
      for writepage, writepages, DIO, fallocate, migration, defrag, and for
      both nonextent and extent files.
      
      This patch modified the writepage/write_begin credit caculation for
      nonextent files, to use the new helper function. It also fixed the
      problem that writepage on nonextent files did not consider the case
      blocksize <pagesize, thus could possibelly need multiple block
      allocation in a single transaction.
      Signed-off-by: NMingming Cao <cmm@us.ibm.com>
      Reviewed-by: NAneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>
      Signed-off-by: N"Theodore Ts'o" <tytso@mit.edu>
      a02908f1
    • E
      ext4: Fix bug where we return ENOSPC even though we have plenty of inodes · c001077f
      Eric Sandeen 提交于
      The find_group_flex() function starts with best_flex as the
      parent_fbg_group, which happens to have 0 inodes free.  Some of the
      flex groups searched have free blocks and free inodes, but the
      flex_freeb_ratio is < 10, so they're skipped.  Then when a group is
      compared to the current "best" flex group, it does not have more free
      blocks than "best", so it is skipped as well.
      
      This continues until no flex group with free inodes is found which has
      a proper ratio or which has more free blocks than the "best" group,
      and we're left with a "best" group that has 0 inodes free, and we
      return -ENOSPC.
      
      We fix this by changing the logic so that if the current "best" flex
      group has no inodes free, and the current one does have room, it is
      promoted to the next "best."
      Signed-off-by: NEric Sandeen <sandeen@redhat.com>
      Signed-off-by: N"Theodore Ts'o" <tytso@mit.edu>
      c001077f
    • J
      ext4: don't try to resize if there are no reserved gdt blocks left · 37609fd5
      Josef Bacik 提交于
      When trying to resize an ext4 fs and you run out of reserved gdt blocks,
      you get an error that doesn't actually tell you what went wrong, it just
      says that the gdb it picked is not correct, which is the case since you
      don't have any reserved gdt blocks left.  This patch adds a check to make
      sure you have reserved gdt blocks to use, and if not prints out a more
      relevant error.
      Signed-off-by: NJosef Bacik <jbacik@redhat.com>
      Cc: <linux-ext4@vger.kernel.org>
      Cc: Andreas Dilger <adilger@sun.com>
      Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: N"Theodore Ts'o" <tytso@mit.edu>
      37609fd5
  2. 16 8月, 2008 1 次提交
  3. 20 8月, 2008 2 次提交
  4. 14 8月, 2008 1 次提交
  5. 20 8月, 2008 1 次提交
  6. 13 8月, 2008 26 次提交