From patchwork Tue Jun 5 13:29:46 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Josef Bacik X-Patchwork-Id: 10448263 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id B959660467 for ; Tue, 5 Jun 2018 13:32:04 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id ABD2B29515 for ; Tue, 5 Jun 2018 13:32:04 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id A93A429524; Tue, 5 Jun 2018 13:32:04 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI autolearn=unavailable version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 6495229515 for ; Tue, 5 Jun 2018 13:31:44 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752132AbeFENbA (ORCPT ); Tue, 5 Jun 2018 09:31:00 -0400 Received: from mail-qt0-f194.google.com ([209.85.216.194]:45345 "EHLO mail-qt0-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752037AbeFENaI (ORCPT ); Tue, 5 Jun 2018 09:30:08 -0400 Received: by mail-qt0-f194.google.com with SMTP id i18-v6so2324378qtp.12 for ; Tue, 05 Jun 2018 06:30:07 -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=oqEXHFPy/UD/4NNoUiVbo/dXSAkuFuYpl2PiuLJXLwU=; b=i25HFeapzOFJsrSPO5Kb/tgFUJh+41NszzsrHf/NoTDAxWsSusl62GgYACMzvF830Z eX/X1V8qU726aa9TDLpvMiFl9TOgFH/mmJqjUSnOAXL7OkmHlkOEinSCS8ZRJm+Awx5r LXy2ISH06Ei0mh8MndzXuyLKV86C5tAPajCwis3FLqlcomrs8af4rlPTy9B9SU2zoQ3l p4c9yWTZRSgMAbgJz4icHdoxdgSWjLGKALdNfnM2fiGGjPFGRLpgUgVRrQygOH9JHt94 Om99yR4iJ7V+bMrY//tEkWxyRxiSx7s7E/QTrni1KWY0C4yrCb33ZUBMBNeza2XXou7r kVsQ== 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=oqEXHFPy/UD/4NNoUiVbo/dXSAkuFuYpl2PiuLJXLwU=; b=BJySVev5WSMRjAQfXY3jw7sdjSmxndFYY8YBP6yPSuQ8Nr6f/7CvnCMIHaaA0UU/a5 hAevHYYaUNAEYoGgrLZS7QDMhXlZU9zY0A8zS8z7GEIH1t0r0OmRC0pDLz+mrpwfA7Ko Ah/gN8UEvEBRz1fZIF6qpNVNcIcs5k+nq420hgeFK53F1876xD7cz/gwHMp5U82AX0ES cqcbliwZY3BnZzpz7//+f+bQQK2Ggvjoq4EmaUIijTWP8lIptkFbr4iTtQ2Y9fr5E+zP o0I8fHRGfcmqXrIdhnlhGuzdw0RQOuIclx7FAkFWwEYrxN70cSAIgS68xi7WpmO39D/g 9dyQ== X-Gm-Message-State: APt69E3pOxBPVKuxDxxx3KlvhHS0EOVGuZhisO2vyTcIFUFkXu4/0wri C2Mz958FLIdjBiBBU8J+GmtYWyDv X-Google-Smtp-Source: ADUXVKKXYoaMADSlHnHiYNpNFHxMXo/R4gnZNkoyD8n/ZgsOiewxLm80K5+mgl2YnfSI6blribChJw== X-Received: by 2002:a0c:e90f:: with SMTP id a15-v6mr23179772qvo.165.1528205407363; Tue, 05 Jun 2018 06:30:07 -0700 (PDT) Received: from localhost ([107.15.81.208]) by smtp.gmail.com with ESMTPSA id j28-v6sm17478110qtk.56.2018.06.05.06.30.06 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Tue, 05 Jun 2018 06:30:06 -0700 (PDT) From: Josef Bacik To: axboe@kernel.dk, kernel-team@fb.com, linux-block@vger.kernel.org, akpm@linux-foundation.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, 5 Jun 2018 09:29:46 -0400 Message-Id: <20180605132948.1664-12-josef@toxicpanda.com> X-Mailer: git-send-email 2.14.3 In-Reply-To: <20180605132948.1664-1-josef@toxicpanda.com> References: <20180605132948.1664-1-josef@toxicpanda.com> Sender: linux-fsdevel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-fsdevel@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP 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 c77fe1b4caa8..99809b73a400 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 *);