1. 13 12月, 2012 6 次提交
    • S
      Btrfs: cleanup scrub bio and worker wait code · b6bfebc1
      Stefan Behrens 提交于
      Just move some code into functions to make everything more readable.
      Signed-off-by: NStefan Behrens <sbehrens@giantdisaster.de>
      Signed-off-by: NChris Mason <chris.mason@fusionio.com>
      b6bfebc1
    • S
      Btrfs: in scrub repair code, simplify alloc error handling · 34f5c8e9
      Stefan Behrens 提交于
      In the scrub repair code, the code is changed to handle memory
      allocation errors a little bit smarter. The change is to handle
      it just like a read error. This simplifies the code and removes
      a couple of lines of code, since the code to handle read errors
      is there anyway.
      Signed-off-by: NStefan Behrens <sbehrens@giantdisaster.de>
      Signed-off-by: NChris Mason <chris.mason@fusionio.com>
      34f5c8e9
    • S
      Btrfs: in scrub repair code, optimize the reading of mirrors · cb2ced73
      Stefan Behrens 提交于
      In case that disk blocks need to be repaired (rewritten), the
      current code at first (for simplicity reasons) reads all alternate
      mirrors in the first step, afterwards selects the best one in a
      second step. This is now changed to read one alternate mirror
      after the other and to leave the loop early when a perfect mirror
      is found.
      Signed-off-by: NStefan Behrens <sbehrens@giantdisaster.de>
      Signed-off-by: NChris Mason <chris.mason@fusionio.com>
      cb2ced73
    • S
      Btrfs: make the scrub page array dynamically allocated · 7a9e9987
      Stefan Behrens 提交于
      With the modified design (in order to support the devive replace
      procedure) it is necessary to alloc the page array dynamically.
      The reason is that pages are reused. At first a page is used for
      the bio to read the data from the filesystem, then the same page
      is reused for the bio that writes the data to the target disk.
      Since the read process and the write process are completely
      decoupled, this requires a new concept of refcounts and get/put
      functions for pages, and it requires to use newly created pages
      for each read bio which are freed after the write operation
      is finished.
      Signed-off-by: NStefan Behrens <sbehrens@giantdisaster.de>
      Signed-off-by: NChris Mason <chris.mason@fusionio.com>
      7a9e9987
    • S
      Btrfs: remove the block device pointer from the scrub context struct · a36cf8b8
      Stefan Behrens 提交于
      The block device is removed from the scrub context state structure.
      The scrub code as it is used for the device replace procedure reads
      the source data from whereever it is optimal. The source device might
      even be gone (disconnected, for instance due to a hardware failure).
      Or the drive can be so faulty so that the device replace procedure
      tries to avoid access to the faulty source drive as much as possible,
      and only if all other mirrors are damaged, as a last resort, the
      source disk is accessed.
      The modified scrub code operates as if it would handle the source
      drive and thereby generates an exact copy of the source disk on the
      target disk, even if the source disk is not present at all. Therefore
      the block device pointer to the source disk is removed in the scrub
      context struct and moved into the lower level scope of scrub_bio,
      fixup and page structures where the block device context is known.
      Signed-off-by: NStefan Behrens <sbehrens@giantdisaster.de>
      Signed-off-by: NChris Mason <chris.mason@fusionio.com>
      a36cf8b8
    • S
      Btrfs: rename the scrub context structure · d9d181c1
      Stefan Behrens 提交于
      The device replace procedure makes use of the scrub code. The scrub
      code is the most efficient code to read the allocated data of a disk,
      i.e. it reads sequentially in order to avoid disk head movements, it
      skips unallocated blocks, it uses read ahead mechanisms, and it
      contains all the code to detect and repair defects.
      This commit is a first preparation step to adapt the scrub code to
      be shareable for the device replace procedure.
      The block device will be removed from the scrub context state
      structure in a later step. It used to be the source block device.
      The scrub code as it is used for the device replace procedure reads
      the source data from whereever it is optimal. The source device might
      even be gone (disconnected, for instance due to a hardware failure).
      Or the drive can be so faulty so that the device replace procedure
      tries to avoid access to the faulty source drive as much as possible,
      and only if all other mirrors are damaged, as a last resort, the
      source disk is accessed.
      The modified scrub code operates as if it would handle the source
      drive and thereby generates an exact copy of the source disk on the
      target disk, even if the source disk is not present at all. Therefore
      the block device pointer to the source disk is removed in a later
      patch, and therefore the context structure is renamed (this is the
      goal of the current patch) to reflect that no source block device
      scope is there anymore.
      
      Summary:
      This first preparation step consists of a textual substitution of the
      term "dev" to the term "ctx" whereever the scrub context is used.
      Signed-off-by: NStefan Behrens <sbehrens@giantdisaster.de>
      Signed-off-by: NChris Mason <chris.mason@fusionio.com>
      d9d181c1
  2. 02 10月, 2012 3 次提交
  3. 15 6月, 2012 1 次提交
    • J
      Btrfs: use rcu to protect device->name · 606686ee
      Josef Bacik 提交于
      Al pointed out that we can just toss out the old name on a device and add a
      new one arbitrarily, so anybody who uses device->name in printk could
      possibly use free'd memory.  Instead of adding locking around all of this he
      suggested doing it with RCU, so I've introduced a struct rcu_string that
      does just that and have gone through and protected all accesses to
      device->name that aren't under the uuid_mutex with rcu_read_lock().  This
      protects us and I will use it for dealing with removing the device that we
      used to mount the file system in a later patch.  Thanks,
      Reviewed-by: NDavid Sterba <dsterba@suse.cz>
      Signed-off-by: NJosef Bacik <josef@redhat.com>
      606686ee
  4. 30 5月, 2012 1 次提交
  5. 05 5月, 2012 1 次提交
  6. 19 4月, 2012 1 次提交
  7. 13 4月, 2012 1 次提交
  8. 28 3月, 2012 2 次提交
  9. 27 3月, 2012 1 次提交
    • J
      Btrfs: fix regression in scrub path resolving · 7a3ae2f8
      Jan Schmidt 提交于
      In commit 4692cf58 we introduced new backref walking code for btrfs. This
      assumes we're searching live roots, which requires a transaction context.
      While scrubbing, however, we must not join a transaction because this could
      deadlock with the commit path. Additionally, what scrub really wants to do
      is resolving a logical address in the commit root it's currently checking.
      
      This patch adds support for logical to path resolving on commit roots and
      makes scrub use that.
      Signed-off-by: NJan Schmidt <list.btrfs@jan-o-sch.net>
      7a3ae2f8
  10. 22 3月, 2012 3 次提交
  11. 20 3月, 2012 1 次提交
  12. 15 2月, 2012 1 次提交
  13. 05 1月, 2012 1 次提交
    • J
      Btrfs: new backref walking code · 4692cf58
      Jan Schmidt 提交于
      The old backref iteration code could only safely be used on commit roots.
      Besides this limitation, it had bugs in finding the roots for these
      references. This commit replaces large parts of it by btrfs_find_all_roots()
      which a) really finds all roots and the correct roots, b) works correctly
      under heavy file system load, c) considers delayed refs.
      Signed-off-by: NJan Schmidt <list.btrfs@jan-o-sch.net>
      4692cf58
  14. 22 12月, 2011 1 次提交
    • S
      Btrfs: integrate integrity check module into btrfs · 21adbd5c
      Stefan Behrens 提交于
      This is the last part of the patch series. It modifies the btrfs
      code to use the integrity check module if configured to do so
      with the define BTRFS_FS_CHECK_INTEGRITY. If this define is not set,
      the only effective change is that code is added that handles the
      mount option to activate the integrity check. If the mount option is
      set and the define BTRFS_FS_CHECK_INTEGRITY is not set, that code
      complains in the log and the mount fails with EINVAL.
      
      Add the mount option to activate the usage of the integrity check
      code.
      Add invocation of btrfs integrity check code init and cleanup
      function on mount and umount, respectively.
      Add hook to call btrfs integrity check code version of
      submit_bh/submit_bio.
      Signed-off-by: NStefan Behrens <sbehrens@giantdisaster.de>
      21adbd5c
  15. 16 12月, 2011 1 次提交
    • J
      Btrfs: fix num_workers_starting bug and other bugs in async thread · 0dc3b84a
      Josef Bacik 提交于
      Al pointed out we have some random problems with the way we account for
      num_workers_starting in the async thread stuff.  First of all we need to make
      sure to decrement num_workers_starting if we fail to start the worker, so make
      __btrfs_start_workers do this.  Also fix __btrfs_start_workers so that it
      doesn't call btrfs_stop_workers(), there is no point in stopping everybody if we
      failed to create a worker.  Also check_pending_worker_creates needs to call
      __btrfs_start_work in it's work function since it already increments
      num_workers_starting.
      
      People only start one worker at a time, so get rid of the num_workers argument
      everywhere, and make btrfs_queue_worker a void since it will always succeed.
      Thanks,
      Signed-off-by: NJosef Bacik <josef@redhat.com>
      0dc3b84a
  16. 01 12月, 2011 1 次提交
  17. 20 11月, 2011 1 次提交
    • J
      btrfs: Fix up 32/64-bit compatibility for new ioctls · 745c4d8e
      Jeff Mahoney 提交于
       This patch casts to unsigned long before casting to a pointer and fixes
       the following warnings:
      fs/btrfs/extent_io.c:2289:20: warning: cast from pointer to integer of different size [-Wpointer-to-int-cast]
      fs/btrfs/ioctl.c:2933:37: warning: cast from pointer to integer of different size [-Wpointer-to-int-cast]
      fs/btrfs/ioctl.c:2937:21: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
      fs/btrfs/ioctl.c:3020:21: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
      fs/btrfs/scrub.c:275:4: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
      fs/btrfs/backref.c:686:27: warning: cast from pointer to integer of different size [-Wpointer-to-int-cast]
      Signed-off-by: NJeff Mahoney <jeffm@suse.com>
      Signed-off-by: NChris Mason <chris.mason@oracle.com>
      745c4d8e
  18. 11 11月, 2011 1 次提交
  19. 06 11月, 2011 3 次提交
  20. 02 10月, 2011 1 次提交
    • A
      btrfs: use readahead API for scrub · 7a26285e
      Arne Jansen 提交于
      Scrub uses a simple tree-enumeration to bring the relevant portions
      of the extent- and csum-tree into the page cache before starting the
      scrub-I/O. This is now replaced by using the new readahead-API.
      During readahead the scrub is being accounted as paused, so it won't
      hold off transaction commits.
      
      This change raises the average disk bandwith utilisation on my test
      volume from 70% to 90%. On another volume, the time for a test run
      went down from 89s to 43s.
      
      Changes v5:
       - reada1/2 are now of type struct reada_control *
      Signed-off-by: NArne Jansen <sensille@gmx.net>
      7a26285e
  21. 29 9月, 2011 7 次提交
  22. 10 6月, 2011 1 次提交