Received: by 2002:ac0:a5b6:0:0:0:0:0 with SMTP id m51-v6csp3814130imm; Tue, 29 May 2018 14:20:18 -0700 (PDT) X-Google-Smtp-Source: ADUXVKKMurNGKGqH8GRICXXpprJhGt/OSUcxv3+qShWn0HubHokN7Kqc0Kiemi5kRI3i/S/HsCWT X-Received: by 2002:a65:608d:: with SMTP id t13-v6mr62570pgu.266.1527628818475; Tue, 29 May 2018 14:20:18 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1527628818; cv=none; d=google.com; s=arc-20160816; b=VyyMjXgR82xm6o9IMqY5mpK4cxH/QudCeIi3V2kSStXGA3MJTF/vUNcCy5IHGFLlAl QSr42M6s27aKtbZBrynqou5CamwHZ2CouaWY3ya3qqA08blr6sWnNrlJrWYwibbd0ysm r3fvEDppzLvzfXrbnsSpYnzl555KMh2P7MJr04aAYR+2XA5Y+LkyaxD79MfQbyauxTQu zYHyvO6pYcwEj1MMgpMAD8dHqP36CeXIyggRi2uO0fitVnyqYUHmp3U51y/zJeUAOLSp nWiYrI7Tw/+Z9VEMGLHgudU8+1xOnZ//oxJhvq00fhKzjScpoicGJSKjBwWiaeFcxyd+ 8inQ== 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:dkim-signature:arc-authentication-results; bh=dSeH7X4eYgqrVPYFT9jUU61dwo0oWIAyu4ovKK1OTIw=; b=lN4Bf3TrU9tL9O6luA9apE9wlputXzVrdigj5EmeYku16zkp57uF7vlePFVwJpqgoB /95R6TUsmQpHiMhJbawpnO4k0U1FIJVxEV+0mo30HH7t/g+k2Tx9T4Xrj7wpYv4dxXG+ OdZ3aX6pgaXQoS9FVpx1ih2AzETcPIV8nVPwXui/5pGMykXrZIi7UPCBYu26HsSKgxxr 1beckfY8f0oNqXFJymvtq9hIAWlGULn5adumf3jTK4BqZW3+madc3grht+Tsqew7rJLJ kf36p0JMm49swPthx5dSlCszAQ3jK4QtRxHaF2QHb6xWU4R6kIxD7/R3LnVJrWJ429Lq j5hA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@toxicpanda-com.20150623.gappssmtp.com header.s=20150623 header.b=gzC1pPvS; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id e24-v6si32461395pff.30.2018.05.29.14.20.04; Tue, 29 May 2018 14:20:18 -0700 (PDT) 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; dkim=pass header.i=@toxicpanda-com.20150623.gappssmtp.com header.s=20150623 header.b=gzC1pPvS; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S967502AbeE2VSQ (ORCPT + 99 others); Tue, 29 May 2018 17:18:16 -0400 Received: from mail-qk0-f195.google.com ([209.85.220.195]:42456 "EHLO mail-qk0-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S967315AbeE2VRo (ORCPT ); Tue, 29 May 2018 17:17:44 -0400 Received: by mail-qk0-f195.google.com with SMTP id j80-v6so10994576qke.9 for ; Tue, 29 May 2018 14:17:44 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=toxicpanda-com.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=dSeH7X4eYgqrVPYFT9jUU61dwo0oWIAyu4ovKK1OTIw=; b=gzC1pPvSP0hEhGVLf2VcFIaNOFdI61sTvtzRhrEpvPxCjXgjORFm+h0PuvmZTThrlS ZCYC7SZ87b2w0w0WRrtP7vgT144BumbIv04sBR/hV/JWUAjlFb6E3gDRNUXr9Vyhkgo+ +RBQ458myhWw3uCkodrzKbCUSIhCAeQCoubZoMoTAgxfGZPNRSjC+09hcOhJNJLk+zfg Z4nl+2Z5InY/MQ8R2dbIUNZyvwIfvAeZdXOQ8ExHXKRuC5cuPZuLOqr0T5amWbnzhaFD RdOvGKOqzsr/9h0IjwvksjQyX67E/rpks07VAP6Uh0K25YjTNxXD48WXnof+fmAkEOEw S+qA== 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=dSeH7X4eYgqrVPYFT9jUU61dwo0oWIAyu4ovKK1OTIw=; b=FDEkAxoX55opAfTp5ijhA2o8Bsuget3LMQSggszeZ9tSSP6od8mxiyyrOrFp8BZZzn eVwyiDSO4B1rCzKFlIpTPcvdUfSgPQpZC5h/eyhpGYAQddtGLoUAXPQHxj1jGOdu9Dm0 of0gyN2Eh2ay2RorrlSshsziu1fJYrla+PZS0NHd/A0UVwGgIM9HmToZ6a1cIKgKRRlb twfT6JEmSGF/mYFA7UruQFPwFrk87np01g+oAiHUEXuWwZS1yEgRZDdjpVtpC9D50UJM eC4MUHwVNgG9x4orhp0GqEnPrORF2NxML0cvo/cnbtz+MUWfQKeINzB5MSUc15NCLpgv T5Ww== X-Gm-Message-State: APt69E1MMbIJWUFrnlE7voX7uNOHeUBGcIlPDh588fYhLf0Mzs01PuSO dFQlCtb+Zmb0DIpZKD6yPOxjmQ== X-Received: by 2002:a37:80c4:: with SMTP id b187-v6mr67643qkd.47.1527628663830; Tue, 29 May 2018 14:17:43 -0700 (PDT) Received: from localhost (cpe-2606-A000-4381-1201-225-22FF-FEB3-E51A.dyn6.twc.com. [2606:a000:4381:1201:225:22ff:feb3:e51a]) by smtp.gmail.com with ESMTPSA id o5-v6sm8372729qtm.60.2018.05.29.14.17.42 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Tue, 29 May 2018 14:17:43 -0700 (PDT) From: Josef Bacik To: axboe@kernel.dk, kernel-team@fb.com, linux-block@vger.kernel.org, akpm@linux-foundation.org, linux-mm@kvack.org, hannes@cmpxchg.org, linux-kernel@vger.kernel.org, tj@kernel.org, linux-fsdevel@vger.kernel.org Cc: Josef Bacik Subject: [PATCH 11/13] rq-qos: introduce dio_bio callback Date: Tue, 29 May 2018 17:17:22 -0400 Message-Id: <20180529211724.4531-12-josef@toxicpanda.com> X-Mailer: git-send-email 2.14.3 In-Reply-To: <20180529211724.4531-1-josef@toxicpanda.com> References: <20180529211724.4531-1-josef@toxicpanda.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Josef Bacik wbt cares only about request completion time, but controllers may need information that is on the bio itself, so add a done_bio callback for rq-qos so things like blk-iolatency can use it to have the bio when it completes. Signed-off-by: Josef Bacik --- block/bio.c | 4 ++++ block/blk-rq-qos.c | 10 ++++++++++ block/blk-rq-qos.h | 2 ++ 3 files changed, 16 insertions(+) diff --git a/block/bio.c b/block/bio.c index 57c4b1986e76..5b2afd23be7f 100644 --- a/block/bio.c +++ b/block/bio.c @@ -32,6 +32,7 @@ #include #include "blk.h" +#include "blk-rq-qos.h" /* * Test patch to inline a certain number of bi_io_vec's inside the bio @@ -1781,6 +1782,9 @@ void bio_endio(struct bio *bio) if (WARN_ONCE(bio->bi_next, "driver left bi_next not NULL")) bio->bi_next = NULL; + if (bio->bi_disk) + rq_qos_done_bio(bio->bi_disk->queue, bio); + /* * Need to have a real endio function for chained bios, otherwise * various corner cases will break (like stacking block devices that diff --git a/block/blk-rq-qos.c b/block/blk-rq-qos.c index b7b02e04f64f..5134b24482f6 100644 --- a/block/blk-rq-qos.c +++ b/block/blk-rq-qos.c @@ -88,6 +88,16 @@ void rq_qos_track(struct request_queue *q, struct request *rq, struct bio *bio) } } +void rq_qos_done_bio(struct request_queue *q, struct bio *bio) +{ + struct rq_qos *rqos; + + for(rqos = q->rq_qos; rqos; rqos = rqos->next) { + if (rqos->ops->done_bio) + rqos->ops->done_bio(rqos, bio); + } +} + /* * Return true, if we can't increase the depth further by scaling */ diff --git a/block/blk-rq-qos.h b/block/blk-rq-qos.h index 501253676dd8..3874e6ad09f0 100644 --- a/block/blk-rq-qos.h +++ b/block/blk-rq-qos.h @@ -30,6 +30,7 @@ struct rq_qos_ops { void (*issue)(struct rq_qos *, struct request *); void (*requeue)(struct rq_qos *, struct request *); void (*done)(struct rq_qos *, struct request *); + void (*done_bio)(struct rq_qos *, struct bio *); void (*cleanup)(struct rq_qos *, struct bio *); void (*exit)(struct rq_qos *); }; @@ -86,6 +87,7 @@ void rq_qos_cleanup(struct request_queue *, struct bio *); void rq_qos_done(struct request_queue *, struct request *); void rq_qos_issue(struct request_queue *, struct request *); void rq_qos_requeue(struct request_queue *, struct request *); +void rq_qos_done_bio(struct request_queue *q, struct bio *bio); void rq_qos_throttle(struct request_queue *, struct bio *, spinlock_t *); void rq_qos_track(struct request_queue *q, struct request *, struct bio *); void rq_qos_exit(struct request_queue *); -- 2.14.3