diff mbox series

[3/4] block: replace BIO_QUEUE_ENTERED with BIO_CGROUP_ACCT

Message ID 20200428112756.1892137-4-hch@lst.de (mailing list archive)
State New, archived
Headers show
Series [1/4] block: improve the submit_bio and generic_make_request documentation | expand

Commit Message

Christoph Hellwig April 28, 2020, 11:27 a.m. UTC
BIO_QUEUE_ENTERED is only used for cgroup accounting now, so rename
the flag and move setting it into the cgroup code.

Signed-off-by: Christoph Hellwig <hch@lst.de>
---
 block/blk-merge.c          | 10 ----------
 include/linux/blk-cgroup.h | 10 ++++++----
 include/linux/blk_types.h  |  2 +-
 3 files changed, 7 insertions(+), 15 deletions(-)

Comments

Johannes Thumshirn April 28, 2020, 2:23 p.m. UTC | #1
On 28/04/2020 13:28, Christoph Hellwig wrote:
> @@ -607,12 +607,14 @@ static inline bool blkcg_bio_issue_check(struct request_queue *q,
>   		u64_stats_update_begin(&bis->sync);
>   
>   		/*
> -		 * If the bio is flagged with BIO_QUEUE_ENTERED it means this
> -		 * is a split bio and we would have already accounted for the
> -		 * size of the bio.
> +		 * If the bio is flagged with BIO_CGROUP_ACCT it means this is a
> +		 * split bio and we would have already accounted for the size of
> +		 * the bio.
>   		 */
> -		if (!bio_flagged(bio, BIO_QUEUE_ENTERED))
> +		if (!bio_flagged(bio, BIO_CGROUP_ACCT)) {
> +			bio_set_flag(bio, BIO_CGROUP_ACCT);
>   			bis->cur.bytes[rwd] += bio->bi_iter.bi_size;
> +		}
>   		bis->cur.ios[rwd]++;
>   
>   		u64_stats_update_end(&bis->sync);


This is completely unrelated to the patch, but why is 
blkcg_bio_issue_check() static inline? It's only called in 
generic_make_request_checks().
Christoph Hellwig April 28, 2020, 2:24 p.m. UTC | #2
On Tue, Apr 28, 2020 at 02:23:52PM +0000, Johannes Thumshirn wrote:
> This is completely unrelated to the patch, but why is 
> blkcg_bio_issue_check() static inline? It's only called in 
> generic_make_request_checks().

The whole blk-cgroup group is just crazy :(  This isn't even the worst
part of it.
Johannes Thumshirn April 28, 2020, 2:26 p.m. UTC | #3
On 28/04/2020 16:25, Christoph Hellwig wrote:
> On Tue, Apr 28, 2020 at 02:23:52PM +0000, Johannes Thumshirn wrote:
>> This is completely unrelated to the patch, but why is
>> blkcg_bio_issue_check() static inline? It's only called in
>> generic_make_request_checks().
> 
> The whole blk-cgroup group is just crazy :(  This isn't even the worst
> part of it.
> 

Uff, sounds like the next cleanup desperately needed.
diff mbox series

Patch

diff --git a/block/blk-merge.c b/block/blk-merge.c
index c49eb3bdd0be8..a04e991b5ded9 100644
--- a/block/blk-merge.c
+++ b/block/blk-merge.c
@@ -336,16 +336,6 @@  void __blk_queue_split(struct request_queue *q, struct bio **bio,
 		/* there isn't chance to merge the splitted bio */
 		split->bi_opf |= REQ_NOMERGE;
 
-		/*
-		 * Since we're recursing into make_request here, ensure
-		 * that we mark this bio as already having entered the queue.
-		 * If not, and the queue is going away, we can get stuck
-		 * forever on waiting for the queue reference to drop. But
-		 * that will never happen, as we're already holding a
-		 * reference to it.
-		 */
-		bio_set_flag(*bio, BIO_QUEUE_ENTERED);
-
 		bio_chain(split, *bio);
 		trace_block_split(q, split, (*bio)->bi_iter.bi_sector);
 		generic_make_request(*bio);
diff --git a/include/linux/blk-cgroup.h b/include/linux/blk-cgroup.h
index 35f8ffe92b702..4deb8bb7b6afa 100644
--- a/include/linux/blk-cgroup.h
+++ b/include/linux/blk-cgroup.h
@@ -607,12 +607,14 @@  static inline bool blkcg_bio_issue_check(struct request_queue *q,
 		u64_stats_update_begin(&bis->sync);
 
 		/*
-		 * If the bio is flagged with BIO_QUEUE_ENTERED it means this
-		 * is a split bio and we would have already accounted for the
-		 * size of the bio.
+		 * If the bio is flagged with BIO_CGROUP_ACCT it means this is a
+		 * split bio and we would have already accounted for the size of
+		 * the bio.
 		 */
-		if (!bio_flagged(bio, BIO_QUEUE_ENTERED))
+		if (!bio_flagged(bio, BIO_CGROUP_ACCT)) {
+			bio_set_flag(bio, BIO_CGROUP_ACCT);
 			bis->cur.bytes[rwd] += bio->bi_iter.bi_size;
+		}
 		bis->cur.ios[rwd]++;
 
 		u64_stats_update_end(&bis->sync);
diff --git a/include/linux/blk_types.h b/include/linux/blk_types.h
index 31eb92876be7c..90895d594e647 100644
--- a/include/linux/blk_types.h
+++ b/include/linux/blk_types.h
@@ -220,7 +220,7 @@  enum {
 				 * throttling rules. Don't do it again. */
 	BIO_TRACE_COMPLETION,	/* bio_endio() should trace the final completion
 				 * of this bio. */
-	BIO_QUEUE_ENTERED,	/* can use blk_queue_enter_live() */
+	BIO_CGROUP_ACCT,	/* has been accounted to a cgroup */
 	BIO_TRACKED,		/* set if bio goes through the rq_qos path */
 	BIO_FLAG_LAST
 };