Received: by 2002:a25:1985:0:0:0:0:0 with SMTP id 127csp1714782ybz; Thu, 16 Apr 2020 14:15:51 -0700 (PDT) X-Google-Smtp-Source: APiQypIWt/cm5ex/ZH4hY4uPQUARudQAlUsgT4M7BA4KNH3uKxuvWaavKWrWOQ3KlOaBVkB+B0J9 X-Received: by 2002:a17:906:72c8:: with SMTP id m8mr8234ejl.318.1587071750849; Thu, 16 Apr 2020 14:15:50 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1587071750; cv=none; d=google.com; s=arc-20160816; b=0+8Smp+HZ05rRZtp/xij2l57/GXVW+kr8EwPqqPSHMCLn2RHeRYHtDsI02Y3iE6Cdc EVGXy5NCXR+eeC1jaOlA3BEYlFVlkUoESSWHA21jogonQvGBnKrZgBljkAox9laCx2DB PpCNoOgoR94ylG9KHUFJs0CA7toyuThm47zU3GVKkVIInxzZPpLAtPZo3Hz4fyjbKZxo +pSWSaDxXFa+JsBcGK87wVfVbTl6h+9YvRaIpoFgea4E8UndBNaWkPra0gqdbZsYdyjO ZNhRKAT99LAlug/F1H0+CrEx6CV1vzxr01WF8H8WfChZ4otopya2apls40UP3iOwdSQO ZEug== 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 :references:in-reply-to:message-id:date:subject:cc:to:from; bh=PZ6NyoZfDJ4uF51x9eFIGCVsl6LZPgxW5ItJCPoQvK4=; b=vzVKL+1CCKlSe9JWFa/EKOg8AWMi2Lmsq1L1/GZOHQ3Hvsta3t2p98m4fi5dohzQ0N H8KHq9CjgaIF7ifKxVj6jXvLPsbiE2ynwNpoIjPsg3wcf5cISUqMKrTGq70mjiO8cxKk zm9k2kPn4g9dyBkiw4fn0RIh9++ces2DT0Rhf0wnePMRcw2O2J6ThC9gWrM+C4V8qjrx wAmjtlRQHLxArEVjLmWKrSOyCtg/1BxYeO5uVe1Pruzpp8tFowJW8Be624tAGqQwzapG 6rkWZlX2ifac3mRTD0MBbfaS57KiSG6ST3F1OCuScKq5JL/RJnWl6ODESZ1VKImSIjTN WdLg== ARC-Authentication-Results: i=1; mx.google.com; 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=collabora.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id jz23si12035022ejb.306.2020.04.16.14.15.27; Thu, 16 Apr 2020 14:15:50 -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; 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=collabora.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728797AbgDPVNt (ORCPT + 99 others); Thu, 16 Apr 2020 17:13:49 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43724 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S1725928AbgDPVNs (ORCPT ); Thu, 16 Apr 2020 17:13:48 -0400 Received: from bhuna.collabora.co.uk (bhuna.collabora.co.uk [IPv6:2a00:1098:0:82:1000:25:2eeb:e3e3]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 34192C061A0C for ; Thu, 16 Apr 2020 14:13:48 -0700 (PDT) Received: from [127.0.0.1] (localhost [127.0.0.1]) (Authenticated sender: krisman) with ESMTPSA id C50C02A23DF From: Gabriel Krisman Bertazi To: agk@redhat.com, snitzer@redhat.com Cc: dm-devel@redhat.com, linux-kernel@vger.kernel.org, song@kernel.org, khazhy@google.com, kernel@collabora.com, Gabriel Krisman Bertazi Subject: [PATCH 1/2] md: Expose struct request to path selector Date: Thu, 16 Apr 2020 17:13:35 -0400 Message-Id: <20200416211336.2423618-2-krisman@collabora.com> X-Mailer: git-send-email 2.26.0 In-Reply-To: <20200416211336.2423618-1-krisman@collabora.com> References: <20200416211336.2423618-1-krisman@collabora.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Khazhismel Kumykov This allows a path selector to access metadata such as request start and end time. nr_bytes is retained for end_io, as blk_rq_bytes represents the number of bytes *left* in a request, and is 0 after a request is finished. Signed-off-by: Khazhismel Kumykov Co-developed-by: Gabriel Krisman Bertazi Signed-off-by: Gabriel Krisman Bertazi --- drivers/md/dm-mpath.c | 12 ++++++++++-- drivers/md/dm-path-selector.h | 6 ++++++ 2 files changed, 16 insertions(+), 2 deletions(-) diff --git a/drivers/md/dm-mpath.c b/drivers/md/dm-mpath.c index 2bc18c9c3abc..0cdd3a939d41 100644 --- a/drivers/md/dm-mpath.c +++ b/drivers/md/dm-mpath.c @@ -546,7 +546,12 @@ static int multipath_clone_and_map(struct dm_target *ti, struct request *rq, clone->cmd_flags |= REQ_FAILFAST_TRANSPORT; *__clone = clone; - if (pgpath->pg->ps.type->start_io) + if (pgpath->pg->ps.type->start_io_rq) + pgpath->pg->ps.type->start_io_rq(&pgpath->pg->ps, + &pgpath->path, + clone ?: rq, + nr_bytes); + else if (pgpath->pg->ps.type->start_io) pgpath->pg->ps.type->start_io(&pgpath->pg->ps, &pgpath->path, nr_bytes); @@ -1614,7 +1619,10 @@ static int multipath_end_io(struct dm_target *ti, struct request *clone, if (pgpath) { struct path_selector *ps = &pgpath->pg->ps; - if (ps->type->end_io) + if (ps->type->end_io_rq) + ps->type->end_io_rq(ps, &pgpath->path, + clone, mpio->nr_bytes); + else if (ps->type->end_io) ps->type->end_io(ps, &pgpath->path, mpio->nr_bytes); } diff --git a/drivers/md/dm-path-selector.h b/drivers/md/dm-path-selector.h index b6eb5365b1a4..98b6c9d4e21f 100644 --- a/drivers/md/dm-path-selector.h +++ b/drivers/md/dm-path-selector.h @@ -12,6 +12,7 @@ #ifndef DM_PATH_SELECTOR_H #define DM_PATH_SELECTOR_H +#include #include #include "dm-mpath.h" @@ -75,6 +76,11 @@ struct path_selector_type { size_t nr_bytes); int (*end_io) (struct path_selector *ps, struct dm_path *path, size_t nr_bytes); + + int (*start_io_rq)(struct path_selector *ps, struct dm_path *path, + const struct request *rq, size_t nr_bytes); + int (*end_io_rq)(struct path_selector *ps, struct dm_path *path, + const struct request *rq, size_t nr_bytes); }; /* Register a path selector */ -- 2.26.0