summaryrefslogtreecommitdiffstats
path: root/include/linux/slow-work.h
diff options
context:
space:
mode:
authorJens Axboe <jens.axboe@oracle.com>2009-11-19 18:10:47 +0000
committerDavid Howells <dhowells@redhat.com>2009-11-19 18:10:47 +0000
commit6b8268b17a1ffc942bc72d7d00274e433d6b6719 (patch)
treebd293facd4b805fc05588fcaf024e964a0bb1cca /include/linux/slow-work.h
parent0160950297c08f8233c89b9f9e7dd59cfb080809 (diff)
downloadlinux-6b8268b17a1ffc942bc72d7d00274e433d6b6719.tar.gz
linux-6b8268b17a1ffc942bc72d7d00274e433d6b6719.tar.bz2
linux-6b8268b17a1ffc942bc72d7d00274e433d6b6719.zip
SLOW_WORK: Add delayed_slow_work support
This adds support for starting slow work with a delay, similar to the functionality we have for workqueues. Signed-off-by: Jens Axboe <jens.axboe@oracle.com> Signed-off-by: David Howells <dhowells@redhat.com>
Diffstat (limited to 'include/linux/slow-work.h')
-rw-r--r--include/linux/slow-work.h29
1 files changed, 29 insertions, 0 deletions
diff --git a/include/linux/slow-work.h b/include/linux/slow-work.h
index eef20182d5b4..b245b9a9cc0b 100644
--- a/include/linux/slow-work.h
+++ b/include/linux/slow-work.h
@@ -17,6 +17,7 @@
#ifdef CONFIG_SLOW_WORK
#include <linux/sysctl.h>
+#include <linux/timer.h>
struct slow_work;
@@ -52,10 +53,16 @@ struct slow_work {
#define SLOW_WORK_ENQ_DEFERRED 2 /* item enqueue deferred */
#define SLOW_WORK_VERY_SLOW 3 /* item is very slow */
#define SLOW_WORK_CANCELLING 4 /* item is being cancelled, don't enqueue */
+#define SLOW_WORK_DELAYED 5 /* item is struct delayed_slow_work with active timer */
const struct slow_work_ops *ops; /* operations table for this item */
struct list_head link; /* link in queue */
};
+struct delayed_slow_work {
+ struct slow_work work;
+ struct timer_list timer;
+};
+
/**
* slow_work_init - Initialise a slow work item
* @work: The work item to initialise
@@ -72,6 +79,20 @@ static inline void slow_work_init(struct slow_work *work,
}
/**
+ * slow_work_init - Initialise a delayed slow work item
+ * @work: The work item to initialise
+ * @ops: The operations to use to handle the slow work item
+ *
+ * Initialise a delayed slow work item.
+ */
+static inline void delayed_slow_work_init(struct delayed_slow_work *dwork,
+ const struct slow_work_ops *ops)
+{
+ init_timer(&dwork->timer);
+ slow_work_init(&dwork->work, ops);
+}
+
+/**
* vslow_work_init - Initialise a very slow work item
* @work: The work item to initialise
* @ops: The operations to use to handle the slow work item
@@ -93,6 +114,14 @@ extern void slow_work_cancel(struct slow_work *work);
extern int slow_work_register_user(struct module *owner);
extern void slow_work_unregister_user(struct module *owner);
+extern int delayed_slow_work_enqueue(struct delayed_slow_work *dwork,
+ unsigned long delay);
+
+static inline void delayed_slow_work_cancel(struct delayed_slow_work *dwork)
+{
+ slow_work_cancel(&dwork->work);
+}
+
#ifdef CONFIG_SYSCTL
extern ctl_table slow_work_sysctls[];
#endif