1. 12 9月, 2009 1 次提交
    • 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
  2. 23 7月, 2009 1 次提交
  3. 03 7月, 2009 1 次提交
  4. 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
  5. 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
  6. 03 4月, 2009 2 次提交
  7. 04 2月, 2009 2 次提交
  8. 21 1月, 2009 1 次提交
  9. 06 1月, 2009 1 次提交
  10. 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
  11. 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
  12. 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
  13. 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
  14. 26 9月, 2008 1 次提交
  15. 25 9月, 2008 8 次提交