Received: by 2002:a17:90b:8d0:0:0:0:0 with SMTP id ds16csp4887398pjb; Mon, 27 Jul 2020 07:37:52 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzlxVc7dOzmn1RNqocVxjyqD88KBsQdYZhYWfXN2KWofugkKsLRk0n1ZrsA3zKbNp//3lO6 X-Received: by 2002:a17:906:5c52:: with SMTP id c18mr11435413ejr.168.1595860672592; Mon, 27 Jul 2020 07:37:52 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1595860672; cv=none; d=google.com; s=arc-20160816; b=ff87jRD9486cA70VAUuTHxqGTJtFVzrymDoK/YTte19qv07biTbKNLCuZEa4mObYNg Po3isuaKzncQhKUXnABsJNAUmyvUM/zJSV1Mj1MpzDwxSgcNvbDYGq8eA9R2MyLK/CRQ KYBqGZdZ6aum74VLwvTOqyhgXtaXTdyP/dMEyrDaKQhrr50jE6ic/Ox0dmRPjCkymKi9 P6r2bN/zfOxrXkNNr2UoFYA4Pbu8+VDP9JmPrWyRWuikPYkrlhC8w/3B20CkDjEc+OE9 bBrc+c4AIjN39PdrLuS/4CoZfU51fWj3i+46fP4kb6n20rqlKwVMpptU6WRzX1okvJqc P5CQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=Yhl+AsI3ylJEcptjEBLlwlIxsXb+auEHumkE+kWuwO8=; b=zdEANtJeMbRqgXpw0/f2oMrQ0huadYACMruv1pjlCD5BAp/tC1aOzmwVHGZPlf6f/F NrJ/AxGp0ppppFeruhwJxUztXeBK+nUORhaOJXPjZgxNDa9yNFFgKsesC9bELVHZ+4UF SVJ6ZHMUYTnuGZj/ROKwNhDytdTj9IHzKkJKImXjbcIqzLW2YM3pYn6tKD6C8YVwVLKz gohlh/2nDIGw62nMW7viICl5QDDjk4xEUeTkAlIM1/T8SS3oxAHb7/XKDbrx/qONwOhl Tsg5wtlPGkEMiLafia8H5qI4VbatR5EOrBqSNb2b1WwVQXuKLvrnZa4DRYzzApWHGM6m TYTg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=GdJQTsYi; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id a8si5851113ejx.135.2020.07.27.07.37.30; Mon, 27 Jul 2020 07:37:52 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=GdJQTsYi; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730405AbgG0ONr (ORCPT + 99 others); Mon, 27 Jul 2020 10:13:47 -0400 Received: from mail.kernel.org ([198.145.29.99]:38814 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730400AbgG0ONl (ORCPT ); Mon, 27 Jul 2020 10:13:41 -0400 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 11BE62073E; Mon, 27 Jul 2020 14:13:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1595859220; bh=eAee0Yhy+tSpMqQhl+nq7bZftpMdrjnGQy79r86fn+g=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=GdJQTsYiXWRKvs25wTfwuh2tSTvq3rr5Kq9YaTu7XmnCPu27g4XK9691kHdNGJZwN SVbejhBXOLqj7B8RzY4DUMyNyKHPYOUmJ50uZ/Kd2vC3EGDdSf5HY4QF3b/Ed+dvyz 1c1KtKkZ4pBKCTnaj5AcptWN1bkcCjtl6zUyMSLQ= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Gabriel Krisman Bertazi , Mike Snitzer , Sasha Levin Subject: [PATCH 5.4 024/138] dm mpath: pass IO start time to path selector Date: Mon, 27 Jul 2020 16:03:39 +0200 Message-Id: <20200727134926.568755096@linuxfoundation.org> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20200727134925.228313570@linuxfoundation.org> References: <20200727134925.228313570@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Gabriel Krisman Bertazi [ Upstream commit 087615bf3acdafd0ba7c7c9ed5286e7b7c80fe1b ] The HST path selector needs this information to perform path prediction. For request-based mpath, struct request's io_start_time_ns is used, while for bio-based, use the start_time stored in dm_io. Signed-off-by: Gabriel Krisman Bertazi Signed-off-by: Mike Snitzer Signed-off-by: Sasha Levin --- drivers/md/dm-mpath.c | 9 ++++++--- drivers/md/dm-path-selector.h | 2 +- drivers/md/dm-queue-length.c | 2 +- drivers/md/dm-service-time.c | 2 +- drivers/md/dm.c | 9 +++++++++ include/linux/device-mapper.h | 2 ++ 6 files changed, 20 insertions(+), 6 deletions(-) diff --git a/drivers/md/dm-mpath.c b/drivers/md/dm-mpath.c index f2de4c73cc8fa..d7ebed50895f0 100644 --- a/drivers/md/dm-mpath.c +++ b/drivers/md/dm-mpath.c @@ -558,7 +558,8 @@ static void multipath_release_clone(struct request *clone, if (pgpath && pgpath->pg->ps.type->end_io) pgpath->pg->ps.type->end_io(&pgpath->pg->ps, &pgpath->path, - mpio->nr_bytes); + mpio->nr_bytes, + clone->io_start_time_ns); } blk_put_request(clone); @@ -1560,7 +1561,8 @@ static int multipath_end_io(struct dm_target *ti, struct request *clone, struct path_selector *ps = &pgpath->pg->ps; if (ps->type->end_io) - ps->type->end_io(ps, &pgpath->path, mpio->nr_bytes); + ps->type->end_io(ps, &pgpath->path, mpio->nr_bytes, + clone->io_start_time_ns); } return r; @@ -1604,7 +1606,8 @@ static int multipath_end_io_bio(struct dm_target *ti, struct bio *clone, struct path_selector *ps = &pgpath->pg->ps; if (ps->type->end_io) - ps->type->end_io(ps, &pgpath->path, mpio->nr_bytes); + ps->type->end_io(ps, &pgpath->path, mpio->nr_bytes, + dm_start_time_ns_from_clone(clone)); } return r; diff --git a/drivers/md/dm-path-selector.h b/drivers/md/dm-path-selector.h index b6eb5365b1a46..c47bc0e20275b 100644 --- a/drivers/md/dm-path-selector.h +++ b/drivers/md/dm-path-selector.h @@ -74,7 +74,7 @@ struct path_selector_type { int (*start_io) (struct path_selector *ps, struct dm_path *path, size_t nr_bytes); int (*end_io) (struct path_selector *ps, struct dm_path *path, - size_t nr_bytes); + size_t nr_bytes, u64 start_time); }; /* Register a path selector */ diff --git a/drivers/md/dm-queue-length.c b/drivers/md/dm-queue-length.c index 969c4f1a36336..5fd018d184187 100644 --- a/drivers/md/dm-queue-length.c +++ b/drivers/md/dm-queue-length.c @@ -227,7 +227,7 @@ static int ql_start_io(struct path_selector *ps, struct dm_path *path, } static int ql_end_io(struct path_selector *ps, struct dm_path *path, - size_t nr_bytes) + size_t nr_bytes, u64 start_time) { struct path_info *pi = path->pscontext; diff --git a/drivers/md/dm-service-time.c b/drivers/md/dm-service-time.c index f006a9005593b..9cfda665e9ebd 100644 --- a/drivers/md/dm-service-time.c +++ b/drivers/md/dm-service-time.c @@ -309,7 +309,7 @@ static int st_start_io(struct path_selector *ps, struct dm_path *path, } static int st_end_io(struct path_selector *ps, struct dm_path *path, - size_t nr_bytes) + size_t nr_bytes, u64 start_time) { struct path_info *pi = path->pscontext; diff --git a/drivers/md/dm.c b/drivers/md/dm.c index 3cf5b354568e5..1e7ad2ad48295 100644 --- a/drivers/md/dm.c +++ b/drivers/md/dm.c @@ -649,6 +649,15 @@ static bool md_in_flight(struct mapped_device *md) return md_in_flight_bios(md); } +u64 dm_start_time_ns_from_clone(struct bio *bio) +{ + struct dm_target_io *tio = container_of(bio, struct dm_target_io, clone); + struct dm_io *io = tio->io; + + return jiffies_to_nsecs(io->start_time); +} +EXPORT_SYMBOL_GPL(dm_start_time_ns_from_clone); + static void start_io_acct(struct dm_io *io) { struct mapped_device *md = io->md; diff --git a/include/linux/device-mapper.h b/include/linux/device-mapper.h index 399ad86323568..ec19222f67666 100644 --- a/include/linux/device-mapper.h +++ b/include/linux/device-mapper.h @@ -328,6 +328,8 @@ void *dm_per_bio_data(struct bio *bio, size_t data_size); struct bio *dm_bio_from_per_bio_data(void *data, size_t data_size); unsigned dm_bio_get_target_bio_nr(const struct bio *bio); +u64 dm_start_time_ns_from_clone(struct bio *bio); + int dm_register_target(struct target_type *t); void dm_unregister_target(struct target_type *t); -- 2.25.1