atomic_t nr_migrations;
wait_queue_head_t quiescing_wait;
+ atomic_t quiescing;
atomic_t quiescing_ack;
/*
bool need_tick_bio:1;
bool sized:1;
- bool quiescing:1;
bool commit_requested:1;
bool loaded_mappings:1;
bool loaded_discards:1;
*--------------------------------------------------------------*/
static bool is_quiescing(struct cache *cache)
{
- int r;
- unsigned long flags;
-
- spin_lock_irqsave(&cache->lock, flags);
- r = cache->quiescing;
- spin_unlock_irqrestore(&cache->lock, flags);
-
- return r;
+ return atomic_read(&cache->quiescing);
}
static void ack_quiescing(struct cache *cache)
static void start_quiescing(struct cache *cache)
{
- unsigned long flags;
-
- spin_lock_irqsave(&cache->lock, flags);
- cache->quiescing = true;
- spin_unlock_irqrestore(&cache->lock, flags);
-
+ atomic_inc(&cache->quiescing);
wait_for_quiescing_ack(cache);
}
static void stop_quiescing(struct cache *cache)
{
- unsigned long flags;
-
- spin_lock_irqsave(&cache->lock, flags);
- cache->quiescing = false;
- spin_unlock_irqrestore(&cache->lock, flags);
-
+ atomic_set(&cache->quiescing, 0);
atomic_set(&cache->quiescing_ack, 0);
}
init_waitqueue_head(&cache->migration_wait);
init_waitqueue_head(&cache->quiescing_wait);
+ atomic_set(&cache->quiescing, 0);
atomic_set(&cache->quiescing_ack, 0);
r = -ENOMEM;
cache->need_tick_bio = true;
cache->sized = false;
- cache->quiescing = false;
cache->commit_requested = false;
cache->loaded_mappings = false;
cache->loaded_discards = false;