Received: by 2002:ac0:a581:0:0:0:0:0 with SMTP id m1-v6csp4009459imm; Mon, 25 Jun 2018 08:15:12 -0700 (PDT) X-Google-Smtp-Source: ADUXVKKZFfUuAQknLKviswEH47M6fzdiD4foNPYCRycDqU81LRu3A7C84RhogZLLQoAk4qDHwERE X-Received: by 2002:a63:42c7:: with SMTP id p190-v6mr11340735pga.142.1529939712721; Mon, 25 Jun 2018 08:15:12 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1529939712; cv=none; d=google.com; s=arc-20160816; b=esPU5tFrA8ryqCaTVjJo4jdfZNzydabK4XDIp5EC2mdhih3HDAktph5+qh2U9v6lfm 4U6bA3iTYVEP1H080Jz0YA6/GwZbCUrc+7zQJHcIxX1WV8emHrXVLRGGPVDPLR1SFADn 0dmnHt3t6r9tX0Wwsxtz321e0n+rOJKGYzNc7Kk6yKLaeDVPaq2XAugMVEn6ZgGSsUIj H1aMq02rSJ1p4e8+jSJTIx9Ngm830ZMfnqO8dY0sf/X48GoflU36dO9cTB1+oZezEXc6 BsZW2NcoNnoiO/maVm8G/43xihM+xeOfVk12Knxo+w9oYLQQzjGP2e62Dd0PgHTa9PlK fVuw== 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=oqEXHFPy/UD/4NNoUiVbo/dXSAkuFuYpl2PiuLJXLwU=; b=jBnkiPjPtgqFtJfnD6E1oefH3d6uS4+pneg18k2Fo83+pTw9Wq1FvdMvGOi28ejvXh qDTQ8yH+sxFJ6cqmFPWVVBVtb5QDzk3F4Wt7mBUv9v5C3YXjXmJ4bvoSmD6olRS2jMOB YfP6upeb8DT/kM+YiydNoWDIDJkfUo9foMvpstOvFJ7T4fiH4kzPdUuaGcjnPepuywX9 pIlOK5FFuG7zujOH+1UCRY2nnwWWC7CMhqCWm1vCY0AD2viwjecSrbRHcX1A/eco0osU WdVOYHONQNVUDbzCWajzhU6SRxpXfxxERuq+csoKMgNq3NLsxw5wInz4b6cjm4bBaNvl 7jwQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@toxicpanda-com.20150623.gappssmtp.com header.s=20150623 header.b=eEJJkiaT; 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 z2-v6si11876136pgc.435.2018.06.25.08.14.57; Mon, 25 Jun 2018 08:15:12 -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=eEJJkiaT; 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 S934891AbeFYPNK (ORCPT + 99 others); Mon, 25 Jun 2018 11:13:10 -0400 Received: from mail-qk0-f193.google.com ([209.85.220.193]:33001 "EHLO mail-qk0-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S934842AbeFYPND (ORCPT ); Mon, 25 Jun 2018 11:13:03 -0400 Received: by mail-qk0-f193.google.com with SMTP id c131-v6so7681902qkb.0 for ; Mon, 25 Jun 2018 08:13:02 -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=eEJJkiaT832SNliN6La5QUQz7qH4SrfqAyYpXSRTwDuuVLenQu/LbO6S1OyFjVDMvW KL6qvs3Hezqdej0MHXNt8KSZaMupdIQ2VotI4eey4JgrrexnHR247a8aywl17PQuQBsJ 6b6px1TIvvr1+lbQnGWUORF8YYtQMQ6C+VyyXytnfHFUIMNfcGzUiU5cBmD+zYcqvmbs yNsfu/BNlQEOaHl4jE6VOWpnJ9RO7MEwzVw1uLiIN93ffbqR1+W13RcsHFSqQtNzcVTE yio/ONXRegyWr3xBZpHHd1JBPsro0akazFgqrv/4k4Mppo+HukeTwVGvhP33WVswIwHt KnlQ== 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=rJ7Ic7u4EVT9qIlDtbBWBSgd9zVOn9stb3/Zn9GHHFL2VVRLzkI/bBIUoyAXWi4EzG BzbfcMCzQhmwoQ61Ca6OmoRzW/MW7zNngnUcE7FKY8INOL7U2QGQE6HondOSFa0KXDw6 TYQZNNocWJE6ND2vast47WWNVn+2UlOiENdxAUILtOY0i8Ts7++52Ht8R136PO7L+if+ K3pebr5bSLzYokPxJZP4USvuVONJ3dVQjQ6h7Lt9hx1ODV22rDRc1Ys0B7OZPFrOf0GE cngD576IcoCoYVWQC9y5JDQVZTqFKhGz+/wRiLjqJamyR/vtKwZYCjj5E4F3/HzPamoD +cIA== X-Gm-Message-State: APt69E3xNDTBHJP3XUb1KtosNnxKBksGjUvLvZGo41hT09EtKPAsYtC0 szNnRTqQJ/5lkWYKLGmG+rUWCA== X-Received: by 2002:a37:670c:: with SMTP id b12-v6mr10670332qkc.108.1529939582267; Mon, 25 Jun 2018 08:13:02 -0700 (PDT) Received: from localhost ([107.15.81.208]) by smtp.gmail.com with ESMTPSA id 27-v6sm8085887qtz.74.2018.06.25.08.13.01 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Mon, 25 Jun 2018 08:13:01 -0700 (PDT) From: Josef Bacik To: axboe@kernel.dk, linux-block@vger.kernel.org, kernel-team@fb.com, 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/15] rq-qos: introduce dio_bio callback Date: Mon, 25 Jun 2018 11:12:39 -0400 Message-Id: <20180625151243.2132-12-josef@toxicpanda.com> X-Mailer: git-send-email 2.14.3 In-Reply-To: <20180625151243.2132-1-josef@toxicpanda.com> References: <20180625151243.2132-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 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 *); -- 2.14.3