1. 28 Dec, 2012 4 commits
  2. 24 Dec, 2012 6 commits
  3. 21 Dec, 2012 1 commit
  4. 20 Dec, 2012 3 commits
    • Theodore Ts'o's avatar
      e2fsck: make sure the extent tree is consistent after bogus node in the tree · 29e8e74e
      Theodore Ts'o authored
      Commit 789bd401 ("e2fsck: fix incorrect interior node logical start
      values") surfaced a bug where if e2fsck finds and removed an invalid
      node in the extent tree, i.e.:
      
      Inode 12 has an invalid extent node (blk 22, lblk 0)
      Clear? yes
      
      It was possible for starting logical blocks found in the interior
      nodes of the extent tree.  Commit 789bd401
      
       added the ability for
      e2fsck to discover this problem, which resulted in the test
      f_extent_bad_node to fail when the second pass of e2fsck reported the
      following complaint:
      
      Interior extent node level 0 of inode 12:
      Logical start 0 does not match logical start 3 at next level.  Fix? yes
      
      This patch fixes this by adding a call to ext2fs_extent_fix_parents()
      after deleting the bogus node in the extent tree.
      Signed-off-by: default avatar"Theodore Ts'o" <tytso@mit.edu>
      29e8e74e
    • Theodore Ts'o's avatar
      libext2fs: ext2fs_extents_fix_parents() should not modify the handle location · eacf6a08
      Theodore Ts'o authored
      
      Previously, ext2fs_extent_fix_parents() would only avoid modifying the
      cursor location associated with the extent handle the cursor was
      pointed at a leaf node in the extent tree.  This is because it saved
      the starting logical block number of the current extent, but not the
      "level" of the extent (where level 0 is the leaf node, level 1 is the
      interior node which points at blocks containing leaf nodes, etc.)
      
      Fix ext2fs_extent_fix_parents() so it is guaranteed to not change the
      current extent in the handle even if the current extent is not at the
      bottom of the tree.
      
      Also add a fix_extent command to the tst_extents program to make it
      easier to test this function.
      Signed-off-by: default avatar"Theodore Ts'o" <tytso@mit.edu>
      eacf6a08
    • Eric Sandeen's avatar
      e2fsck: fix incorrect interior node logical start values · 789bd401
      Eric Sandeen authored
      
      An index node's logical start (ei_block) should
      match the logical start of the first node (index
      or leaf) below it.  If we find a node whose start
      does not match its parent, fix all of its parents
      accordingly.
      
      If it finds such a problem, we'll see:
      
      Pass 1: Checking inodes, blocks, and sizes
      Interior extent node level 0 of inode 274258:
      Logical start 3666 does not match logical start 4093 at next level.  Fix<y>?
      Signed-off-by: default avatarEric Sandeen <sandeen@redhat.com>
      Signed-off-by: default avatar"Theodore Ts'o" <tytso@mit.edu>
      789bd401
  5. 17 Dec, 2012 2 commits
    • Mikael Pettersson's avatar
      libext2fs: remove m68k-specific bitops code · dbe5c43b
      Mikael Pettersson authored
      
      The current m68k code was buggy for multiple reasons; first the bfset,
      et. al commands interpret the bit number as a signed number, not an
      unsigned number.  Secondly, there were missing memory clobbers.  Since
      there is no real benefit in using explicit asm's at this point (gcc is
      smart enough to optimize the generic C code to use the set/clear/test
      bit m68k instruction) fix this bug by removing the m68k specific asm
      versions of these functions.
      
      Tested on m68k-linux with e2fsprogs-1.42.6 and gcc-4.6.3 as before.
      All tests pass and the debug output looks sane.
      
      I compared the e2fsck binaries from the previous build with this
      one.  They had identical .text sizes, and almost the same number
      of bit field instructions (obviously compiler-generated), so this
      change should have no serious performance implications.
      Signed-off-by: default avatarMikael Pettersson <mikpe@it.uu.se>
      Signed-off-by: default avatar"Theodore Ts'o" <tytso@mit.edu>
      Cc: Andreas Schwab <schwab@linux-m68k.org>
      dbe5c43b
    • Theodore Ts'o's avatar
      libext2fs: fix memory and fd leak in error path of unix_open() · 4e0bb5eb
      Theodore Ts'o authored
      
      Fix a potential memory leak reported by Li Xi.  In addition, there
      were possible error cases where the file descriptor would not be
      properly closed, so fix those as well while we're at it.
      Signed-off-by: default avatar"Theodore Ts'o" <tytso@mit.edu>
      Reported-by: default avatarLi Xi <pkuelelixi@gmail.com>
      4e0bb5eb
  6. 16 Dec, 2012 3 commits
  7. 06 Dec, 2012 1 commit
  8. 30 Nov, 2012 1 commit
  9. 29 Nov, 2012 7 commits
  10. 27 Nov, 2012 2 commits
  11. 26 Nov, 2012 2 commits
  12. 14 Oct, 2012 1 commit
  13. 11 Oct, 2012 5 commits
    • Theodore Ts'o's avatar
      e2fsck: only consult inode_dir_map if needed in pass4 · dd0c9a3c
      Theodore Ts'o authored
      
      In e2fsck_pass4(), we were consulting inode_dir_map using
      ext2fs_test_inode_bitmap2() for every single inode in the file system.
      However, there were many cases where we never needed the result of the
      test --- most notably if the inode is not in use.
      
      I was a bit surprised that GCC 4.7 with CFLAGS set to "-g -O2" wasn't
      able to optimize this out for us, but here is the pass 4 timing for an
      empty 3T file system before this patch:
      
      Pass 4: Memory used: 672k/772k (422k/251k), time:  3.67/ 3.66/ 0.00
      
      and afterwards, we see a 43% improvement:
      
      Pass 4: Memory used: 672k/772k (422k/251k), time:  2.09/ 2.08/ 0.00
      Signed-off-by: default avatar"Theodore Ts'o" <tytso@mit.edu>
      dd0c9a3c
    • Theodore Ts'o's avatar
      Fix makefiles to compile e2freefrag with profiling · 51fb43dd
      Theodore Ts'o authored
      
      Also fix a bug caused by a stray continuation backslash which caused
      the e2fsck/Makefile to fail when profiling is enabled.
      Signed-off-by: default avatar"Theodore Ts'o" <tytso@mit.edu>
      Reviewed-by: default avatarEric Sandeen <sandeen@redhat.com>
      51fb43dd
    • Theodore Ts'o's avatar
      libext2fs: further optimize rb_test_bit · fb129bba
      Theodore Ts'o authored
      
      Profiling shows that rb_test_bit() is now calling ext2fs_rb_next() a
      lot, and this function is now the hot spot when running e2freefrag.
      If we cache the results of ext2fs_rb_next(), we can eliminate those
      extra calls, which further speeds up both e2freefrag and e2fsck by
      reducing the amount of CPU time spent in userspace.
      Signed-off-by: default avatar"Theodore Ts'o" <tytso@mit.edu>
      fb129bba
    • Theodore Ts'o's avatar
      libext2fs: remove pointless indirection in rbtree bitmaps · 0bcba36f
      Theodore Ts'o authored
      
      The code was previously allocating a single 4 or 8 byte pointer for
      the rcursor and wcursor fields in the ext2fs_rb_private structure;
      this added two extra memory allocations (which could fail), and extra
      indirections, for no good reason.  Removing the extra indirection also
      makes the code more readable, so it's all upside and no downside.
      Signed-off-by: default avatar"Theodore Ts'o" <tytso@mit.edu>
      Reviewed-by: default avatarEric Sandeen <sandeen@redhat.com>
      0bcba36f
    • Theodore Ts'o's avatar
      libext2fs: optimize rb_test_bit · 547a59a8
      Theodore Ts'o authored
      
      Optimize testing for a bit in an rbtree-based bitmap for the case
      where the calling application is scanning through the bitmap
      sequentially.  Previously, we did this for a set of bits which were
      inside an allocated extent, but we did not optimize the case where
      there was a large number of bits after an allocated extents which were
      not in use.
      
                   1111111111111110000000000000000000
                   ^ optimized    ^not optimized
      
      In my tests of a roughly half-filled file system, the run time of
      e2freefrag was halved, and the cpu time spent in userspace was during
      e2fsck's pass 5 was reduced by a factor of 30%.
      Signed-off-by: default avatar"Theodore Ts'o" <tytso@mit.edu>
      Reviewed-by: default avatarLukas Czerner <lczerner@redhat.com>
      547a59a8
  14. 05 Oct, 2012 1 commit
    • Theodore Ts'o's avatar
      e2freefrag: use 64-bit rbtree bitmaps · ea2d3788
      Theodore Ts'o authored
      
      Enable the use of 64-bit bitmaps, so e2freefrag will work on file
      systems with the 64-bit feature enabled.  In addition, enable the
      rbtree-based bitmaps, which significantly saves the amount of memory
      required (from 97 megs to 1.7 megs for an empty 3T file system) at the
      cost of additional CPU overhead (but we will claw back some of the
      additional CPU overhead in the next commit).
      
      Addresses-Google-Bug: 7269948
      Signed-off-by: default avatar"Theodore Ts'o" <tytso@mit.edu>
      ea2d3788
  15. 23 Sep, 2012 1 commit