diff options
-rw-r--r-- | Documentation/slow-work.txt | 15 | ||||
-rw-r--r-- | include/linux/slow-work.h | 19 |
2 files changed, 34 insertions, 0 deletions
diff --git a/Documentation/slow-work.txt b/Documentation/slow-work.txt index f120238e70f..0169c9d9dd1 100644 --- a/Documentation/slow-work.txt +++ b/Documentation/slow-work.txt | |||
@@ -144,6 +144,21 @@ from being taken away before it completes. module should almost certainly be | |||
144 | THIS_MODULE. | 144 | THIS_MODULE. |
145 | 145 | ||
146 | 146 | ||
147 | ================ | ||
148 | HELPER FUNCTIONS | ||
149 | ================ | ||
150 | |||
151 | The slow-work facility provides a function by which it can be determined | ||
152 | whether or not an item is queued for later execution: | ||
153 | |||
154 | bool queued = slow_work_is_queued(struct slow_work *work); | ||
155 | |||
156 | If it returns false, then the item is not on the queue (it may be executing | ||
157 | with a requeue pending). This can be used to work out whether an item on which | ||
158 | another depends is on the queue, thus allowing a dependent item to be queued | ||
159 | after it. | ||
160 | |||
161 | |||
147 | =============== | 162 | =============== |
148 | ITEM OPERATIONS | 163 | ITEM OPERATIONS |
149 | =============== | 164 | =============== |
diff --git a/include/linux/slow-work.h b/include/linux/slow-work.h index f41485145ed..bfd3ab4c889 100644 --- a/include/linux/slow-work.h +++ b/include/linux/slow-work.h | |||
@@ -120,6 +120,25 @@ static inline void vslow_work_init(struct slow_work *work, | |||
120 | INIT_LIST_HEAD(&work->link); | 120 | INIT_LIST_HEAD(&work->link); |
121 | } | 121 | } |
122 | 122 | ||
123 | /** | ||
124 | * slow_work_is_queued - Determine if a slow work item is on the work queue | ||
125 | * work: The work item to test | ||
126 | * | ||
127 | * Determine if the specified slow-work item is on the work queue. This | ||
128 | * returns true if it is actually on the queue. | ||
129 | * | ||
130 | * If the item is executing and has been marked for requeue when execution | ||
131 | * finishes, then false will be returned. | ||
132 | * | ||
133 | * Anyone wishing to wait for completion of execution can wait on the | ||
134 | * SLOW_WORK_EXECUTING bit. | ||
135 | */ | ||
136 | static inline bool slow_work_is_queued(struct slow_work *work) | ||
137 | { | ||
138 | unsigned long flags = work->flags; | ||
139 | return flags & SLOW_WORK_PENDING && !(flags & SLOW_WORK_EXECUTING); | ||
140 | } | ||
141 | |||
123 | extern int slow_work_enqueue(struct slow_work *work); | 142 | extern int slow_work_enqueue(struct slow_work *work); |
124 | extern void slow_work_cancel(struct slow_work *work); | 143 | extern void slow_work_cancel(struct slow_work *work); |
125 | extern int slow_work_register_user(struct module *owner); | 144 | extern int slow_work_register_user(struct module *owner); |