async-thread.h 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. /*
  2. * Copyright (C) 2007 Oracle. All rights reserved.
  3. * Copyright (C) 2014 Fujitsu. All rights reserved.
  4. *
  5. * This program is free software; you can redistribute it and/or
  6. * modify it under the terms of the GNU General Public
  7. * License v2 as published by the Free Software Foundation.
  8. *
  9. * This program is distributed in the hope that it will be useful,
  10. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  12. * General Public License for more details.
  13. *
  14. * You should have received a copy of the GNU General Public
  15. * License along with this program; if not, write to the
  16. * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
  17. * Boston, MA 021110-1307, USA.
  18. */
  19. #ifndef __BTRFS_ASYNC_THREAD_
  20. #define __BTRFS_ASYNC_THREAD_
  21. struct btrfs_workqueue;
  22. /* Internal use only */
  23. struct __btrfs_workqueue;
  24. struct btrfs_work {
  25. void (*func)(struct btrfs_work *arg);
  26. void (*ordered_func)(struct btrfs_work *arg);
  27. void (*ordered_free)(struct btrfs_work *arg);
  28. /* Don't touch things below */
  29. struct work_struct normal_work;
  30. struct list_head ordered_list;
  31. struct __btrfs_workqueue *wq;
  32. unsigned long flags;
  33. };
  34. struct btrfs_workqueue *btrfs_alloc_workqueue(char *name,
  35. int flags,
  36. int max_active,
  37. int thresh);
  38. void btrfs_init_work(struct btrfs_work *work,
  39. void (*func)(struct btrfs_work *),
  40. void (*ordered_func)(struct btrfs_work *),
  41. void (*ordered_free)(struct btrfs_work *));
  42. void btrfs_queue_work(struct btrfs_workqueue *wq,
  43. struct btrfs_work *work);
  44. void btrfs_destroy_workqueue(struct btrfs_workqueue *wq);
  45. void btrfs_workqueue_set_max(struct btrfs_workqueue *wq, int max);
  46. void btrfs_set_work_high_priority(struct btrfs_work *work);
  47. #endif