diff options
Diffstat (limited to 'block/blk-ioc.c')
-rw-r--r-- | block/blk-ioc.c | 45 |
1 files changed, 45 insertions, 0 deletions
diff --git a/block/blk-ioc.c b/block/blk-ioc.c index b13ed96776c2..6f59fbad93d9 100644 --- a/block/blk-ioc.c +++ b/block/blk-ioc.c | |||
@@ -188,6 +188,51 @@ struct io_context *get_task_io_context(struct task_struct *task, | |||
188 | } | 188 | } |
189 | EXPORT_SYMBOL(get_task_io_context); | 189 | EXPORT_SYMBOL(get_task_io_context); |
190 | 190 | ||
191 | void ioc_set_changed(struct io_context *ioc, int which) | ||
192 | { | ||
193 | struct cfq_io_context *cic; | ||
194 | struct hlist_node *n; | ||
195 | |||
196 | hlist_for_each_entry(cic, n, &ioc->cic_list, cic_list) | ||
197 | set_bit(which, &cic->changed); | ||
198 | } | ||
199 | |||
200 | /** | ||
201 | * ioc_ioprio_changed - notify ioprio change | ||
202 | * @ioc: io_context of interest | ||
203 | * @ioprio: new ioprio | ||
204 | * | ||
205 | * @ioc's ioprio has changed to @ioprio. Set %CIC_IOPRIO_CHANGED for all | ||
206 | * cic's. iosched is responsible for checking the bit and applying it on | ||
207 | * request issue path. | ||
208 | */ | ||
209 | void ioc_ioprio_changed(struct io_context *ioc, int ioprio) | ||
210 | { | ||
211 | unsigned long flags; | ||
212 | |||
213 | spin_lock_irqsave(&ioc->lock, flags); | ||
214 | ioc->ioprio = ioprio; | ||
215 | ioc_set_changed(ioc, CIC_IOPRIO_CHANGED); | ||
216 | spin_unlock_irqrestore(&ioc->lock, flags); | ||
217 | } | ||
218 | |||
219 | /** | ||
220 | * ioc_cgroup_changed - notify cgroup change | ||
221 | * @ioc: io_context of interest | ||
222 | * | ||
223 | * @ioc's cgroup has changed. Set %CIC_CGROUP_CHANGED for all cic's. | ||
224 | * iosched is responsible for checking the bit and applying it on request | ||
225 | * issue path. | ||
226 | */ | ||
227 | void ioc_cgroup_changed(struct io_context *ioc) | ||
228 | { | ||
229 | unsigned long flags; | ||
230 | |||
231 | spin_lock_irqsave(&ioc->lock, flags); | ||
232 | ioc_set_changed(ioc, CIC_CGROUP_CHANGED); | ||
233 | spin_unlock_irqrestore(&ioc->lock, flags); | ||
234 | } | ||
235 | |||
191 | static int __init blk_ioc_init(void) | 236 | static int __init blk_ioc_init(void) |
192 | { | 237 | { |
193 | iocontext_cachep = kmem_cache_create("blkdev_ioc", | 238 | iocontext_cachep = kmem_cache_create("blkdev_ioc", |