1. 28 2月, 2017 30 次提交
  2. 23 2月, 2017 1 次提交
  3. 17 2月, 2017 4 次提交
  4. 14 2月, 2017 5 次提交
    • L
      Btrfs: kill trans in run_delalloc_nocow and btrfs_cross_ref_exist · e4c3b2dc
      Liu Bo 提交于
      run_delalloc_nocow has used trans in two places where they don't
      actually need @trans.
      
      For btrfs_lookup_file_extent, we search for file extents without COWing
      anything, and for btrfs_cross_ref_exist, the only place where we need
      @trans is deferencing it in order to get running_transaction which we
      could easily get from the global fs_info.
      Signed-off-by: NLiu Bo <bo.li.liu@oracle.com>
      Reviewed-by: NDavid Sterba <dsterba@suse.com>
      Signed-off-by: NDavid Sterba <dsterba@suse.com>
      e4c3b2dc
    • L
      Btrfs: fix wrong argument for btrfs_lookup_ordered_range · 9a9239ac
      Liu Bo 提交于
      Commit Btrfs: btrfs_page_mkwrite: Reserve space in sectorsized units"
      (d0b7da88) did this, but btrfs_lookup_ordered_range expects a 'length'
      rather than a 'page_end'.
      Signed-off-by: NLiu Bo <bo.li.liu@oracle.com>
      Reviewed-by: NChandan Rajendra <chandan@linux.vnet.ibm.com>
      Signed-off-by: NDavid Sterba <dsterba@suse.com>
      9a9239ac
    • L
      Btrfs: fix another race between truncate and lockless dio write · 4aaedfb0
      Liu Bo 提交于
      Dio writes can update i_size in btrfs_get_blocks_direct when it
      writes to offset beyond EOF so that endio can update disk_i_size
      correctly (because we don't udpate disk_i_size beyond i_size).
      
      However, when truncating down a file, we firstly update i_size
      and then wait for in-flight lockless dio reads/writes, according
      to the above, i_size may have been changed in dio writes, and
      file extents don't get truncated.
      
      For lockless dio writes are always overwrites, i_size is not
      supposed to be changed, so this adds a check to filter out this
      case.
      
      The race could be reproduced by fstests/generic/299 with patch
      "Btrfs: fix btrfs_ordered_update_i_size to update disk_i_size properly"
       applied.
      Signed-off-by: NLiu Bo <bo.li.liu@oracle.com>
      Signed-off-by: NDavid Sterba <dsterba@suse.com>
      4aaedfb0
    • L
      Btrfs: fix comment in btrfs_page_mkwrite · 5416034f
      Liu Bo 提交于
      The comment about "page_mkwrite gets called every time the page is
      dirtied" in btrfs_page_mkwrite is not correct, it only gets called the
      first time the page gets dirtied after the page faults in.
      
      However, we don't need to touch the code because it works well, although
      the proper logic is to check if delalloc bits has been set and if so, go
      free reserved space, if not, set the delalloc bits for dirty page range.
      Signed-off-by: NLiu Bo <bo.li.liu@oracle.com>
      Signed-off-by: NDavid Sterba <dsterba@suse.com>
      5416034f
    • L
      Btrfs: fix btrfs_ordered_update_i_size to update disk_i_size properly · 19fd2df5
      Liu Bo 提交于
      btrfs_ordered_update_i_size can be called by truncate and endio, but
      only endio takes ordered_extent which contains the completed IO.
      
      while truncating down a file, if there are some in-flight IOs,
      btrfs_ordered_update_i_size in endio will set disk_i_size to
      @orig_offset that is zero.  If truncating-down fails somehow, we try to
      recover in memory isize with this zero'd disk_i_size.
      
      Fix it by only updating disk_i_size with @orig_offset when
      btrfs_ordered_update_i_size is not called from endio while truncating
      down and waiting for in-flight IOs completing their work before recover
      in-memory size.
      
      Besides fixing the above issue, add an assertion for last_size to double
      check we truncate down to the desired size.
      Signed-off-by: NLiu Bo <bo.li.liu@oracle.com>
      Signed-off-by: NDavid Sterba <dsterba@suse.com>
      19fd2df5