summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--block/bio.c2
-rw-r--r--block/blk-cgroup.c3
-rw-r--r--block/blk-iolatency.c2
-rw-r--r--include/linux/blk-cgroup.h12
4 files changed, 8 insertions, 11 deletions
diff --git a/block/bio.c b/block/bio.c
index 7ec5316e6ecc..06760543ec81 100644
--- a/block/bio.c
+++ b/block/bio.c
@@ -1990,7 +1990,7 @@ static void __bio_associate_blkg(struct bio *bio, struct blkcg_gq *blkg)
1990{ 1990{
1991 bio_disassociate_blkg(bio); 1991 bio_disassociate_blkg(bio);
1992 1992
1993 bio->bi_blkg = blkg_try_get_closest(blkg); 1993 bio->bi_blkg = blkg_tryget_closest(blkg);
1994} 1994}
1995 1995
1996/** 1996/**
diff --git a/block/blk-cgroup.c b/block/blk-cgroup.c
index 2ca7611fe274..6bd0619a7d6e 100644
--- a/block/blk-cgroup.c
+++ b/block/blk-cgroup.c
@@ -1736,8 +1736,7 @@ void blkcg_maybe_throttle_current(void)
1736 blkg = blkg_lookup(blkcg, q); 1736 blkg = blkg_lookup(blkcg, q);
1737 if (!blkg) 1737 if (!blkg)
1738 goto out; 1738 goto out;
1739 blkg = blkg_try_get(blkg); 1739 if (!blkg_tryget(blkg))
1740 if (!blkg)
1741 goto out; 1740 goto out;
1742 rcu_read_unlock(); 1741 rcu_read_unlock();
1743 1742
diff --git a/block/blk-iolatency.c b/block/blk-iolatency.c
index 5a79f06a730d..0b14c3d57769 100644
--- a/block/blk-iolatency.c
+++ b/block/blk-iolatency.c
@@ -698,7 +698,7 @@ static void blkiolatency_timer_fn(struct timer_list *t)
698 * We could be exiting, don't access the pd unless we have a 698 * We could be exiting, don't access the pd unless we have a
699 * ref on the blkg. 699 * ref on the blkg.
700 */ 700 */
701 if (!blkg_try_get(blkg)) 701 if (!blkg_tryget(blkg))
702 continue; 702 continue;
703 703
704 iolat = blkg_to_lat(blkg); 704 iolat = blkg_to_lat(blkg);
diff --git a/include/linux/blk-cgroup.h b/include/linux/blk-cgroup.h
index d19ef15a673d..752de1becb5c 100644
--- a/include/linux/blk-cgroup.h
+++ b/include/linux/blk-cgroup.h
@@ -491,27 +491,25 @@ static inline void blkg_get(struct blkcg_gq *blkg)
491} 491}
492 492
493/** 493/**
494 * blkg_try_get - try and get a blkg reference 494 * blkg_tryget - try and get a blkg reference
495 * @blkg: blkg to get 495 * @blkg: blkg to get
496 * 496 *
497 * This is for use when doing an RCU lookup of the blkg. We may be in the midst 497 * This is for use when doing an RCU lookup of the blkg. We may be in the midst
498 * of freeing this blkg, so we can only use it if the refcnt is not zero. 498 * of freeing this blkg, so we can only use it if the refcnt is not zero.
499 */ 499 */
500static inline struct blkcg_gq *blkg_try_get(struct blkcg_gq *blkg) 500static inline bool blkg_tryget(struct blkcg_gq *blkg)
501{ 501{
502 if (percpu_ref_tryget(&blkg->refcnt)) 502 return percpu_ref_tryget(&blkg->refcnt);
503 return blkg;
504 return NULL;
505} 503}
506 504
507/** 505/**
508 * blkg_try_get_closest - try and get a blkg ref on the closet blkg 506 * blkg_tryget_closest - try and get a blkg ref on the closet blkg
509 * @blkg: blkg to get 507 * @blkg: blkg to get
510 * 508 *
511 * This walks up the blkg tree to find the closest non-dying blkg and returns 509 * This walks up the blkg tree to find the closest non-dying blkg and returns
512 * the blkg that it did association with as it may not be the passed in blkg. 510 * the blkg that it did association with as it may not be the passed in blkg.
513 */ 511 */
514static inline struct blkcg_gq *blkg_try_get_closest(struct blkcg_gq *blkg) 512static inline struct blkcg_gq *blkg_tryget_closest(struct blkcg_gq *blkg)
515{ 513{
516 while (!percpu_ref_tryget(&blkg->refcnt)) 514 while (!percpu_ref_tryget(&blkg->refcnt))
517 blkg = blkg->parent; 515 blkg = blkg->parent;