1. 30 10月, 2008 3 次提交
    • J
      Btrfs: fix enospc when there is plenty of space · 80eb234a
      Josef Bacik 提交于
      So there is an odd case where we can possibly return -ENOSPC when there is in
      fact space to be had.  It only happens with Metadata writes, and happens _very_
      infrequently.  What has to happen is we have to allocate have allocated out of
      the first logical byte on the disk, which would set last_alloc to
      first_logical_byte(root, 0), so search_start == orig_search_start.  We then
      need to allocate for normal metadata, so BTRFS_BLOCK_GROUP_METADATA |
      BTRFS_BLOCK_GROUP_DUP.  We will do a block lookup for the given search_start,
      block_group_bits() won't match and we'll go to choose another block group.
      However because search_start matches orig_search_start we go to see if we can
      allocate a chunk.
      
      If we are in the situation that we cannot allocate a chunk, we fail and ENOSPC.
      This is kind of a big flaw of the way find_free_extent works, as it along with
      find_free_space loop through _all_ of the block groups, not just the ones that
      we want to allocate out of.  This patch completely kills find_free_space and
      rolls it into find_free_extent.  I've introduced a sort of state machine into
      this, which will make it easier to get cache miss information out of the
      allocator, and will work well with my locking changes.
      
      The basic flow is this:  We have the variable loop which is 0, meaning we are
      in the hint phase.  We lookup the block group for the hint, and lookup the
      space_info for what we want to allocate out of.  If the block group we were
      pointed at by the hint either isn't of the correct type, or just doesn't have
      the space we need, we set head to space_info->block_groups, so we start at the
      beginning of the block groups for this particular space info, and loop through.
      
      This is also where we add the empty_cluster to total_needed.  At this point
      loop is set to 1 and we just loop through all of the block groups for this
      particular space_info looking for the space we need, just as find_free_space
      would have done, except we only hit the block groups we want and not _all_ of
      the block groups.  If we come full circle we see if we can allocate a chunk.
      If we cannot of course we exit with -ENOSPC and we are good.  If not we start
      over at space_info->block_groups and loop through again, with loop == 2.  If we
      come full circle and haven't found what we need then we exit with -ENOSPC.
      I've been running this for a couple of days now and it seems stable, and I
      haven't yet hit a -ENOSPC when there was plenty of space left.
      
      Also I've made a groups_sem to handle the group list for the space_info.  This
      is part of my locking changes, but is relatively safe and seems better than
      holding the space_info spinlock over that entire search time.  Thanks,
      Signed-off-by: NJosef Bacik <jbacik@redhat.com>
       
      80eb234a
    • Y
      Btrfs: Improve space balancing code · f82d02d9
      Yan Zheng 提交于
      This patch improves the space balancing code to keep more sharing
      of tree blocks. The only case that breaks sharing of tree blocks is
      data extents get fragmented during balancing. The main changes in
      this patch are:
      
      Add a 'drop sub-tree' function. This solves the problem in old code
      that BTRFS_HEADER_FLAG_WRITTEN check breaks sharing of tree block.
      
      Remove relocation mapping tree. Relocation mappings are stored in
      struct btrfs_ref_path and updated dynamically during walking up/down
      the reference path. This reduces CPU usage and simplifies code.
      
      This patch also fixes a bug. Root items for reloc trees should be
      updated in btrfs_free_reloc_root.
      Signed-off-by: NYan Zheng <zheng.yan@oracle.com>
      
      f82d02d9
    • C
      Btrfs: Add zlib compression support · c8b97818
      Chris Mason 提交于
      This is a large change for adding compression on reading and writing,
      both for inline and regular extents.  It does some fairly large
      surgery to the writeback paths.
      
      Compression is off by default and enabled by mount -o compress.  Even
      when the -o compress mount option is not used, it is possible to read
      compressed extents off the disk.
      
      If compression for a given set of pages fails to make them smaller, the
      file is flagged to avoid future compression attempts later.
      
      * While finding delalloc extents, the pages are locked before being sent down
      to the delalloc handler.  This allows the delalloc handler to do complex things
      such as cleaning the pages, marking them writeback and starting IO on their
      behalf.
      
      * Inline extents are inserted at delalloc time now.  This allows us to compress
      the data before inserting the inline extent, and it allows us to insert
      an inline extent that spans multiple pages.
      
      * All of the in-memory extent representations (extent_map.c, ordered-data.c etc)
      are changed to record both an in-memory size and an on disk size, as well
      as a flag for compression.
      
      From a disk format point of view, the extent pointers in the file are changed
      to record the on disk size of a given extent and some encoding flags.
      Space in the disk format is allocated for compression encoding, as well
      as encryption and a generic 'other' field.  Neither the encryption or the
      'other' field are currently used.
      
      In order to limit the amount of data read for a single random read in the
      file, the size of a compressed extent is limited to 128k.  This is a
      software only limit, the disk format supports u64 sized compressed extents.
      
      In order to limit the ram consumed while processing extents, the uncompressed
      size of a compressed extent is limited to 256k.  This is a software only limit
      and will be subject to tuning later.
      
      Checksumming is still done on compressed extents, and it is done on the
      uncompressed version of the data.  This way additional encodings can be
      layered on without having to figure out which encoding to checksum.
      
      Compression happens at delalloc time, which is basically singled threaded because
      it is usually done by a single pdflush thread.  This makes it tricky to
      spread the compression load across all the cpus on the box.  We'll have to
      look at parallel pdflush walks of dirty inodes at a later time.
      
      Decompression is hooked into readpages and it does spread across CPUs nicely.
      Signed-off-by: NChris Mason <chris.mason@oracle.com>
      c8b97818
  2. 09 10月, 2008 3 次提交
    • Y
      Btrfs: Fix leaf reference cache miss · 5b84e8d6
      Yan Zheng 提交于
      Due to the optimization for truncate, tree leaves only containing
      checksum items can be deleted without being COW'ed first. This causes
      reference cache misses. The way to fix the miss is create cache
      entries for tree leaves only contain checksum.
      
      This patch also fixes a -EEXIST issue in shared reference cache.
      Signed-off-by: NYan Zheng <zheng.yan@oracle.com>
      5b84e8d6
    • Y
      Btrfs: Remove offset field from struct btrfs_extent_ref · 3bb1a1bc
      Yan Zheng 提交于
      The offset field in struct btrfs_extent_ref records the position
      inside file that file extent is referenced by. In the new back
      reference system, tree leaves holding references to file extent
      are recorded explicitly. We can scan these tree leaves very quickly, so the
      offset field is not required.
      
      This patch also makes the back reference system check the objectid
      when extents are in deleting.
      Signed-off-by: NYan Zheng <zheng.yan@oracle.com>
      3bb1a1bc
    • Y
      Btrfs: Count space allocated to file in bytes · a76a3cd4
      Yan Zheng 提交于
      This patch makes btrfs count space allocated to file in bytes instead
      of 512 byte sectors.
      
      Everything else in btrfs uses a byte count instead of sector sizes or
      blocks sizes, so this fits better.
      Signed-off-by: NYan Zheng <zheng.yan@oracle.com>
      a76a3cd4
  3. 04 10月, 2008 1 次提交
    • C
      Btrfs: remove last_log_alloc allocator optimization · 30c43e24
      Chris Mason 提交于
      The tree logging code was trying to separate tree log allocations
      from normal metadata allocations to improve writeback patterns during
      an fsync.
      
      But, the code was not effective and ended up just mixing tree log
      blocks with regular metadata.  That seems to be working fairly well,
      so the last_log_alloc code can be removed.
      Signed-off-by: NChris Mason <chris.mason@oracle.com>
      30c43e24
  4. 02 10月, 2008 1 次提交
    • J
      Btrfs: fix deadlock between alloc_mutex/chunk_mutex · cf749823
      Josef Bacik 提交于
      This fixes a deadlock that happens between the alloc_mutex and chunk_mutex.
      Process A comes in, decides to do a do_chunk_alloc, which takes the
      chunk_mutex, and is holding the alloc_mutex because the only way you get to
      do_chunk_alloc is by holding the alloc_mutex.  btrfs_alloc_chunk does its thing
      and goes to insert a new item, which results in a cow of the block.
      
      We get into del_pending_extents from there, where if we need to be rescheduled
      we drop the alloc_mutex and schedule.  At this point process B comes in to do
      an allocation and gets the alloc_mutex, and because process A did not do the
      chunk allocation completely it thinks its a good time to do a chunk allocation
      as well, and hangs on the chunk_mutex.
      
      Process A wakes up and tries to take the alloc_mutex and cannot.  The way to
      fix this is do a mutex_trylock() on chunk_mutex.  If we return 0 we didn't get
      the lock, and if this is just a "hey it may be a good time to allocate a chunk"
      then we just exit.  If we are trying to force an allocation then we reschedule
      and keep trying to acquire the chunk_mutex.  If once we acquire it the space is
      already full then we can just exit, otherwise we can continue with the chunk
      allocation.  Thank you,
      Signed-off-by: NJosef Bacik <jbacik@redhat.com>
      cf749823
  5. 01 10月, 2008 2 次提交
    • C
      Btrfs: fix multi-device code to use raid policies set by mkfs · 75ccf47d
      Chris Mason 提交于
      When reading in block groups, a global mask of the available raid policies
      should be adjusted based on the types of block groups found on disk.  This
      global mask is then used to decide which raid policy to use for new
      block groups.
      
      The recent allocator changes dropped the call that updated the global
      mask, making all the block groups allocated at run time single striped
      onto a single drive.
      
      This also fixes the async worker threads to set any thread that uses
      the requeue mechanism as busy.  This allows us to avoid blocking
      on get_request_wait for the async bio submission threads.
      Signed-off-by: NChris Mason <chris.mason@oracle.com>
      75ccf47d
    • J
      Btrfs: fix seekiness due to finding the wrong block group · 45b8c9a8
      Josef Bacik 提交于
      This patch fixes a problem where we end up seeking too much when *last_ptr is
      valid.  This happens because btrfs_lookup_first_block_group only returns a
      block group that starts on or after the given search start, so if the
      search_start is in the middle of a block group it will return the block group
      after the given search_start, which is suboptimal.
      
      This patch fixes that by doing a btrfs_lookup_block_group, which will return
      the block group that contains the given search start.  If we fail to find a
      block group, we fall back on btrfs_lookup_first_block_group so we can find the
      next block group, not sure if this is absolutely needed, but better safe than
      sorry.
      
      Also if we can't find the block group that we need, or it happens to not be of
      the right type, we need to add empty_cluster since *last_ptr could point to a
      mismatched block group, which means we need to start over with empty_cluster
      added to total needed.  Thank you,
      Signed-off-by: NJosef Bacik <jbacik@redhat.com>
      Signed-off-by: NChris Mason <chris.mason@oracle.com>
      45b8c9a8
  6. 26 9月, 2008 4 次提交
    • Z
      Btrfs: update space balancing code · 1a40e23b
      Zheng Yan 提交于
      This patch updates the space balancing code to utilize the new
      backref format.  Before, btrfs-vol -b would break any COW links
      on data blocks or metadata.  This was slow and caused the amount
      of space used to explode if a large number of snapshots were present.
      
      The new code can keeps the sharing of all data extents and
      most of the tree blocks.
      
      To maintain the sharing of data extents, the space balance code uses
      a seperate inode hold data extent pointers, then updates the references
      to point to the new location.
      
      To maintain the sharing of tree blocks, the space balance code uses
      reloc trees to relocate tree blocks in reference counted roots.
      There is one reloc tree for each subvol, and all reloc trees share
      same root key objectid. Reloc trees are snapshots of the latest
      committed roots of subvols (root->commit_root).
      
      To relocate a tree block referenced by a subvol, there are two steps.
      COW the block through subvol's reloc tree, then update block pointer in
      the subvol to point to the new block. Since all reloc trees share
      same root key objectid, doing special handing for tree blocks
      owned by them is easy. Once a tree block has been COWed in one
      reloc tree, we can use the resulting new block directly when the
      same block is required to COW again through other reloc trees.
      In this way, relocated tree blocks are shared between reloc trees,
      so they are also shared between subvols.
      Signed-off-by: NChris Mason <chris.mason@oracle.com>
      1a40e23b
    • Z
      Btrfs: Add shared reference cache · e4657689
      Zheng Yan 提交于
      Btrfs has a cache of reference counts in leaves, allowing it to
      avoid reading tree leaves while deleting snapshots.  To reduce
      contention with multiple subvolumes, this cache is private to each
      subvolume.
      
      This patch adds shared reference cache support. The new space
      balancing code plays with multiple subvols at the same time, So
      the old per-subvol reference cache is not well suited.
      Signed-off-by: NChris Mason <chris.mason@oracle.com>
      e4657689
    • Z
      Btrfs: allocator fixes for space balancing update · e8569813
      Zheng Yan 提交于
      * Reserved extent accounting:  reserved extents have been
      allocated in the rbtrees that track free space but have not
      been allocated on disk.  They were never properly accounted for
      in the past, making it hard to know how much space was really free.
      
      * btrfs_find_block_group used to return NULL for block groups that
      had been removed by the space balancing code.  This made it hard
      to account for space during the final stages of a balance run.
      Signed-off-by: NChris Mason <chris.mason@oracle.com>
      e8569813
    • C
      Btrfs: fix sleep with spinlock held during unmount · 4434c33c
      Chris Mason 提交于
      The code to free block groups needs to drop the space info spin lock
      before calling btrfs_remove_free_space_cache (which can schedule).
      
      This is safe because at unmount time, nobody else is going to play
      with the block groups.
      Signed-off-by: NChris Mason <chris.mason@oracle.com>
      4434c33c
  7. 25 9月, 2008 26 次提交
    • Z
      Btrfs: Full back reference support · 31840ae1
      Zheng Yan 提交于
      This patch makes the back reference system to explicit record the
      location of parent node for all types of extents. The location of
      parent node is placed into the offset field of backref key. Every
      time a tree block is balanced, the back references for the affected
      lower level extents are updated.
      Signed-off-by: NChris Mason <chris.mason@oracle.com>
      31840ae1
    • C
      Add check for tree-log roots in btrfs_alloc_reserved_extents · 1c2308f8
      Chris Mason 提交于
      Tree log blocks are only reserved, and should not ever get fully
      allocated on disk.  This check makes sure they stay out of the
      extent tree.
      Signed-off-by: NChris Mason <chris.mason@oracle.com>
      1c2308f8
    • J
      Btrfs: free space accounting redo · 0f9dd46c
      Josef Bacik 提交于
      1) replace the per fs_info extent_io_tree that tracked free space with two
      rb-trees per block group to track free space areas via offset and size.  The
      reason to do this is because most allocations come with a hint byte where to
      start, so we can usually find a chunk of free space at that hint byte to satisfy
      the allocation and get good space packing.  If we cannot find free space at or
      after the given offset we fall back on looking for a chunk of the given size as
      close to that given offset as possible.  When we fall back on the size search we
      also try to find a slot as close to the size we want as possible, to avoid
      breaking small chunks off of huge areas if possible.
      
      2) remove the extent_io_tree that tracked the block group cache from fs_info and
      replaced it with an rb-tree thats tracks block group cache via offset.  also
      added a per space_info list that tracks the block group cache for the particular
      space so we can lookup related block groups easily.
      
      3) cleaned up the allocation code to make it a little easier to read and a
      little less complicated.  Basically there are 3 steps, first look from our
      provided hint.  If we couldn't find from that given hint, start back at our
      original search start and look for space from there.  If that fails try to
      allocate space if we can and start looking again.  If not we're screwed and need
      to start over again.
      
      4) small fixes.  there were some issues in volumes.c where we wouldn't allocate
      the rest of the disk.  fixed cow_file_range to actually pass the alloc_hint,
      which has helped a good bit in making the fs_mark test I run have semi-normal
      results as we run out of space.  Generally with data allocations we don't track
      where we last allocated from, so everytime we did a data allocation we'd search
      through every block group that we have looking for free space.  Now searching a
      block group with no free space isn't terribly time consuming, it was causing a
      slight degradation as we got more data block groups.  The alloc_hint has fixed
      this slight degredation and made things semi-normal.
      
      There is still one nagging problem I'm working on where we will get ENOSPC when
      there is definitely plenty of space.  This only happens with metadata
      allocations, and only when we are almost full.  So you generally hit the 85%
      mark first, but sometimes you'll hit the BUG before you hit the 85% wall.  I'm
      still tracking it down, but until then this seems to be pretty stable and make a
      significant performance gain.
      Signed-off-by: NChris Mason <chris.mason@oracle.com>
      0f9dd46c
    • J
      Btrfs: fix cache_block_group error handling · ef8bbdfe
      Josef Bacik 提交于
      cache block group had a few bugs in the error handling code,
      this makes sure paths get properly released and the correct return value
      goes out.
      Signed-off-by: NChris Mason <chris.mason@oracle.com>
      ef8bbdfe
    • C
      Btrfs: Record dirty pages tree-log pages in an extent_io tree · d0c803c4
      Chris Mason 提交于
      This is the same way the transaction code makes sure that all the
      other tree blocks are safely on disk.  There's an extent_io tree
      for each root, and any blocks allocated to the tree logs are
      recorded in that tree.
      
      At tree-log sync, the extent_io tree is walked to flush down the
      dirty pages and wait for them.
      
      The main benefit is less time spent walking the tree log and skipping
      clean pages, and getting sequential IO down to the drive.
      Signed-off-by: NChris Mason <chris.mason@oracle.com>
      d0c803c4
    • C
      Btrfs: Optimize tree log block allocations · d00aff00
      Chris Mason 提交于
      Since tree log blocks get freed every transaction, they never really
      need to be written to disk.  This skips the step where we update
      metadata to record they were allocated.
      Signed-off-by: NChris Mason <chris.mason@oracle.com>
      d00aff00
    • C
      Btrfs: Tree logging fixes · 4bef0848
      Chris Mason 提交于
      * Pin down data blocks to prevent them from being reallocated like so:
      
      trans 1: allocate file extent
      trans 2: free file extent
      trans 3: free file extent during old snapshot deletion
      trans 3: allocate file extent to new file
      trans 3: fsync new file
      
      Before the tree logging code, this was legal because the fsync
      would commit the transation that did the final data extent free
      and the transaction that allocated the extent to the new file
      at the same time.
      
      With the tree logging code, the tree log subtransaction can commit
      before the transaction that freed the extent.  If we crash,
      we're left with two different files using the extent.
      
      * Don't wait in start_transaction if log replay is going on.  This
      avoids deadlocks from iput while we're cleaning up link counts in the
      replay code.
      
      * Don't deadlock in replay_one_name by trying to read an inode off
      the disk while holding paths for the directory
      
      * Hold the buffer lock while we mark a buffer as written.  This
      closes a race where someone is changing a buffer while we write it.
      They are supposed to mark it dirty again after they change it, but
      this violates the cow rules.
      Signed-off-by: NChris Mason <chris.mason@oracle.com>
      4bef0848
    • C
      Btrfs: Add a write ahead tree log to optimize synchronous operations · e02119d5
      Chris Mason 提交于
      File syncs and directory syncs are optimized by copying their
      items into a special (copy-on-write) log tree.  There is one log tree per
      subvolume and the btrfs super block points to a tree of log tree roots.
      
      After a crash, items are copied out of the log tree and back into the
      subvolume.  See tree-log.c for all the details.
      Signed-off-by: NChris Mason <chris.mason@oracle.com>
      e02119d5
    • D
      Btrfs: Discard sector data in __free_extent() · 21af804c
      David Woodhouse 提交于
      Date: Tue, 12 Aug 2008 14:13:26 +0100
      Signed-off-by: NDavid Woodhouse <David.Woodhouse@intel.com>
      Signed-off-by: NChris Mason <chris.mason@oracle.com>
      21af804c
    • Y
      Btrfs: Fix nodatacow for the new data=ordered mode · 7ea394f1
      Yan Zheng 提交于
      Signed-off-by: NChris Mason <chris.mason@oracle.com>
      7ea394f1
    • C
    • C
      Btrfs: Don't corrupt ram in shrink_extent_tree, leak it instead · d7a029a8
      Chris Mason 提交于
      Far from the perfect fix, but these structs are small.  TODO for the
      next release.  The block group cache structs are referenced in many
      different places, and it isn't safe to just free them while resizing.
      
      A real fix will be a larger change to the allocator so that it doesn't
      have to carry about the block group cache structs to find good places
      to search for free blocks.
      Signed-off-by: NChris Mason <chris.mason@oracle.com>
      d7a029a8
    • C
      Btrfs: More throttle tuning · 2dd3e67b
      Chris Mason 提交于
      * Make walk_down_tree wake up throttled tasks more often
      * Make walk_down_tree call cond_resched during long loops
      * As the size of the ref cache grows, wait longer in throttle
      * Get rid of the reada code in walk_down_tree, the leaves don't get
        read anymore, thanks to the ref cache.
      Signed-off-by: NChris Mason <chris.mason@oracle.com>
      2dd3e67b
    • C
      btrfs_search_slot: reduce lock contention by cowing in two stages · 65b51a00
      Chris Mason 提交于
      A btree block cow has two parts, the first is to allocate a destination
      block and the second is to copy the old bock over.
      
      The first part needs locks in the extent allocation tree, and may need to
      do IO.  This changeset splits that into a separate function that can be
      called without any tree locks held.
      
      btrfs_search_slot is changed to drop its path and start over if it has
      to COW a contended block.  This often means that many writers will
      pre-alloc a new destination for a the same contended block, but they
      cache their prealloc for later use on lower levels in the tree.
      Signed-off-by: NChris Mason <chris.mason@oracle.com>
      65b51a00
    • C
      18e35e0a
    • C
      Btrfs: Improve and cleanup locking done by walk_down_tree · f87f057b
      Chris Mason 提交于
      While dropping snapshots, walk_down_tree does most of the work of checking
      reference counts and limiting tree traversal to just the blocks that
      we are freeing.
      
      It dropped and held the allocation mutex in strange and confusing ways,
      this commit changes it to only hold the mutex while actually freeing a block.
      
      The rest of the checks around reference counts should be safe without the lock
      because we only allow one process in btrfs_drop_snapshot at a time.  Other
      processes dropping reference counts should not drop it to 1 because
      their tree roots already have an extra ref on the block.
      Signed-off-by: NChris Mason <chris.mason@oracle.com>
      f87f057b
    • C
      Btrfs: Throttle tuning · 37d1aeee
      Chris Mason 提交于
      This avoids waiting for transactions with pages locked by breaking out
      the code to wait for the current transaction to close into a function
      called by btrfs_throttle.
      
      It also lowers the limits for where we start throttling.
      Signed-off-by: NChris Mason <chris.mason@oracle.com>
      37d1aeee
    • C
      47ac14fa
    • Y
      Btrfs: implement memory reclaim for leaf reference cache · bcc63abb
      Yan 提交于
      The memory reclaiming issue happens when snapshot exists. In that
      case, some cache entries may not be used during old snapshot dropping,
      so they will remain in the cache until umount.
      
      The patch adds a field to struct btrfs_leaf_ref to record create time. Besides,
      the patch makes all dead roots of a given snapshot linked together in order of
      create time. After a old snapshot was completely dropped, we check the dead
      root list and remove all cache entries created before the oldest dead root in
      the list.
      Signed-off-by: NChris Mason <chris.mason@oracle.com>
      bcc63abb
    • Y
      Btrfs: Update and fix mount -o nodatacow · f321e491
      Yan Zheng 提交于
      To check whether a given file extent is referenced by multiple snapshots, the
      checker walks down the fs tree through dead root and checks all tree blocks in
      the path.
      
      We can easily detect whether a given tree block is directly referenced by other
      snapshot. We can also detect any indirect reference from other snapshot by
      checking reference's generation. The checker can always detect multiple
      references, but can't reliably detect cases of single reference. So btrfs may
      do file data cow even there is only one reference.
      Signed-off-by: NChris Mason <chris.mason@oracle.com>
      f321e491
    • C
      Btrfs: Throttle operations if the reference cache gets too large · ab78c84d
      Chris Mason 提交于
      A large reference cache is directly related to a lot of work pending
      for the cleaner thread.  This throttles back new operations based on
      the size of the reference cache so the cleaner thread will be able to keep
      up.
      
      Overall, this actually makes the FS faster because the cleaner thread will
      be more likely to find things in cache.
      Signed-off-by: NChris Mason <chris.mason@oracle.com>
      ab78c84d
    • C
      Btrfs: Leaf reference cache update · 017e5369
      Chris Mason 提交于
      This changes the reference cache to make a single cache per root
      instead of one cache per transaction, and to key by the byte number
      of the disk block instead of the keys inside.
      
      This makes it much less likely to have cache misses if a snapshot
      or something has an extra reference on a higher node or a leaf while
      the first transaction that added the leaf into the cache is dropping.
      
      Some throttling is added to functions that free blocks heavily so they
      wait for old transactions to drop.
      Signed-off-by: NChris Mason <chris.mason@oracle.com>
      017e5369
    • Y
      Btrfs: Add a leaf reference cache · 31153d81
      Yan Zheng 提交于
      Much of the IO done while dropping snapshots is done looking up
      leaves in the filesystem trees to see if they point to any extents and
      to drop the references on any extents found.
      
      This creates a cache so that IO isn't required.
      Signed-off-by: NChris Mason <chris.mason@oracle.com>
      31153d81
    • Y
      Btrfs: Properly release lock in pin_down_bytes · 974e35a8
      Yan 提交于
      When buffer isn't uptodate, pin_down_bytes may leave the tree locked
      after it returns.
      Signed-off-by: NChris Mason <chris.mason@oracle.com>
      974e35a8
    • J
    • C
      Btrfs: Fix the defragmention code and the block relocation code for data=ordered · 3eaa2885
      Chris Mason 提交于
      Before setting an extent to delalloc, the code needs to wait for
      pending ordered extents.
      
      Also, the relocation code needs to wait for ordered IO before scanning
      the block group again.  This is because the extents are not removed
      until the IO for the new extents is finished
      Signed-off-by: NChris Mason <chris.mason@oracle.com>
      3eaa2885