1. 02 12月, 2008 5 次提交
  2. 21 11月, 2008 1 次提交
  3. 20 11月, 2008 8 次提交
    • C
      Btrfs: only flush down bios for writeback pages · 0e6bd956
      Chris Mason 提交于
      The btrfs write_cache_pages call has a flush function so that it submits
      the bio it has been building before it waits on any writeback pages.
      
      This adds a check so that flush only happens on writeback pages.
      Signed-off-by: NChris Mason <chris.mason@oracle.com>
      0e6bd956
    • Y
      Btrfs: Drop dirty roots created by log replay immediately when · e556ce2c
      Yan Zheng 提交于
      The log replay produces dirty roots. These dirty roots
      should be dropped immediately if the fs is mounted as
      ro. Otherwise they can be added to the dirty root list
      again when remounting the fs as rw. Thank you,
      Signed-off-by: NYan Zheng <zheng.yan@oracle.com>
      e556ce2c
    • C
      Btrfs: compat code fixes · 4b4e25f2
      Chris Mason 提交于
      The btrfs git kernel trees is used to build a standalone tree for
      compiling against older kernels.  This commit makes the standalone tree
      work with 2.6.27
      Signed-off-by: NChris Mason <chris.mason@oracle.com>
      4b4e25f2
    • C
      Btrfs: Use current_fsuid/gid · 79683f2d
      Chris Mason 提交于
      This fixes compile problems with linux-next
      Signed-off-by: NChris Mason <chris.mason@oracle.com>
      79683f2d
    • C
      Btrfs: Fixes for 2.6.28-rc API changes · 15916de8
      Chris Mason 提交于
      * open/close_bdev_excl -> open/close_bdev_exclusive
      * blkdev_issue_discard takes a GFP mask now
      * Fix blkdev_issue_discard usage now that it is enabled
      Signed-off-by: NChris Mason <chris.mason@oracle.com>
      15916de8
    • J
      Btrfs: fix free space accounting when unpinning extents · 07103a3c
      Josef Bacik 提交于
      This patch fixes what I hope is the last early ENOSPC bug left.  I did not know
      that pinned extents would merge into one big extent when inserted on to the
      pinned extent tree, so I was adding free space to a block group that could
      possibly span multiple block groups.
      
      This is a big issue because first that space doesn't exist in that block group,
      and second we won't actually use that space because there are a bunch of other
      checks to make sure we're allocating within the constraints of the block group.
      
      This patch fixes the problem by adding the btrfs_add_free_space to
      btrfs_update_pinned_extents which makes sure we are adding the appropriate
      amount of free space to the appropriate block group.  Thanks much to Lee Trager
      for running my myriad of debug patches to help me track this problem down.
      Thank you,
      Signed-off-by: NJosef Bacik <jbacik@redhat.com>
      07103a3c
    • C
      Btrfs: Do fsync log replay when mount -o ro, except when on readonly media · 7c2ca468
      Chris Mason 提交于
      fsync log replay can change the filesystem, so it cannot be delayed until
      mount -o rw,remount, and it can't be forgotten entirely.  So, this patch
      changes btrfs to do with reiserfs, ext3 and xfs do, which is to do the
      log replay even when mounted readonly.
      
      On a readonly device if log replay is required, the mount is aborted.
      
      Getting all of this right had required fixing up some of the error
      handling in open_ctree.
      Signed-off-by: NChris Mason <chris.mason@oracle.com>
      7c2ca468
    • C
      Btrfs: Avoid writeback stalls · d2c3f4f6
      Chris Mason 提交于
      While building large bios in writepages, btrfs may end up waiting
      for other page writeback to finish if WB_SYNC_ALL is used.
      
      While it is waiting, the bio it is building has a number of pages with the
      writeback bit set and they aren't getting to the disk any time soon.  This
      lowers the latencies of writeback in general by sending down the bio being
      built before waiting for other pages.
      
      The bio submission code tries to limit the total number of async bios in
      flight by waiting when we're over a certain number of async bios.  But,
      the waits are happening while writepages is building bios, and this can easily
      lead to stalls and other problems for people calling wait_on_page_writeback.
      
      The current fix is to let the congestion tests take care of waiting.
      
      sync() and others make sure to drain the current async requests to make
      sure that everything that was pending when the sync was started really get
      to disk.  The code would drain pending requests both before and after
      submitting a new request.
      
      But, if one of the requests is waiting for page writeback to finish,
      the draining waits might block that page writeback.  This changes the
      draining code to only wait after submitting the bio being processed.
      Signed-off-by: NChris Mason <chris.mason@oracle.com>
      d2c3f4f6
  4. 19 11月, 2008 2 次提交
  5. 18 11月, 2008 1 次提交
  6. 19 11月, 2008 1 次提交
    • L
      Btrfs: Some fixes for batching extent insert. · b4eec2ca
      Liu Hui 提交于
      In insert_extents(), when ret==1 and last is not zero, it should
      check if the current inserted item is the last item in this batching
      inserts. If so, it should just break from loop. If not, 'cur =
      insert_list->next' will make no sense because the list is empty now,
      and 'op' will point to an unexpectable place.
      
      There are also some trivial fixs in this patch including one comment
      typo error and deleting two redundant lines.
      Signed-off-by: NChris Mason <chris.mason@oracle.com>
      b4eec2ca
  7. 18 11月, 2008 6 次提交
    • C
      Btrfs: prevent loops in the directory tree when creating snapshots · ea9e8b11
      Chris Mason 提交于
      For a directory tree:
      
      /mnt/subvolA/subvolB
      
      btrfsctl -s /mnt/subvolA/subvolB /mnt
      
      Will create a directory loop with subvolA under subvolB.  This
      commit uses the forward refs for each subvol and snapshot to error out
      before creating the loop.
      Signed-off-by: NChris Mason <chris.mason@oracle.com>
      ea9e8b11
    • C
      Btrfs: Add backrefs and forward refs for subvols and snapshots · 0660b5af
      Chris Mason 提交于
      Subvols and snapshots can now be referenced from any point in the directory
      tree.  We need to maintain back refs for them so we can find lost
      subvols.
      
      Forward refs are added so that we know all of the subvols and
      snapshots referenced anywhere in the directory tree of a single subvol.  This
      can be used to do recursive snapshotting (but they aren't yet) and it is
      also used to detect and prevent directory loops when creating new snapshots.
      Signed-off-by: NChris Mason <chris.mason@oracle.com>
      0660b5af
    • C
      Btrfs: Give each subvol and snapshot their own anonymous devid · 3394e160
      Chris Mason 提交于
      Each subvolume has its own private inode number space, and so we need
      to fill in different device numbers for each subvolume to avoid confusing
      applications.
      
      This commit puts a struct super_block into struct btrfs_root so it can
      call set_anon_super() and get a different device number generated for
      each root.
      
      btrfs_rename is changed to prevent renames across subvols.
      Signed-off-by: NChris Mason <chris.mason@oracle.com>
      3394e160
    • C
      Btrfs: Allow subvolumes and snapshots anywhere in the directory tree · 3de4586c
      Chris Mason 提交于
      Before, all snapshots and subvolumes lived in a single flat directory.  This
      was awkward and confusing because the single flat directory was only writable
      with the ioctls.
      
      This commit changes the ioctls to create subvols and snapshots at any
      point in the directory tree.  This requires making separate ioctls for
      snapshot and subvol creation instead of a combining them into one.
      
      The subvol ioctl does:
      
      btrfsctl -S subvol_name parent_dir
      
      After the ioctl is done subvol_name lives inside parent_dir.
      
      The snapshot ioctl does:
      
      btrfsctl -s path_for_snapshot root_to_snapshot
      
      path_for_snapshot can be an absolute or relative path.  btrfsctl breaks it up
      into directory and basename components.
      
      root_to_snapshot can be any file or directory in the FS.  The snapshot
      is taken of the entire root where that file lives.
      Signed-off-by: NChris Mason <chris.mason@oracle.com>
      3de4586c
    • J
      Btrfs: Add some debugging around the ENOSPC bugs · 4ce4cb52
      Josef Bacik 提交于
      Some people are still reporting problems with early enospc.  This
      will help narrown down the cause.
      Signed-off-by: NChris Mason <chris.mason@oracle.com>
      4ce4cb52
    • J
      Btrfs: fix free space leak · e3e469f8
      Josef Bacik 提交于
      In my batch delete/update/insert patch I introduced a free space leak.  The
      extent that we do the original search on in free_extents is never pinned, so we
      always update the block saying that it has free space, but the free space never
      actually gets added to the free space tree, since op->del will always be 0 and
      it's never actually added to the pinned extents tree.
      
      This patch fixes this problem by making sure we call pin_down_bytes on the
      pending extent op and set op->del to the return value of pin_down_bytes so
      update_block_group is called with the right value.  This seems to fix the case
      where we were getting ENOSPC when there was plenty of space available.
      Signed-off-by: NJosef Bacik <jbacik@redhat.com>
      e3e469f8
  8. 13 11月, 2008 3 次提交
  9. 18 11月, 2008 1 次提交
    • Y
      Btrfs: Seed device support · 2b82032c
      Yan Zheng 提交于
      Seed device is a special btrfs with SEEDING super flag
      set and can only be mounted in read-only mode. Seed
      devices allow people to create new btrfs on top of it.
      
      The new FS contains the same contents as the seed device,
      but it can be mounted in read-write mode.
      
      This patch does the following:
      
      1) split code in btrfs_alloc_chunk into two parts. The first part does makes
      the newly allocated chunk usable, but does not do any operation that modifies
      the chunk tree. The second part does the the chunk tree modifications. This
      division is for the bootstrap step of adding storage to the seed device.
      
      2) Update device management code to handle seed device.
      The basic idea is: For an FS grown from seed devices, its
      seed devices are put into a list. Seed devices are
      opened on demand at mounting time. If any seed device is
      missing or has been changed, btrfs kernel module will
      refuse to mount the FS.
      
      3) make btrfs_find_block_group not return NULL when all
      block groups are read-only.
      Signed-off-by: NYan Zheng <zheng.yan@oracle.com>
      2b82032c
  10. 13 11月, 2008 5 次提交
    • Y
      Btrfs: mount ro and remount support · c146afad
      Yan Zheng 提交于
      This patch adds mount ro and remount support. The main
      changes in patch are: adding btrfs_remount and related
      helper function; splitting the transaction related code
      out of close_ctree into btrfs_commit_super; updating
      allocator to properly handle read only block group.
      Signed-off-by: NYan Zheng <zheng.yan@oracle.com>
      c146afad
    • J
      Btrfs: batch extent inserts/updates/deletions on the extent root · f3465ca4
      Josef Bacik 提交于
      While profiling the allocator I noticed a good amount of time was being spent in
      finish_current_insert and del_pending_extents, and as the filesystem filled up
      more and more time was being spent in those functions.  This patch aims to try
      and reduce that problem.  This happens two ways
      
      1) track if we tried to delete an extent that we are going to update or insert.
      Once we get into finish_current_insert we discard any of the extents that were
      marked for deletion.  This saves us from doing unnecessary work almost every
      time finish_current_insert runs.
      
      2) Batch insertion/updates/deletions.  Instead of doing a btrfs_search_slot for
      each individual extent and doing the needed operation, we instead keep the leaf
      around and see if there is anything else we can do on that leaf.  On the insert
      case I introduced a btrfs_insert_some_items, which will take an array of keys
      with an array of data_sizes and try and squeeze in as many of those keys as
      possible, and then return how many keys it was able to insert.  In the update
      case we search for an extent ref, update the ref and then loop through the leaf
      to see if any of the other refs we are looking to update are on that leaf, and
      then once we are done we release the path and search for the next ref we need to
      update.  And finally for the deletion we try and delete the extent+ref in pairs,
      so we will try to find extent+ref pairs next to the extent we are trying to free
      and free them in bulk if possible.
      
      This along with the other cluster fix that Chris pushed out a bit ago helps make
      the allocator preform more uniformly as it fills up the disk.  There is still a
      slight drop as we fill up the disk since we start having to stick new blocks in
      odd places which results in more COW's than on a empty fs, but the drop is not
      nearly as severe as it was before.
      Signed-off-by: NJosef Bacik <jbacik@redhat.com>
      f3465ca4
    • S
      Btrfs: allow clone of an arbitrary file range · c5c9cd4d
      Sage Weil 提交于
      This patch adds an additional CLONE_RANGE ioctl to clone an arbitrary 
      (block-aligned) file range to another file.  The original CLONE ioctl 
      becomes a special case of cloning the entire file range.  The logic is a 
      bit more complex now since ranges may be cloned to different offsets, and 
      because we may only be cloning the beginning or end of a particular extent 
      or checksum item.
      
      An additional sanity check ensures the source and destination files aren't 
      the same (which would previously deadlock), although eventually this could 
      be extended to allow the duplication of file data at a different offset 
      within the same file.
      
      Any extents within the destination range in the target file are dropped.
      
      We currently do not cope with the case where a compressed inline extent 
      needs to be split.  This will probably require decompressing the extent 
      into a temporary address_space, and inserting just the cloned portion as a 
      new compressed inline extent.  For now, just return -EINVAL in this case.  
      Note that this never comes up in the more common case of cloning an entire 
      file.
      Signed-off-by: NChris Mason <chris.mason@oracle.com>
      c5c9cd4d
    • C
      Btrfs: Fix handling of space info full during allocations · 2ed6d664
      Chris Mason 提交于
      When we fail to allocate a new block group, we should still do the
      checks to make sure allocations try again with the minimum requested
      allocation size.
      
      This also fixes a deadlock that come from a missed down_read in
      the chunk allocation failure handling.
      Signed-off-by: NChris Mason <chris.mason@oracle.com>
      2ed6d664
    • C
      Btrfs: Improve metadata read latencies · 6f3577bd
      Chris Mason 提交于
      This fixes latency problems on metadata reads by making sure they
      don't go through the async submit queue, and by tuning down the amount
      of readahead done during btree searches.
      
      Also, the btrfs bdi congestion function is tuned to ignore the
      number of pending async bios and checksums pending.  There is additional
      code that throttles new async bios now and the congestion function
      doesn't need to worry about it anymore.
      Signed-off-by: NChris Mason <chris.mason@oracle.com>
      6f3577bd
  11. 11 11月, 2008 7 次提交