1. 10 Dec, 2012 27 commits
  2. 05 Dec, 2012 1 commit
  3. 02 Dec, 2012 1 commit
  4. 30 Nov, 2012 2 commits
  5. 28 Nov, 2012 4 commits
    • Theodore Ts'o's avatar
      ext4: rationalize ext4_extents.h inclusion · 4a092d73
      Theodore Ts'o authored
      Previously, ext4_extents.h was being included at the end of ext4.h,
      which was bad for a number of reasons: (a) it was not being included
      in the expected place, and (b) it caused the header to be included
      multiple times.  There were #ifdef's to prevent this from causing any
      problems, but it still was unnecessary.
      
      By moving the function declarations that were in ext4_extents.h to
      ext4.h, which is standard practice for where the function declarations
      for the rest of ext4.h can be found, we can remove ext4_extents.h from
      being included in ext4.h at all, and then we can only include
      ext4_extents.h where it is needed in ext4's source files.
      
      It should be possible to move a few more things into ext4.h, and
      further reduce the number of source files that need to #include
      ext4_extents.h, but that's a cleanup for another day.
      Reported-by: default avatarSachin Kamat <sachin.kamat@linaro.org>
      Reported-by: default avatarWei Yongjun <weiyj.lk@gmail.com>
      Signed-off-by: default avatar"Theodore Ts'o" <tytso@mit.edu>
      4a092d73
    • Vahram Martirosyan's avatar
      ext4: fixed potential NULL dereference in ext4_calculate_overhead() · 766f44d4
      Vahram Martirosyan authored
      The memset operation before check can cause a BUG if the memory
      allocation failed.  Since we are using get_zeroed_age, there is no
      need to use memset anyway.
      
      Found by the Spruce system in cooperation with the KEDR Framework.
      Signed-off-by: default avatarVahram Martirosyan <vmartirosyan@linuxtesting.org>
      Signed-off-by: default avatar"Theodore Ts'o" <tytso@mit.edu>
      766f44d4
    • Lukas Czerner's avatar
      ext4: simple cleanup in fiemap codepath · 06348679
      Lukas Czerner authored
      This commit is simple cleanup of fiemap codepath which has not been
      included in previous commit to make the changes clearer. In this commit
      we rename cbex variable to newex in ext4_fill_fiemap_extents() because
      callback is no longer present
      Signed-off-by: default avatarLukas Czerner <lczerner@redhat.com>
      Signed-off-by: default avatar"Theodore Ts'o" <tytso@mit.edu>
      06348679
    • Lukas Czerner's avatar
      ext4: prevent race while walking extent tree for fiemap · 91dd8c11
      Lukas Czerner authored
      Currently ext4_ext_walk_space() only takes i_data_sem for read when
      searching for the extent at given block with ext4_ext_find_extent().
      Then it drops the lock and the extent tree can be changed at will.
      However later on we're searching for the 'next' extent, but the extent
      tree might already have changed, so the information might not be
      accurate.
      
      In fact we can hit BUG_ON(end <= start) if the extent got inserted into
      the tree after the one we found and before the block we were searching
      for. This has been reproduced by running xfstests 225 in loop on s390x
      architecture, but theoretically we could hit this on any other
      architecture as well, but probably not as often.
      
      Moreover the extent currently in delayed allocation might be allocated
      after we search the extent tree and before we search extent status tree
      delayed buffers resulting in those delayed buffers being completely
      missed, even though completely written and allocated.
      
      We fix all those problems in several steps:
      
       1. remove unnecessary callback indirection
       2. rename functions
              ext4_ext_walk_space -> ext4_fill_fiemap_extents
              ext4_ext_fiemap_cb -> ext4_find_delayed_extent
       3. move fiemap_fill_next_extent() into ext4_fill_fiemap_extents()
       4. hold the i_data_sem for:
              ext4_ext_find_extent()
              ext4_ext_next_allocated_block()
              ext4_find_delayed_extent()
       5. call fiemap_fill_next_extent after releasing the i_data_sem
       6. move path reinitialization into the critical section.
      Signed-off-by: default avatarLukas Czerner <lczerner@redhat.com>
      Signed-off-by: default avatar"Theodore Ts'o" <tytso@mit.edu>
      91dd8c11
  6. 16 Nov, 2012 1 commit
    • Theodore Ts'o's avatar
      ext4: remove calls to ext4_jbd2_file_inode() from delalloc write path · f3b59291
      Theodore Ts'o authored
      The calls to ext4_jbd2_file_inode() are needed to guarantee that we do
      not expose stale data in the data=ordered mode.  However, they are not
      necessary because in all of the cases where we have newly allocated
      blocks in the delayed allocation write path, we immediately submit the
      dirty pages for I/O.  Hence, we can avoid the overhead of adding the
      inode to the list of inodes whose data pages will be to be flushed out
      to disk completely during the next commit operation.
      Signed-off-by: default avatar"Theodore Ts'o" <tytso@mit.edu>
      f3b59291
  7. 15 Nov, 2012 1 commit
  8. 13 Nov, 2012 1 commit
  9. 11 Nov, 2012 1 commit
  10. 09 Nov, 2012 1 commit
    • Zheng Liu's avatar
      ext4: introduce lseek SEEK_DATA/SEEK_HOLE support · c8c0df24
      Zheng Liu authored
      This patch makes ext4 really support SEEK_DATA/SEEK_HOLE flags.  Block-mapped
      and extent-mapped files are fully implemented together because ext4_map_blocks
      hides this differences.
      
      After applying this patch, it will cause a failure in xfstest #285 when the file
      is block-mapped due to block-mapped file isn't support fallocate(2).
      
      I had tried to use ext4_ext_walk_space() to retrieve the offset for a
      extent-mapped file.  But finally I decide to keep using ext4_map_blocks() to
      support SEEK_DATA/SEEK_HOLE because ext4_map_blocks() can hide the difference
      between block-mapped file and extent-mapped file.  Moreover, in next step,
      extent status tree will track all extent status, and we can get all mappings
      from this tree.  So I think that using ext4_map_blocks() is a better choice.
      
      CC: Hugh Dickins <hughd@google.com>
      Signed-off-by: default avatarJie Liu <jeff.liu@oracle.com>
      Signed-off-by: default avatarZheng Liu <wenqing.lz@taobao.com>
      Signed-off-by: default avatar"Theodore Ts'o" <tytso@mit.edu>
      c8c0df24