]> www.infradead.org Git - users/willy/xarray.git/commitdiff
blk-cgroup: Reduce scope of blkg_array lock
authorMatthew Wilcox <willy@infradead.org>
Mon, 18 Mar 2019 15:31:18 +0000 (11:31 -0400)
committerMatthew Wilcox (Oracle) <willy@infradead.org>
Thu, 8 Aug 2019 02:35:36 +0000 (22:35 -0400)
We can now take and release the blkg_array lock within blkg_destroy()
instead of forcing the caller to hold it across the call.

Signed-off-by: Matthew Wilcox <willy@infradead.org>
block/blk-cgroup.c

index 8f58c83178caafe16247f8976ccbacc6f53da77e..b7dd887897979d0eac3f98c2729207b224b83bea 100644 (file)
@@ -388,7 +388,6 @@ static void blkg_destroy(struct blkcg_gq *blkg)
        int i;
 
        lockdep_assert_held(&blkg->q->queue_lock);
-       lockdep_assert_held(&blkcg->blkg_array.xa_lock);
 
        /* Something wrong if we are trying to remove same group twice */
        WARN_ON_ONCE(list_empty(&blkg->q_node));
@@ -407,7 +406,7 @@ static void blkg_destroy(struct blkcg_gq *blkg)
 
        blkg->online = false;
 
-       __xa_erase(&blkcg->blkg_array, blkg->q->id);
+       xa_erase(&blkcg->blkg_array, blkg->q->id);
        list_del_init(&blkg->q_node);
 
        /*
@@ -437,11 +436,7 @@ static void blkg_destroy_all(struct request_queue *q)
 
        spin_lock_irq(&q->queue_lock);
        list_for_each_entry_safe(blkg, n, &q->blkg_list, q_node) {
-               struct blkcg *blkcg = blkg->blkcg;
-
-               xa_lock(&blkcg->blkg_array);
                blkg_destroy(blkg);
-               xa_unlock(&blkcg->blkg_array);
        }
 
        q->root_blkg = NULL;
@@ -1045,9 +1040,7 @@ void blkcg_destroy_blkgs(struct blkcg *blkcg)
                struct request_queue *q = blkg->q;
 
                spin_lock_irq(&q->queue_lock);
-               xa_lock(&blkcg->blkg_array);
                blkg_destroy(blkg);
-               xa_unlock(&blkcg->blkg_array);
                spin_unlock_irq(&q->queue_lock);
        }
 }