dm-devel.redhat.com archive mirror
 help / color / mirror / Atom feed
From: Christoph Hellwig <hch-jcswGhMUV9g@public.gmane.org>
To: Jens Axboe <axboe-tSWWG44O7X1aa/9Udqfwiw@public.gmane.org>,
	Tejun Heo <tj-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
Cc: Dennis Zhou <dennis-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>,
	Li Zefan <lizefan-hv44wF8Li93QT0dZR+AlfA@public.gmane.org>,
	Johannes Weiner <hannes-druUgvl0LCNAfugRpC6u6w@public.gmane.org>,
	dm-devel-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org,
	linux-block-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	cgroups-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	linux-mm-Bw31MaZKKs3YtjvyW6yDsg@public.gmane.org
Subject: [PATCH 02/14] block: remove bio_disassociate_blkg
Date: Sat, 27 Jun 2020 09:31:47 +0200	[thread overview]
Message-ID: <20200627073159.2447325-3-hch@lst.de> (raw)
In-Reply-To: <20200627073159.2447325-1-hch-jcswGhMUV9g@public.gmane.org>

bio_disassociate_blkg has two callers, of which one immediately assigns
a new value to >bi_blkg.  Just open code the function in the two callers.

Signed-off-by: Christoph Hellwig <hch-jcswGhMUV9g@public.gmane.org>
---
 block/bio.c         | 27 ++++++++-------------------
 include/linux/bio.h |  2 --
 2 files changed, 8 insertions(+), 21 deletions(-)

