2008-06-11 14:50:36 -06:00
|
|
|
/*
|
|
|
|
* Copyright (C) 2007 Oracle. All rights reserved.
|
2014-02-27 19:46:03 -07:00
|
|
|
* Copyright (C) 2014 Fujitsu. All rights reserved.
|
2008-06-11 14:50:36 -06:00
|
|
|
*
|
|
|
|
* This program is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU General Public
|
|
|
|
* License v2 as published by the Free Software Foundation.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
* General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public
|
|
|
|
* License along with this program; if not, write to the
|
|
|
|
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
|
|
|
* Boston, MA 021110-1307, USA.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef __BTRFS_ASYNC_THREAD_
|
|
|
|
#define __BTRFS_ASYNC_THREAD_
|
|
|
|
|
2014-02-27 19:46:19 -07:00
|
|
|
struct btrfs_workqueue;
|
2014-02-27 19:46:04 -07:00
|
|
|
/* Internal use only */
|
2014-02-27 19:46:19 -07:00
|
|
|
struct __btrfs_workqueue;
|
2014-03-05 21:19:50 -07:00
|
|
|
struct btrfs_work;
|
|
|
|
typedef void (*btrfs_func_t)(struct btrfs_work *arg);
|
2014-02-27 19:46:03 -07:00
|
|
|
|
2014-02-27 19:46:19 -07:00
|
|
|
struct btrfs_work {
|
2014-03-05 21:19:50 -07:00
|
|
|
btrfs_func_t func;
|
|
|
|
btrfs_func_t ordered_func;
|
|
|
|
btrfs_func_t ordered_free;
|
2014-02-27 19:46:03 -07:00
|
|
|
|
|
|
|
/* Don't touch things below */
|
|
|
|
struct work_struct normal_work;
|
|
|
|
struct list_head ordered_list;
|
2014-02-27 19:46:19 -07:00
|
|
|
struct __btrfs_workqueue *wq;
|
2014-02-27 19:46:03 -07:00
|
|
|
unsigned long flags;
|
|
|
|
};
|
|
|
|
|
2014-02-27 19:46:19 -07:00
|
|
|
struct btrfs_workqueue *btrfs_alloc_workqueue(char *name,
|
2014-03-05 21:19:50 -07:00
|
|
|
int flags,
|
|
|
|
int max_active,
|
|
|
|
int thresh);
|
2014-02-27 19:46:19 -07:00
|
|
|
void btrfs_init_work(struct btrfs_work *work,
|
2014-03-05 21:19:50 -07:00
|
|
|
btrfs_func_t func,
|
|
|
|
btrfs_func_t ordered_func,
|
|
|
|
btrfs_func_t ordered_free);
|
2014-02-27 19:46:19 -07:00
|
|
|
void btrfs_queue_work(struct btrfs_workqueue *wq,
|
|
|
|
struct btrfs_work *work);
|
|
|
|
void btrfs_destroy_workqueue(struct btrfs_workqueue *wq);
|
|
|
|
void btrfs_workqueue_set_max(struct btrfs_workqueue *wq, int max);
|
|
|
|
void btrfs_set_work_high_priority(struct btrfs_work *work);
|
2008-06-11 14:50:36 -06:00
|
|
|
#endif
|