struct dm_buffer {
struct rb_node node;
struct list_head lru_list;
+ struct list_head global_list;
sector_t block;
void *data;
unsigned char data_mode; /* DATA_MODE_* */
*/
static unsigned long dm_bufio_cache_size_latch;
-static DEFINE_SPINLOCK(param_spinlock);
+static DEFINE_SPINLOCK(global_spinlock);
+
+static LIST_HEAD(global_queue);
/*
* Buffers are freed after this timeout
if (unlink)
diff = -diff;
- spin_lock(¶m_spinlock);
+ spin_lock(&global_spinlock);
*class_ptr[data_mode] += diff;
if (dm_bufio_current_allocated > dm_bufio_peak_allocated)
dm_bufio_peak_allocated = dm_bufio_current_allocated;
- spin_unlock(¶m_spinlock);
+ if (!unlink) {
+ list_add(&b->global_list, &global_queue);
+ } else {
+ list_del(&b->global_list);
+ }
+
+ spin_unlock(&global_spinlock);
}
/*