diff --git a/block/bio.c b/block/bio.c
index fb5533416fa670..8aef4460b32e0e 100644
--- a/block/bio.c
+++ b/block/bio.c
@@ -234,8 +234,12 @@ struct bio_vec *bvec_alloc(gfp_t gfp_mask, int nr, unsigned long *idx,
 
 void bio_uninit(struct bio *bio)
 {
-	bio_disassociate_blkg(bio);
-
+#ifdef CONFIG_BLK_CGROUP
+	if (bio->bi_blkg) {
+		blkg_put(bio->bi_blkg);
+		bio->bi_blkg = NULL;
+	}
+#endif
 	if (bio_integrity(bio))
 		bio_integrity_free(bio);
 
@@ -1625,21 +1629,6 @@ EXPORT_SYMBOL(bioset_init_from_src);
 
 #ifdef CONFIG_BLK_CGROUP
 
-/**
- * bio_disassociate_blkg - puts back the blkg reference if associated
- * @bio: target bio
- *
- * Helper to disassociate the blkg from @bio if a blkg is associated.
- */
-void bio_disassociate_blkg(struct bio *bio)
-{
-	if (bio->bi_blkg) {
-		blkg_put(bio->bi_blkg);
-		bio->bi_blkg = NULL;
-	}
-}
-EXPORT_SYMBOL_GPL(bio_disassociate_blkg);
-
 /**
  * __bio_associate_blkg - associate a bio with the a blkg
  * @bio: target bio
@@ -1656,8 +1645,8 @@ EXPORT_SYMBOL_GPL(bio_disassociate_blkg);
  */
 static void __bio_associate_blkg(struct bio *bio, struct blkcg_gq *blkg)
 {
-	bio_disassociate_blkg(bio);
-
+	if (bio->bi_blkg)
+		blkg_put(bio->bi_blkg);
 	bio->bi_blkg = blkg_tryget_closest(blkg);
 }
 
diff --git a/include/linux/bio.h b/include/linux/bio.h
index 0282f8aa85935c..4cd229e175c058 100644
--- a/include/linux/bio.h
+++ b/include/linux/bio.h
@@ -497,13 +497,11 @@ static inline void bio_associate_blkg_from_page(struct bio *bio,
 #endif
 
 #ifdef CONFIG_BLK_CGROUP
-void bio_disassociate_blkg(struct bio *bio);
 void bio_associate_blkg(struct bio *bio);
 void bio_associate_blkg_from_css(struct bio *bio,
 				 struct cgroup_subsys_state *css);
 void bio_clone_blkg_association(struct bio *dst, struct bio *src);
 #else	/* CONFIG_BLK_CGROUP */
-static inline void bio_disassociate_blkg(struct bio *bio) { }
 static inline void bio_associate_blkg(struct bio *bio) { }
 static inline void bio_associate_blkg_from_css(struct bio *bio,
 					       struct cgroup_subsys_state *css)
-- 
2.26.2

  parent reply	other threads:[~2020-06-27  7:31 UTC|newest]

Thread overview: 29+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-06-27  7:31 drive-by blk-cgroup cleanups Christoph Hellwig
2020-06-27  7:31 ` [PATCH 01/14] dm: use bio_uninit instead of bio_disassociate_blkg Christoph Hellwig
2020-06-29  9:31   ` Johannes Thumshirn
     [not found]   ` <20200627073159.2447325-2-hch-jcswGhMUV9g@public.gmane.org>
2020-07-08 14:02     ` Mike Snitzer
     [not found] ` <20200627073159.2447325-1-hch-jcswGhMUV9g@public.gmane.org>
2020-06-27  7:31   ` Christoph Hellwig [this message]
2020-06-29  9:33     ` [PATCH 02/14] block: remove bio_disassociate_blkg Johannes Thumshirn
2020-06-27  7:31   ` [PATCH 08/14] block: bypass blkg_tryget_closest for the root_blkg Christoph Hellwig
2020-06-27  7:31   ` [PATCH 12/14] blk-cgroup: move rcu locking from blkcg_bio_issue_check to blk_throtl_bio Christoph Hellwig
2020-06-27  7:31 ` [PATCH 03/14] block: really clone the block cgroup in bio_clone_blkg_association Christoph Hellwig
2020-06-29  9:37   ` Johannes Thumshirn
2020-06-27  7:31 ` [PATCH 04/14] block: merge __bio_associate_blkg into bio_associate_blkg_from_css Christoph Hellwig
2020-06-29  9:55   ` Johannes Thumshirn
2020-06-27  7:31 ` [PATCH 05/14] block: move bio_associate_blkg_from_page to mm/page_io.c Christoph Hellwig
2020-06-29  9:59   ` Johannes Thumshirn
2020-06-29 10:08   ` Johannes Thumshirn
2020-06-27  7:31 ` [PATCH 06/14] block: move the bio cgroup associatation helpers to blk-cgroup.c Christoph Hellwig
2020-06-29 11:51   ` Johannes Thumshirn
2020-06-27  7:31 ` [PATCH 07/14] block: merge blkg_lookup_create and __blkg_lookup_create Christoph Hellwig
2020-06-29 12:21   ` Johannes Thumshirn
2020-06-27  7:31 ` [PATCH 09/14] block: move the initial blkg lookup into blkg_tryget_closest Christoph Hellwig
2020-06-27  7:31 ` [PATCH 10/14] blk-cgroup: remove the !bio->bi_blkg check in blkcg_bio_issue_check Christoph Hellwig
2020-06-27  7:31 ` [PATCH 11/14] cgroup: unexport cgroup_rstat_updated Christoph Hellwig
2020-06-27  7:31 ` [PATCH 13/14] blk-cgroup: remove blkcg_bio_issue_check Christoph Hellwig
2020-06-27  7:31 ` [PATCH 14/14] blk-cgroup: remove a dead check in blk_throtl_bio Christoph Hellwig
2020-06-29  8:05 ` drive-by blk-cgroup cleanups Johannes Thumshirn
2020-06-29  8:08   ` Christoph Hellwig
2020-06-29  8:12     ` Johannes Thumshirn
2020-06-29 13:56 ` Tejun Heo
2020-06-29 15:09 ` Jens Axboe

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200627073159.2447325-3-hch@lst.de \
    --to=hch-jcswghmuv9g@public.gmane.org \
    --cc=axboe-tSWWG44O7X1aa/9Udqfwiw@public.gmane.org \
    --cc=cgroups-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=dennis-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org \
    --cc=dm-devel-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org \
    --cc=hannes-druUgvl0LCNAfugRpC6u6w@public.gmane.org \
    --cc=linux-block-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=linux-mm-Bw31MaZKKs3YtjvyW6yDsg@public.gmane.org \
    --cc=lizefan-hv44wF8Li93QT0dZR+AlfA@public.gmane.org \
    --cc=tj-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).