1. 26 Apr, 2009 2 commits
  2. 01 May, 2009 1 commit
    • Theodore Ts'o's avatar
      ext4: ext4_mark_recovery_complete() doesn't need to use lock_super · a63c9eb2
      Theodore Ts'o authored
      The function ext4_mark_recovery_complete() is called from two call
      paths: either (a) while mounting the filesystem, in which case there's
      no danger of any other CPU calling write_super() until the mount is
      completed, and (b) while remounting the filesystem read-write, in
      which case the fs core has already locked the superblock.  This also
      allows us to take out a very vile unlock_super()/lock_super() pair in
      ext4_remount().
      Signed-off-by: default avatar"Theodore Ts'o" <tytso@mit.edu>
      a63c9eb2
  3. 25 Apr, 2009 1 commit
  4. 01 May, 2009 4 commits
    • Theodore Ts'o's avatar
      ext4: Avoid races caused by on-line resizing and SMP memory reordering · 8df9675f
      Theodore Ts'o authored
      Ext4's on-line resizing adds a new block group and then, only at the
      last step adjusts s_groups_count.  However, it's possible on SMP
      systems that another CPU could see the updated the s_group_count and
      not see the newly initialized data structures for the just-added block
      group.  For this reason, it's important to insert a SMP read barrier
      after reading s_groups_count and before reading any (for example) the
      new block group descriptors allowed by the increased value of
      s_groups_count.
      
      Unfortunately, we rather blatently violate this locking protocol
      documented in fs/ext4/resize.c.  Fortunately, (1) on-line resizes
      happen relatively rarely, and (2) it seems rare that the filesystem
      code will immediately try to use just-added block group before any
      memory ordering issues resolve themselves.  So apparently problems
      here are relatively hard to hit, since ext3 has been vulnerable to the
      same issue for years with no one apparently complaining.
      Signed-off-by: default avatar"Theodore Ts'o" <tytso@mit.edu>
      8df9675f
    • Theodore Ts'o's avatar
      ext4: Use separate super_operations structure for no_journal filesystems · 9ca92389
      Theodore Ts'o authored
      By using a separate super_operations structure for filesystems that
      have and don't have journals, we can simply ext4_write_super() ---
      which is only needed when no journal is present --- and ext4_freeze(),
      ext4_unfreeze(), and ext4_sync_fs(), which are only needed when the
      journal is present.
      Signed-off-by: default avatar"Theodore Ts'o" <tytso@mit.edu>
      9ca92389
    • Theodore Ts'o's avatar
      ext4: Fix and simplify s_dirt handling · 7234ab2a
      Theodore Ts'o authored
      The s_dirt flag wasn't completely handled correctly, but it didn't
      really matter when journalling was enabled.  It turns out that when
      ext4 runs without a journal, we don't clear s_dirt in places where we
      should have, with the result that the high-level write_super()
      function was writing the superblock when it wasn't necessary.
      
      So we fix this by making ext4_commit_super() clear the s_dirt flag,
      and removing many of the other places where s_dirt is manipulated.
      When journalling is enabled, the s_dirt flag might be left set more
      often, but s_dirt really doesn't matter when journalling is enabled.
      Signed-off-by: default avatar"Theodore Ts'o" <tytso@mit.edu>
      7234ab2a
    • Theodore Ts'o's avatar
      ext4: Simplify ext4_commit_super()'s function signature · e2d67052
      Theodore Ts'o authored
      The ext4_commit_super() function took both a struct super_block * and
      a struct ext4_super_block *, but the struct ext4_super_block can be
      derived from the struct super_block.
      Signed-off-by: default avatar"Theodore Ts'o" <tytso@mit.edu>
      e2d67052
  5. 25 Apr, 2009 1 commit
  6. 28 Apr, 2009 1 commit
    • Theodore Ts'o's avatar
      ext4: Fallback to vmalloc if kmalloc can't allocate s_flex_groups array · c5ca7c76
      Theodore Ts'o authored
      For very large filesystems, the s_flex_groups array can get quite big.
      For example, a filesystem that can be resized up to 16TB will have
      8192 flex groups (assuming the default flex_bg size of 16), so the
      array is 96k, which is *very* marginal for kmalloc().  On the other
      hand, a 160GB filesystem without the resize_inode feature will only
      require 960 bytes.  So we try to allocate the array first using
      kmalloc(), and if that fails, we'll try to use vmalloc() instead.
      Signed-off-by: default avatar"Theodore Ts'o" <tytso@mit.edu>
      c5ca7c76
  7. 12 May, 2009 2 commits
    • Aneesh Kumar K.V's avatar
      ext4: Mark the unwritten buffer_head as mapped during write_begin · 29fa89d0
      Aneesh Kumar K.V authored
      Setting BH_Unwritten buffer_heads as BH_Mapped avoids multiple
      (unnecessary) calls to get_block() during the call to the write(2)
      system call.  Setting BH_Unwritten buffer heads as BH_Mapped requires
      that the writepages() functions can handle BH_Unwritten buffer_heads.
      
      After this commit, things work as follows:
      
      ext4_ext_get_block() returns unmapped, unwritten, buffer head when
      called with create = 0 for prealloc space. This makes sure we handle
      the read path and non-delayed allocation case correctly.  Even though
      the buffer head is marked unmapped we have valid b_blocknr and b_bdev
      values in the buffer_head.
      
      ext4_da_get_block_prep() called for block resrevation will now return
      mapped, unwritten, new buffer_head for prealloc space. This avoids
      multiple calls to get_block() for write to same offset. By making such
      buffers as BH_New, we also assure that sub-block zeroing of buffered
      writes happens correctly.
      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>
      29fa89d0
    • Aneesh Kumar K.V's avatar
      vfs: Add BUG_ON for delayed and unwritten flags in submit_bh() · 8fb0e342
      Aneesh Kumar K.V authored
      The BH_Delay and BH_Unwritten flags should never leak out to
      submit_bh().  So add some BUG_ON() checks to submit_bh so we can get a
      stack trace and determine how and why this might have happened.
      
      (Note that only XFS and ext4 use these buffer head flags, and XFS does
      not use submit_bh().  So this patch should only modify behavior for
      ext4.)
      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>
      Cc: linux-fsdevel@vger.kernel.org
      8fb0e342
  8. 13 May, 2009 1 commit
  9. 03 Jun, 2009 2 commits
  10. 02 Jun, 2009 11 commits
  11. 01 Jun, 2009 12 commits
  12. 31 May, 2009 1 commit
  13. 30 May, 2009 1 commit