Lines Matching full:ds
287 struct dm_deferred_set *ds; member
302 struct dm_deferred_set *ds; in dm_deferred_set_create() local
304 ds = kmalloc(sizeof(*ds), GFP_KERNEL); in dm_deferred_set_create()
305 if (!ds) in dm_deferred_set_create()
308 spin_lock_init(&ds->lock); in dm_deferred_set_create()
309 ds->current_entry = 0; in dm_deferred_set_create()
310 ds->sweeper = 0; in dm_deferred_set_create()
312 ds->entries[i].ds = ds; in dm_deferred_set_create()
313 ds->entries[i].count = 0; in dm_deferred_set_create()
314 INIT_LIST_HEAD(&ds->entries[i].work_items); in dm_deferred_set_create()
317 return ds; in dm_deferred_set_create()
321 void dm_deferred_set_destroy(struct dm_deferred_set *ds) in dm_deferred_set_destroy() argument
323 kfree(ds); in dm_deferred_set_destroy()
327 struct dm_deferred_entry *dm_deferred_entry_inc(struct dm_deferred_set *ds) in dm_deferred_entry_inc() argument
332 spin_lock_irqsave(&ds->lock, flags); in dm_deferred_entry_inc()
333 entry = ds->entries + ds->current_entry; in dm_deferred_entry_inc()
335 spin_unlock_irqrestore(&ds->lock, flags); in dm_deferred_entry_inc()
346 static void __sweep(struct dm_deferred_set *ds, struct list_head *head) in __sweep() argument
348 while ((ds->sweeper != ds->current_entry) && in __sweep()
349 !ds->entries[ds->sweeper].count) { in __sweep()
350 list_splice_init(&ds->entries[ds->sweeper].work_items, head); in __sweep()
351 ds->sweeper = ds_next(ds->sweeper); in __sweep()
354 if ((ds->sweeper == ds->current_entry) && !ds->entries[ds->sweeper].count) in __sweep()
355 list_splice_init(&ds->entries[ds->sweeper].work_items, head); in __sweep()
362 spin_lock_irqsave(&entry->ds->lock, flags); in dm_deferred_entry_dec()
365 __sweep(entry->ds, head); in dm_deferred_entry_dec()
366 spin_unlock_irqrestore(&entry->ds->lock, flags); in dm_deferred_entry_dec()
373 int dm_deferred_set_add_work(struct dm_deferred_set *ds, struct list_head *work) in dm_deferred_set_add_work() argument
378 spin_lock_irq(&ds->lock); in dm_deferred_set_add_work()
379 if ((ds->sweeper == ds->current_entry) && in dm_deferred_set_add_work()
380 !ds->entries[ds->current_entry].count) in dm_deferred_set_add_work()
383 list_add(work, &ds->entries[ds->current_entry].work_items); in dm_deferred_set_add_work()
384 next_entry = ds_next(ds->current_entry); in dm_deferred_set_add_work()
385 if (!ds->entries[next_entry].count) in dm_deferred_set_add_work()
386 ds->current_entry = next_entry; in dm_deferred_set_add_work()
388 spin_unlock_irq(&ds->lock); in dm_deferred_set_add_work()