linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH][next] block: clean up dead code that is now redundant
@ 2018-11-14 22:17 Colin King
  2018-11-14 22:20 ` Jens Axboe
  0 siblings, 1 reply; 2+ messages in thread
From: Colin King @ 2018-11-14 22:17 UTC (permalink / raw)
  To: Jens Axboe, linux-block; +Cc: kernel-janitors, linux-kernel

From: Colin Ian King <colin.king@canonical.com>

The boolean next_sorted is set to false and is never changed, hence
the code that checks if it is true is dead code and can now be
removed.  This dead code occurred from a previous commit that cleaned
up the elevator and removed the setting of next_sorted to true.

Detected by CoverityScan, CID#1475401 ("'Constant' variable guards
dead code")

Fixes: a1ce35fa4985 ("block: remove dead elevator code")
Signed-off-by: Colin Ian King <colin.king@canonical.com>
---
 block/elevator.c | 7 -------
 1 file changed, 7 deletions(-)

diff --git a/block/elevator.c b/block/elevator.c
index 19351ffa56b1..796436270682 100644
--- a/block/elevator.c
+++ b/block/elevator.c
@@ -394,18 +394,11 @@ void elv_merge_requests(struct request_queue *q, struct request *rq,
 			     struct request *next)
 {
 	struct elevator_queue *e = q->elevator;
-	bool next_sorted = false;
 
 	if (e->type->ops.requests_merged)
 		e->type->ops.requests_merged(q, rq, next);
 
 	elv_rqhash_reposition(q, rq);
-
-	if (next_sorted) {
-		elv_rqhash_del(q, next);
-		q->nr_sorted--;
-	}
-
 	q->last_merge = rq;
 }
 
-- 
2.19.1


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH][next] block: clean up dead code that is now redundant
  2018-11-14 22:17 [PATCH][next] block: clean up dead code that is now redundant Colin King
@ 2018-11-14 22:20 ` Jens Axboe
  0 siblings, 0 replies; 2+ messages in thread
From: Jens Axboe @ 2018-11-14 22:20 UTC (permalink / raw)
  To: Colin King, linux-block; +Cc: kernel-janitors, linux-kernel

On 11/14/18 3:17 PM, Colin King wrote:
> From: Colin Ian King <colin.king@canonical.com>
> 
> The boolean next_sorted is set to false and is never changed, hence
> the code that checks if it is true is dead code and can now be
> removed.  This dead code occurred from a previous commit that cleaned
> up the elevator and removed the setting of next_sorted to true.

Ah nice, it's also the last "user" of q->nr_sorted, so that one can
go away as well.

-- 
Jens Axboe


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2018-11-14 22:33 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-11-14 22:17 [PATCH][next] block: clean up dead code that is now redundant Colin King
2018-11-14 22:20 ` Jens Axboe

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).