Skip to content
  1. Oct 19, 2007
  2. Oct 18, 2007
    • Eric Sandeen's avatar
      ext4: lighten up resize transaction requirements · 14904107
      Eric Sandeen authored
      
      
      When resizing online, setup_new_group_blocks attempts to reserve a
      potentially very large transaction, depending on the current filesystem
      geometry.  For some journal sizes, there may not be enough room for this
      transaction, and the online resize will fail.
      
      The patch below resizes & restarts the transaction as necessary while
      setting up the new group, and should work with even the smallest journal.
      
      Tested with something like:
      
      [root@newbox ~]# dd if=/dev/zero of=fsfile bs=1024 count=32768
      [root@newbox ~]# mkfs.ext3 -b 1024 fsfile 16384
      [root@newbox ~]# mount -o loop fsfile mnt/
      [root@newbox ~]# resize2fs /dev/loop0
      resize2fs 1.40.2 (12-Jul-2007)
      Filesystem at /dev/loop0 is mounted on /root/mnt; on-line resizing required
      old desc_blocks = 1, new_desc_blocks = 1
      Performing an on-line resize of /dev/loop0 to 32768 (1k) blocks.
      resize2fs: No space left on device While trying to add group #2
      [root@newbox ~]# dmesg | tail -n 1
      JBD: resize2fs wants too many credits (258 > 256)
      [root@newbox ~]#
      
      With the below change, it works.
      
      Signed-off-by: default avatarEric Sandeen <sandeen@redhat.com>
      Signed-off-by: default avatarMingming Cao <cmm@us.ibm.com>
      Acked-by: default avatarAndreas Dilger <adilger@clusterfs.com>
      14904107
    • Eric Sandeen's avatar
      ext4: fix setup_new_group_blocks locking · 5b615287
      Eric Sandeen authored
      
      
      setup_new_group_blocks() manipulates the group descriptor block bh
      under the block_bitmap bh's lock.  It shouldn't matter since nobody
      but resize should be touching these blocks, but it's worth fixing up.
      
      Signed-off-by: default avatarEric Sandeen <sandeen@redhat.com>
      Signed-off-by: default avatarMingming Cao <cmm@us.ibm.com>
      5b615287
    • Aneesh Kumar K.V's avatar
      ext4: sparse fixes · ac39849d
      Aneesh Kumar K.V authored
      
      
      Signed-off-by: default avatarAneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>
      ac39849d
    • Aneesh Kumar K.V's avatar
      ext4: Convert ext4_extent_idx.ei_leaf to ext4_extent_idx.ei_leaf_lo · d8dd0b45
      Aneesh Kumar K.V authored
      
      
      Convert ext4_extent_idx.ei_leaf  ext4_extent_idx.ei_leaf_lo
      This helps in finding BUGs due to direct partial access of
      these split 48 bit values.
      
      Signed-off-by: default avatarAneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>
      d8dd0b45
    • Aneesh Kumar K.V's avatar
      ext4: Convert ext4_extent.ee_start to ext4_extent.ee_start_lo · b377611d
      Aneesh Kumar K.V authored
      
      
      Convert ext4_extent.ee_start to ext4_extent.ee_start_lo
      This helps in finding BUGs due to direct partial access of
      these split 48 bit values
      
      Also fix direct partial access in ext4 code
      
      Signed-off-by: default avatarAneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>
      b377611d
    • Aneesh Kumar K.V's avatar
      ext4: Convert s_r_blocks_count and s_free_blocks_count · 308ba3ec
      Aneesh Kumar K.V authored
      
      
      Convert s_r_blocks_count and s_free_blocks_count to
      s_r_blocks_count_lo and s_free_blocks_count_lo
      
      This helps in finding BUGs due to direct partial access of
      these split 64 bit values
      
      Also fix direct partial access in ext4 code
      
      Signed-off-by: default avatarAneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>
      Signed-off-by: default avatar"Theodore Ts'o" <tytso@mit.edu>
      308ba3ec
    • Aneesh Kumar K.V's avatar
      ext4: Convert s_blocks_count to s_blocks_count_lo · 6bc9feff
      Aneesh Kumar K.V authored
      
      
      Convert s_blocks_count to s_blocks_count_lo
      This helps in finding BUGs due to direct partial access of
      these split 64 bit values
      
      Also fix direct partial access in ext4 code
      
      Signed-off-by: default avatarAneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>
      6bc9feff
    • Aneesh Kumar K.V's avatar
      ext4: Convert bg_inode_bitmap and bg_inode_table · 5272f837
      Aneesh Kumar K.V authored
      
      
      Convert bg_inode_bitmap and bg_inode_table to bg_inode_bitmap_lo
      and bg_inode_table_lo.  This helps in finding BUGs due to
      direct partial access of these split 64 bit values
      
      Also fix one direct partial access
      
      Signed-off-by: default avatarAneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>
      5272f837
    • Aneesh Kumar K.V's avatar
      ext4: Convert bg_block_bitmap to bg_block_bitmap_lo · 3a14589c
      Aneesh Kumar K.V authored
      
      
      Convert bg_block_bitmap to bg_block_bitmap_lo
      This helps in catching some BUGS due to direct
      partial access of these split fields.
      
      Signed-off-by: default avatarAneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>
      3a14589c
    • Jose R. Santos's avatar
      ext4: FLEX_BG Kernel support v2. · ce421581
      Jose R. Santos authored
      
      
      This feature relaxes check restrictions on where each block groups meta
      data is located within the storage media.  This allows for the allocation
      of bitmaps or inode tables outside the block group boundaries in cases
      where bad blocks forces us to look for new blocks which the owning block
      group can not satisfy.  This will also allow for new meta-data allocation
      schemes to improve performance and scalability.
      
      Signed-off-by: default avatarJose R. Santos <jrs@us.ibm.com>
      Cc: <linux-ext4@vger.kernel.org>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      ce421581
    • Aneesh Kumar K.V's avatar
    • Andreas Dilger's avatar
      Ext4: Uninitialized Block Groups · 717d50e4
      Andreas Dilger authored
      
      
      In pass1 of e2fsck, every inode table in the fileystem is scanned and checked,
      regardless of whether it is in use.  This is this the most time consuming part
      of the filesystem check.  The unintialized block group feature can greatly
      reduce e2fsck time by eliminating checking of uninitialized inodes.
      
      With this feature, there is a a high water mark of used inodes for each block
      group.  Block and inode bitmaps can be uninitialized on disk via a flag in the
      group descriptor to avoid reading or scanning them at e2fsck time.  A checksum
      of each group descriptor is used to ensure that corruption in the group
      descriptor's bit flags does not cause incorrect operation.
      
      The feature is enabled through a mkfs option
      
      	mke2fs /dev/ -O uninit_groups
      
      A patch adding support for uninitialized block groups to e2fsprogs tools has
      been posted to the linux-ext4 mailing list.
      
      The patches have been stress tested with fsstress and fsx.  In performance
      tests testing e2fsck time, we have seen that e2fsck time on ext3 grows
      linearly with the total number of inodes in the filesytem.  In ext4 with the
      uninitialized block groups feature, the e2fsck time is constant, based
      solely on the number of used inodes rather than the total inode count.
      Since typical ext4 filesystems only use 1-10% of their inodes, this feature can
      greatly reduce e2fsck time for users.  With performance improvement of 2-20
      times, depending on how full the filesystem is.
      
      The attached graph shows the major improvements in e2fsck times in filesystems
      with a large total inode count, but few inodes in use.
      
      In each group descriptor if we have
      
      EXT4_BG_INODE_UNINIT set in bg_flags:
              Inode table is not initialized/used in this group. So we can skip
              the consistency check during fsck.
      EXT4_BG_BLOCK_UNINIT set in bg_flags:
              No block in the group is used. So we can skip the block bitmap
              verification for this group.
      
      We also add two new fields to group descriptor as a part of
      uninitialized group patch.
      
              __le16  bg_itable_unused;       /* Unused inodes count */
              __le16  bg_checksum;            /* crc16(sb_uuid+group+desc) */
      
      bg_itable_unused:
      
      If we have EXT4_BG_INODE_UNINIT not set in bg_flags
      then bg_itable_unused will give the offset within
      the inode table till the inodes are used. This can be
      used by fsck to skip list of inodes that are marked unused.
      
      bg_checksum:
      Now that we depend on bg_flags and bg_itable_unused to determine
      the block and inode usage, we need to make sure group descriptor
      is not corrupt. We add checksum to group descriptor to
      detect corruption. If the descriptor is found to be corrupt, we
      mark all the blocks and inodes in the group used.
      
      Signed-off-by: default avatarAvantika Mathur <mathur@us.ibm.com>
      Signed-off-by: default avatarAndreas Dilger <adilger@clusterfs.com>
      Signed-off-by: default avatarMingming Cao <cmm@us.ibm.com>
      Signed-off-by: default avatarAneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>
      717d50e4