1. 09 10月, 2012 21 次提交
  2. 04 10月, 2012 16 次提交
    • D
      btrfs: allow setting NOCOW for a zero sized file via ioctl · 7e97b8da
      David Sterba 提交于
      Hi,
      
      the patch si simple, but it has user visible impact and I'm not quite sure how
      to resolve it.
      
      In short, $subj says it, chattr -C supports it and we want to use it.
      
      The conditions that acutally allow to change the NOCOW flag are clear. What if
      I try to set the flag on a file that is not empty? Options:
      
      1) whole ioctl will fail, EINVAL
      2.1) ioctl will succeed, the NOCOW flag will be silently removed, but the file
           will stay COW-ed and checksummed
      2.2) ioctl will succeed, flag will not be removed and a syslog message will
           warn that the COW flag has not been changed
      2.2.1) dtto, no syslog message
      
      Man page of chattr states that
      
       "If it is set on a file which already has data blocks, it is undefined when
       the blocks assigned to the file will be fully stable."
      
      Yes, it's undefined and with current implementation it'll never happen. So from
      this end, the user cannot expect anything. I'm trying to find a reasonable
      behaviour, so that a command like 'chattr -R -aijS +C' to tweak a broad set of
      flags in a deep directory does not fail unnecessarily and does not pollute the
      log.
      
      My personal preference is 2.2.1, but my dev's oppinion is skewed, not counting
      the fact that I know the code and otherwise would look there before consulting
      the documentation.
      
      The patch implements 2.2.1.
      
      david
      
      -------------8<-------------------
      From: David Sterba <dsterba@suse.cz>
      
      It's safe to turn off checksums for a zero sized file.
      
      http://thread.gmane.org/gmane.comp.file-systems.btrfs/18030
      
      "We cannot switch on NODATASUM for a file that already has extents that
      are checksummed. The invariant here is that either all the extents or
      none are checksummed.
      
      Theoretically it's possible to add/remove all checksums from a given
      file, but it's a potentially longtime operation, the file has to be in
      some intermediate state where the checksums partially exist but have to
      be ignored (for the csum->nocsum) until the file is fully converted,
      this brings more special cases to extent handling, it has to survive
      power failure and remain consistent, and probably needs to be restarted
      after next mount."
      Signed-off-by: NDavid Sterba <dsterba@suse.cz>
      7e97b8da
    • J
      Btrfs: fix punch hole when no extent exists · c3308f84
      Josef Bacik 提交于
      I saw the warning in btrfs_drop_extent_cache where our end is less than our
      start while running xfstests 68 in a loop.  This is because we
      unconditionally do drop_end = min(end, extent_end) in
      __btrfs_drop_extents(), even though we may not have found an extent in the
      range we were looking to drop.  So keep track of wether or not we found
      something, and if we didn't just use our end.  Thanks,
      Signed-off-by: NJosef Bacik <jbacik@fusionio.com>
      c3308f84
    • J
      Btrfs: don't do anything in our ->freeze_fs and ->unfreeze_fs · 926ced12
      Josef Bacik 提交于
      We do not need to do anything special to freeze or unfreeze, it's all taken
      care of by the generic work, and what we currently have is wrong anyway
      since we shouldn't be returnning to userspace with mutexes held anyway.
      Thanks,
      Signed-off-by: NJosef Bacik <jbacik@fusionio.com>
      926ced12
    • J
      Btrfs: remove unused write cache pages hook · 892951a9
      Josef Bacik 提交于
      The btree inode has it's own write cache pages so we can remove this write
      cache pages hook as it's not used.  Thanks,
      Signed-off-by: NJosef Bacik <jbacik@fusionio.com>
      892951a9
    • J
      Btrfs: fix race when getting the eb out of page->private · b5bae261
      Josef Bacik 提交于
      We can race when checking wether PagePrivate is set on a page and we
      actually have an eb saved in the pages private pointer.  We could have
      easily written out this page and released it in the time that we did the
      pagevec lookup and actually got around to looking at this page.  So use
      mapping->private_lock to ensure we get a consistent view of the
      page->private pointer.  This is inline with the alloc and releasepage paths
      which use private_lock when manipulating page->private.  Thanks,
      Reported-by: NDavid Sterba <dave@jikos.cz>
      Signed-off-by: NJosef Bacik <jbacik@fusionio.com>
      b5bae261
    • J
      Btrfs: do not hold the write_lock on the extent tree while logging · ff44c6e3
      Josef Bacik 提交于
      Dave Sterba pointed out a sleeping while atomic bug while doing fsync.  This
      is because I'm an idiot and didn't realize that rwlock's were spin locks, so
      we've been holding this thing while doing allocations and such which is not
      good.  This patch fixes this by dropping the write lock before we do
      anything heavy and re-acquire it when it is done.  We also need to take a
      ref on the em's in case their corresponding pages are evicted and mark them
      as being logged so that releasepage does not remove them and doesn't remove
      them from our local list.  Thanks,
      Reported-by: NDave Sterba <dave@jikos.cz>
      Signed-off-by: NJosef Bacik <jbacik@fusionio.com>
      ff44c6e3
    • J
      Btrfs: fix race with freeze and free space inodes · 98114659
      Josef Bacik 提交于
      So we start our freeze, somebody comes in and does an fsync() on a file
      where we have to commit a transaction for whatever reason, and we will
      deadlock because the freeze is waiting on FS_FREEZE people to stop writing
      to the file system, but the transaction is waiting for its free space inodes
      to be written out, which are in turn waiting on sb_start_intwrite while
      trying to write the file extents.  To fix this we'll just skip the
      sb_start_intwrite() if we TRANS_JOIN_NOLOCK since we're being waited on by a
      transaction commit so we're safe wrt to freeze and this will keep us from
      deadlocking.  Thanks,
      Signed-off-by: NJosef Bacik <jbacik@fusionio.com>
      98114659
    • L
      Btrfs: kill obsolete arguments in btrfs_wait_ordered_extents · 6bbe3a9c
      Liu Bo 提交于
      nocow_only is now an obsolete argument.
      Signed-off-by: NLiu Bo <bo.li.liu@oracle.com>
      6bbe3a9c
    • L
      Btrfs: cleanup fs_info->hashers · 2e90cf85
      Liu Bo 提交于
      fs_info->hashers is now an obsolete one.
      Signed-off-by: NLiu Bo <bo.li.liu@oracle.com>
      2e90cf85
    • L
      Btrfs: cleanup for duplicated code in find_free_extent · ab26e9d6
      Liu Bo 提交于
      There is already an 'add free space' phrase in front of this one, we
      needn't to redo it.
      Signed-off-by: NLiu Bo <bo.li.liu@oracle.com>
      ab26e9d6
    • J
      Btrfs: fix race in sync and freeze again · 60376ce4
      Josef Bacik 提交于
      I screwed this up, there is a race between checking if there is a running
      transaction and actually starting a transaction in sync where we could race
      with a freezer and get ourselves into trouble.  To fix this we need to make
      a new join type to only do the try lock on the freeze stuff.  If it fails
      we'll return EPERM and just return from sync.  This fixes a hang Liu Bo
      reported when running xfstest 68 in a loop.  Thanks,
      Reported-by: NLiu Bo <bo.li.liu@oracle.com>
      Signed-off-by: NJosef Bacik <jbacik@fusionio.com>
      60376ce4
    • D
      btrfs: return EPERM upon rmdir on a subvolume · b3ae244e
      David Sterba 提交于
      A subvolume cannot be deleted via rmdir, but the error code ENOTEMPTY
      is confusing. Return EPERM instead, as this is not permitted.
      Signed-off-by: NDavid Sterba <dsterba@suse.cz>
      b3ae244e
    • W
      Btrfs: using for_each_set_bit_from to simplify the code · ebb3dad4
      Wei Yongjun 提交于
      Using for_each_set_bit_from() to simplify the code.
      
      spatch with a semantic match is used to found this.
      (http://coccinelle.lip6.fr/)
      Signed-off-by: NWei Yongjun <yongjun_wei@trendmicro.com.cn>
      ebb3dad4
    • A
      Btrfs: write_buf is now callable outside send.c · 1bcea355
      Anand Jain 提交于
      Developing service cmds needs it.
      Signed-off-by: NAnand Jain <anand.jain@oracle.com>
      1bcea355
    • T
      Btrfs: remove unnecessary code in btree_get_extent() · b4f359ab
      Tsutomu Itoh 提交于
      Unnecessary lookup_extent_mapping() is removed because an error is
      returned to the caller.
      This patch was made based on the advice from Stefan Behrens, thanks.
      Signed-off-by: NTsutomu Itoh <t-itoh@jp.fujitsu.com>
      b4f359ab
    • T
      Btrfs: cleanup of error processing in btree_get_extent() · 0433f20d
      Tsutomu Itoh 提交于
      This patch simplifies a little complex error processing in
      btree_get_extent().
      Signed-off-by: NTsutomu Itoh <t-itoh@jp.fujitsu.com>
      0433f20d
  3. 02 10月, 2012 3 次提交
    • M
      Revert "Btrfs: do not do filemap_write_and_wait_range in fsync" · 90abccf2
      Miao Xie 提交于
      This reverts commit 0885ef5b
      
      After applying the above patch, the performance slowed down because the dirty
      page flush can only be done by one task, so revert it.
      
      The following is the test result of sysbench:
      	Before		After
      	24MB/s		39MB/s
      Signed-off-by: NMiao Xie <miaox@cn.fujitsu.com>
      90abccf2
    • J
      Btrfs: remove bytes argument from do_chunk_alloc · 698d0082
      Josef Bacik 提交于
      Everybody is just making stuff up, and it's just used to see if we really do
      need to alloc a chunk, and since we do this when we already know we really
      do it's just a waste of space.  Thanks,
      Signed-off-by: NJosef Bacik <jbacik@fusionio.com>
      698d0082
    • J
      Btrfs: delay block group item insertion · ea658bad
      Josef Bacik 提交于
      So we have lots of places where we try to preallocate chunks in order to
      make sure we have enough space as we make our allocations.  This has
      historically meant that we're constantly tweaking when we should allocate a
      new chunk, and historically we have gotten this horribly wrong so we way
      over allocate either metadata or data.  To try and keep this from happening
      we are going to make it so that the block group item insertion is done out
      of band at the end of a transaction.  This will allow us to create chunks
      even if we are trying to make an allocation for the extent tree.  With this
      patch my enospc tests run faster (didn't expect this) and more efficiently
      use the disk space (this is what I wanted).  Thanks,
      Signed-off-by: NJosef Bacik <jbacik@fusionio.com>
      ea658bad