Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp8584413imu; Tue, 4 Dec 2018 10:37:43 -0800 (PST) X-Google-Smtp-Source: AFSGD/WU8he1jMo20sToZR/5SjvROsPzfhqLzc4apX82TgYvGeyB3Xx3QC20T0L00Cbo1mW8iNPN X-Received: by 2002:a17:902:4401:: with SMTP id k1mr21184133pld.307.1543948663672; Tue, 04 Dec 2018 10:37:43 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1543948663; cv=none; d=google.com; s=arc-20160816; b=up+6JNs249d05xynNmbqw5Vw6HbvXlJRKd5dNCvgVO+Ta1DQtcZQNyDMb1USqStQim CxdrJvJMpX3LcFe/e/eiCiPNOqb5bJGrHLKfhqdRLYCZGia0xLlW0ZLlhI/4oQ1IGTUa XJKsRYH2fdGjF1x5fD0/ShHkrZnuzrNRzhAFaUC0Fzbo7A1OLsYH+B1olNNd3eQjuQfd Czddwmq+BmYrmwKXcESkJ+GHz17dWPjIgvekUy7ZdTcVNPrUAafR9MyiIPWQQEm/OYRM BXu9j0YOhabYglhrif/mBybwmx2YFkK4GjiAw9cmdIv3APV13D3X5tggFK4Fv99wpFjI 09tg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from; bh=lqj6Cml3IT2RuUIZeS3djtKJCP/6zrHnyGdgyu4JqDw=; b=tsHVUkz86YNQ5YWfpaxVXRDczcRryUndTxBylt4GslBbPh/6O2zsDz5/jf6Q2HGCtH zTKN0nUfvkYtpFfWbikM81XCVvo92JqVn/LQCKJJ5hCOLMXdcRcPwGzwm3PIuGl90RO+ MEB8S23PP+Mdul3mv2YPJnpc/rMrba43Wxys95mtyCYcSqYslpUegKXdfHBakml0+tli ocMWnGk5KjT2AR0r8Au1g5/x7FXhVWI4PcM2+nRqPcGpFdmFrQvf8wiqZxtRVzU2o3ty gRBMNoDQJE5UjroGzwX4XL+3YVXAhbxrcnuNVl+IyG4fWOV5HmlNl8ARCRS7M1chmnyI he8Q== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id q18si16447679pls.30.2018.12.04.10.37.22; Tue, 04 Dec 2018 10:37:43 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726880AbeLDSga (ORCPT + 99 others); Tue, 4 Dec 2018 13:36:30 -0500 Received: from mail-yb1-f193.google.com ([209.85.219.193]:45976 "EHLO mail-yb1-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726679AbeLDSgX (ORCPT ); Tue, 4 Dec 2018 13:36:23 -0500 Received: by mail-yb1-f193.google.com with SMTP id f6-v6so7269870ybg.12; Tue, 04 Dec 2018 10:36:22 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=lqj6Cml3IT2RuUIZeS3djtKJCP/6zrHnyGdgyu4JqDw=; b=kZ1SSRnz2NaungdGjmO8GG7R9KSu7IsiLiPRS75hUvvdtnwsOTXRP5fgW6IA+AO/gg 33m+KB1wjCxGgbxffCDnoKYJq/YQF24zBScBnp3z1B5JbR7KBH5dVCfOXNGPNtgzL2im 2lrhCubmzWTxEx/XP3hQUCuyjtz1uE8PU4snh887N24hlJCo8z7Qn1Bi19nrQCADiMbm RbVOO+qJdAXg0IIQS8/qCQSSZImuTyNWx3Qs1XYzV+aNlyYTZ9KYGYNkrjiCkzqT95et EPZiF3j+d1EAmbJFTkOjtWFGsv+7B6W2N45citcFS/4pyLrUS+sxNichCpKqMw9W2mSL fc1g== X-Gm-Message-State: AA+aEWZIssMDAvqzWLfZuA0PJMJk8Z5RR7QD4lJhnTZAshvK9cLPpq5D 5hLRWFAY3gNA2R76gAIxUx9iXhZYiqE= X-Received: by 2002:a25:a462:: with SMTP id f89-v6mr19907126ybi.490.1543948582333; Tue, 04 Dec 2018 10:36:22 -0800 (PST) Received: from dennisz-mbp.thefacebook.com ([199.201.65.135]) by smtp.gmail.com with ESMTPSA id x82sm4274798ywb.34.2018.12.04.10.36.21 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 04 Dec 2018 10:36:21 -0800 (PST) From: Dennis Zhou To: Jens Axboe , Tejun Heo , Johannes Weiner , Josef Bacik Cc: kernel-team@fb.com, linux-block@vger.kernel.org, cgroups@vger.kernel.org, linux-kernel@vger.kernel.org, Dennis Zhou Subject: [PATCH 14/14] blkcg: rename blkg_try_get() to blkg_tryget() Date: Tue, 4 Dec 2018 13:36:00 -0500 Message-Id: <20181204183600.99746-15-dennis@kernel.org> X-Mailer: git-send-email 2.13.5 In-Reply-To: <20181204183600.99746-1-dennis@kernel.org> References: <20181204183600.99746-1-dennis@kernel.org> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org blkg reference counting now uses percpu_ref rather than atomic_t. Let's make this consistent with css_tryget. This renames blkg_try_get to blkg_tryget and now returns a bool rather than the blkg or %NULL. Signed-off-by: Dennis Zhou Reviewed-by: Josef Bacik Acked-by: Tejun Heo --- block/bio.c | 2 +- block/blk-cgroup.c | 3 +-- block/blk-iolatency.c | 2 +- include/linux/blk-cgroup.h | 12 +++++------- 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) { bio_disassociate_blkg(bio); - bio->bi_blkg = blkg_try_get_closest(blkg); + bio->bi_blkg = blkg_tryget_closest(blkg); } /** 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) blkg = blkg_lookup(blkcg, q); if (!blkg) goto out; - blkg = blkg_try_get(blkg); - if (!blkg) + if (!blkg_tryget(blkg)) goto out; rcu_read_unlock(); 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) * We could be exiting, don't access the pd unless we have a * ref on the blkg. */ - if (!blkg_try_get(blkg)) + if (!blkg_tryget(blkg)) continue; iolat = blkg_to_lat(blkg); diff --git a/include/linux/blk-cgroup.h b/include/linux/blk-cgroup.h index 05909cf31ed1..64ac89130ae8 100644 --- a/include/linux/blk-cgroup.h +++ b/include/linux/blk-cgroup.h @@ -490,27 +490,25 @@ static inline void blkg_get(struct blkcg_gq *blkg) } /** - * blkg_try_get - try and get a blkg reference + * blkg_tryget - try and get a blkg reference * @blkg: blkg to get * * This is for use when doing an RCU lookup of the blkg. We may be in the midst * of freeing this blkg, so we can only use it if the refcnt is not zero. */ -static inline struct blkcg_gq *blkg_try_get(struct blkcg_gq *blkg) +static inline bool blkg_tryget(struct blkcg_gq *blkg) { - if (percpu_ref_tryget(&blkg->refcnt)) - return blkg; - return NULL; + return percpu_ref_tryget(&blkg->refcnt); } /** - * blkg_try_get_closest - try and get a blkg ref on the closet blkg + * blkg_tryget_closest - try and get a blkg ref on the closet blkg * @blkg: blkg to get * * This walks up the blkg tree to find the closest non-dying blkg and returns * the blkg that it did association with as it may not be the passed in blkg. */ -static inline struct blkcg_gq *blkg_try_get_closest(struct blkcg_gq *blkg) +static inline struct blkcg_gq *blkg_tryget_closest(struct blkcg_gq *blkg) { while (!percpu_ref_tryget(&blkg->refcnt)) blkg = blkg->parent; -- 2.17.1