diff mbox series

[-next,2/3] block, bfq: remove useless checking in bfq_put_queue()

Message ID 20220816015631.1323948-3-yukuai1@huaweicloud.com (mailing list archive)
State New, archived
Headers show
Series bfq simple cleanups | expand

Commit Message

Yu Kuai Aug. 16, 2022, 1:56 a.m. UTC
From: Yu Kuai <yukuai3@huawei.com>

'bfqq->bfqd' is ensured to set in bfq_init_queue(), and it will never
change afterwards.

Signed-off-by: Yu Kuai <yukuai3@huawei.com>
---
 block/bfq-iosched.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

Comments

Jan Kara Aug. 17, 2022, 11:54 a.m. UTC | #1
On Tue 16-08-22 09:56:30, Yu Kuai wrote:
> From: Yu Kuai <yukuai3@huawei.com>
> 
> 'bfqq->bfqd' is ensured to set in bfq_init_queue(), and it will never
> change afterwards.
> 
> Signed-off-by: Yu Kuai <yukuai3@huawei.com>

Looks good. Feel free to add:

Reviewed-by: Jan Kara <jack@suse.cz>

								Honza

> ---
>  block/bfq-iosched.c | 6 ++----
>  1 file changed, 2 insertions(+), 4 deletions(-)
> 
> diff --git a/block/bfq-iosched.c b/block/bfq-iosched.c
> index c740b41fe0a4..f39067389b2b 100644
> --- a/block/bfq-iosched.c
> +++ b/block/bfq-iosched.c
> @@ -5255,9 +5255,7 @@ void bfq_put_queue(struct bfq_queue *bfqq)
>  	struct hlist_node *n;
>  	struct bfq_group *bfqg = bfqq_group(bfqq);
>  
> -	if (bfqq->bfqd)
> -		bfq_log_bfqq(bfqq->bfqd, bfqq, "put_queue: %p %d",
> -			     bfqq, bfqq->ref);
> +	bfq_log_bfqq(bfqq->bfqd, bfqq, "put_queue: %p %d", bfqq, bfqq->ref);
>  
>  	bfqq->ref--;
>  	if (bfqq->ref)
> @@ -5321,7 +5319,7 @@ void bfq_put_queue(struct bfq_queue *bfqq)
>  		hlist_del_init(&item->woken_list_node);
>  	}
>  
> -	if (bfqq->bfqd && bfqq->bfqd->last_completed_rq_bfqq == bfqq)
> +	if (bfqq->bfqd->last_completed_rq_bfqq == bfqq)
>  		bfqq->bfqd->last_completed_rq_bfqq = NULL;
>  
>  	kmem_cache_free(bfq_pool, bfqq);
> -- 
> 2.31.1
>
diff mbox series

Patch

diff --git a/block/bfq-iosched.c b/block/bfq-iosched.c
index c740b41fe0a4..f39067389b2b 100644
--- a/block/bfq-iosched.c
+++ b/block/bfq-iosched.c
@@ -5255,9 +5255,7 @@  void bfq_put_queue(struct bfq_queue *bfqq)
 	struct hlist_node *n;
 	struct bfq_group *bfqg = bfqq_group(bfqq);
 
-	if (bfqq->bfqd)
-		bfq_log_bfqq(bfqq->bfqd, bfqq, "put_queue: %p %d",
-			     bfqq, bfqq->ref);
+	bfq_log_bfqq(bfqq->bfqd, bfqq, "put_queue: %p %d", bfqq, bfqq->ref);
 
 	bfqq->ref--;
 	if (bfqq->ref)
@@ -5321,7 +5319,7 @@  void bfq_put_queue(struct bfq_queue *bfqq)
 		hlist_del_init(&item->woken_list_node);
 	}
 
-	if (bfqq->bfqd && bfqq->bfqd->last_completed_rq_bfqq == bfqq)
+	if (bfqq->bfqd->last_completed_rq_bfqq == bfqq)
 		bfqq->bfqd->last_completed_rq_bfqq = NULL;
 
 	kmem_cache_free(bfq_pool, bfqq);