1. 16 9月, 2009 1 次提交
    • C
      Btrfs: fix async worker startup race · 3e99d8eb
      Chris Mason 提交于
      After a new worker thread starts, it is placed into the
      list of idle threads.  But, this may race with a
      check for idle done by the worker thread itself, resulting
      in a double list_add operation.
      
      This fix adds a check to make sure the idle thread addition
      is done properly.
      Signed-off-by: NChris Mason <chris.mason@oracle.com>
      3e99d8eb
  2. 12 9月, 2009 3 次提交
    • C
      Btrfs: reduce worker thread spin_lock_irq hold times · 4f878e84
      Chris Mason 提交于
      This changes the btrfs worker threads to batch work items
      into a local list.  It allows us to pull work items in
      large chunks and significantly reduces the number of times we
      need to take the worker thread spinlock.
      Signed-off-by: NChris Mason <chris.mason@oracle.com>
      4f878e84
    • C
      Btrfs: keep irqs on more often in the worker threads · 4e3f9c50
      Chris Mason 提交于
      The btrfs worker thread spinlock was being used both for the
      queueing of IO and for the processing of ordered events.
      
      The ordered events never happen from end_io handlers, and so they
      don't need to use the _irq version of spinlocks.  This adds a
      dedicated lock to the ordered lists so they don't have to run
      with irqs off.
      Signed-off-by: NChris Mason <chris.mason@oracle.com>
      4e3f9c50
    • C
      Btrfs: Allow worker threads to exit when idle · 9042846b
      Chris Mason 提交于
      The Btrfs worker threads don't currently die off after they have
      been idle for a while, leading to a lot of threads sitting around
      doing nothing for each mount.
      
      Also, they are unable to start atomically (from end_io hanlders).
      
      This commit reworks the worker threads so they can be started
      from end_io handlers (just setting a flag that asks for a thread
      to be added at a later date) and so they can exit if they
      have been idle for a long time.
      Signed-off-by: NChris Mason <chris.mason@oracle.com>
      9042846b
  3. 23 7月, 2009 1 次提交
  4. 03 7月, 2009 1 次提交
  5. 11 6月, 2009 1 次提交
    • S
      Btrfs: init worker struct fields before kthread-run · fd0fb038
      Shin Hong 提交于
      This patch fixes a bug which may result race condition
      between btrfs_start_workers() and worker_loop().
      
      btrfs_start_workers() executed in a parent thread writes
      on workers->worker and worker_loop() in a child thread
      reads workers->worker. However, there is no synchronization
      enforcing the order of two operations.
      
      This patch makes btrfs_start_workers() fill workers->worker
      before it starts a child thread with worker_loop()
      Signed-off-by: NChris Mason <chris.mason@oracle.com>
      fd0fb038
  6. 21 4月, 2009 1 次提交
    • C
      Btrfs: add a priority queue to the async thread helpers · d313d7a3
      Chris Mason 提交于
      Btrfs is using WRITE_SYNC_PLUG to send down synchronous IOs with a
      higher priority.  But, the checksumming helper threads prevent it
      from being fully effective.
      
      There are two problems.  First, a big queue of pending checksumming
      will delay the synchronous IO behind other lower priority writes.  Second,
      the checksumming uses an ordered async work queue.  The ordering makes sure
      that IOs are sent to the block layer in the same order they are sent
      to the checksumming threads.  Usually this gives us less seeky IO.
      
      But, when we start mixing IO priorities, the lower priority IO can delay
      the higher priority IO.
      
      This patch solves both problems by adding a high priority list to the async
      helper threads, and a new btrfs_set_work_high_prio(), which is used
      to make put a new async work item onto the higher priority list.
      
      The ordering is still done on high priority IO, but all of the high
      priority bios are ordered separately from the low priority bios.  This
      ordering is purely an IO optimization, it is not involved in data
      or metadata integrity.
      Signed-off-by: NChris Mason <chris.mason@oracle.com>
      d313d7a3
  7. 03 4月, 2009 2 次提交
  8. 04 2月, 2009 2 次提交
  9. 21 1月, 2009 1 次提交
  10. 06 1月, 2009 1 次提交
  11. 13 11月, 2008 1 次提交
    • Y
      Btrfs: Check kthread_should_stop() before schedule() in worker_loop · 0df49b91
      yanhai zhu 提交于
      In worker_loop(), the func should check whether it has been requested to stop
      before it decides to schedule out.
      
      Otherwise if the stop request(also the last wake_up()) sent by
      btrfs_stop_workers() happens when worker_loop() running after the "while"
      judgement and before schedule(), woker_loop() will schedule away and never be
      woken up, which will also cause btrfs_stop_workers() wait forever.
      Signed-off-by: NChris Mason <chris.mason@oracle.com>
      0df49b91
  12. 07 11月, 2008 1 次提交
    • C
      Btrfs: Add ordered async work queues · 4a69a410
      Chris Mason 提交于
      Btrfs uses kernel threads to create async work queues for cpu intensive
      operations such as checksumming and decompression.  These work well,
      but they make it difficult to keep IO order intact.
      
      A single writepages call from pdflush or fsync will turn into a number
      of bios, and each bio is checksummed in parallel.  Once the checksum is
      computed, the bio is sent down to the disk, and since we don't control
      the order in which the parallel operations happen, they might go down to
      the disk in almost any order.
      
      The code deals with this somewhat by having deep work queues for a single
      kernel thread, making it very likely that a single thread will process all
      the bios for a single inode.
      
      This patch introduces an explicitly ordered work queue.  As work structs
      are placed into the queue they are put onto the tail of a list.  They have
      three callbacks:
      
      ->func (cpu intensive processing here)
      ->ordered_func (order sensitive processing here)
      ->ordered_free (free the work struct, all processing is done)
      
      The work struct has three callbacks.  The func callback does the cpu intensive
      work, and when it completes the work struct is marked as done.
      
      Every time a work struct completes, the list is checked to see if the head
      is marked as done.  If so the ordered_func callback is used to do the
      order sensitive processing and the ordered_free callback is used to do
      any cleanup.  Then we loop back and check the head of the list again.
      
      This patch also changes the checksumming code to use the ordered workqueues.
      One a 4 drive array, it increases streaming writes from 280MB/s to 350MB/s.
      Signed-off-by: NChris Mason <chris.mason@oracle.com>
      4a69a410
  13. 01 10月, 2008 1 次提交
    • 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
  14. 30 9月, 2008 1 次提交
    • C
      Btrfs: add and improve comments · d352ac68
      Chris Mason 提交于
      This improves the comments at the top of many functions.  It didn't
      dive into the guts of functions because I was trying to
      avoid merging problems with the new allocator and back reference work.
      
      extent-tree.c and volumes.c were both skipped, and there is definitely
      more work todo in cleaning and commenting the code.
      Signed-off-by: NChris Mason <chris.mason@oracle.com>
      d352ac68
  15. 26 9月, 2008 1 次提交
  16. 25 9月, 2008 8 次提交