summaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorJoe Thornber <ejt@redhat.com>2013-10-30 17:29:30 +0000
committerMike Snitzer <snitzer@redhat.com>2013-11-09 18:19:59 -0500
commit238f8363b6661fd9dd9aae854917ab9c661f3652 (patch)
treec1ea27daf3c5b2b0ff37f2ee2037bd74458f1d23 /drivers
parent66cb1910df17b38334153462ec8166e48058035f (diff)
downloadblackbird-op-linux-238f8363b6661fd9dd9aae854917ab9c661f3652.tar.gz
blackbird-op-linux-238f8363b6661fd9dd9aae854917ab9c661f3652.zip
dm cache: improve efficiency of quiescing flag management
Make the quiescing flag an atomic_t and stop protecting it with a spin lock. Signed-off-by: Joe Thornber <ejt@redhat.com> Signed-off-by: Mike Snitzer <snitzer@redhat.com>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/md/dm-cache-target.c27
1 files changed, 5 insertions, 22 deletions
diff --git a/drivers/md/dm-cache-target.c b/drivers/md/dm-cache-target.c
index 25d3253e72d0..50afdf72285b 100644
--- a/drivers/md/dm-cache-target.c
+++ b/drivers/md/dm-cache-target.c
@@ -149,6 +149,7 @@ struct cache {
atomic_t nr_migrations;
wait_queue_head_t quiescing_wait;
+ atomic_t quiescing;
atomic_t quiescing_ack;
/*
@@ -189,7 +190,6 @@ struct cache {
bool need_tick_bio:1;
bool sized:1;
- bool quiescing:1;
bool commit_requested:1;
bool loaded_mappings:1;
bool loaded_discards:1;
@@ -1353,14 +1353,7 @@ static void writeback_some_dirty_blocks(struct cache *cache)
*--------------------------------------------------------------*/
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)
@@ -1378,23 +1371,13 @@ static void wait_for_quiescing_ack(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);
}
@@ -2030,6 +2013,7 @@ static int cache_create(struct cache_args *ca, struct cache **result)
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;
@@ -2091,7 +2075,6 @@ static int cache_create(struct cache_args *ca, struct cache **result)
cache->need_tick_bio = true;
cache->sized = false;
- cache->quiescing = false;
cache->commit_requested = false;
cache->loaded_mappings = false;
cache->loaded_discards = false;
OpenPOWER on IntegriCloud