Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp927714yba; Thu, 18 Apr 2019 11:59:29 -0700 (PDT) X-Google-Smtp-Source: APXvYqyCi/vj/EzNHBaZP/sLxMcr+JjGhf9RQf58mMbE+/p8GC8X0+B49fRlTXnjJcb+L3/P42PL X-Received: by 2002:a17:902:8643:: with SMTP id y3mr1590156plt.187.1555613968982; Thu, 18 Apr 2019 11:59:28 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1555613968; cv=none; d=google.com; s=arc-20160816; b=e63TNU5dCShNJcZ7O6lukHfRJilYc6ZygMQXgCrZPUeBCSgDWq97CPWD288Z3KiKYb GVwHPXlnGkj+3Ur7Gd679mJzKJYhW6Pi4ycYGe74d6UwV4yDTLmxI0dmWgkaPm4vpYY2 lLuJvpCXxetuaEFVn3/aQWRS3SgySFJpk+1ZS/yS3OVT58z9zxV8k607h8g3gSA1oEk3 cENbSM+12eqHYWTvPGazPySVHibkd3L+S9rnA9lUgi7D2NI0ydkbO24m6z6Oafjo/A9U YaoXE4ew9/wSuUCq3WzA/0nKE92x5NWTCjegDWzE5v1CK24FG4GoyncipWJpWQjna2NS nzzw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:to:cc:in-reply-to:date:subject :mime-version:message-id:from:dkim-signature; bh=Rls8ZXKxpitLdToJVhs5aQI6eogfraGi8L51K73vZHA=; b=hqNtum3n3Q3e695zf5t6ZM/5bX01DVkr87NmS1uA87M1t6v/qlXiqx5FttOUQvZ284 8C5V+XJ49rBJz7JzrIKsGUX5xzMe/z/5/vaSXWHCC0hDW72Ox6iYUXRmqJ6RLHlKo23G ow5USiITO8ZnlhlV79z+DNf5KZwSuGMh0+A8Df85rK4ZNsB9DhnIOCrWJfscuUFOlLDx +wlZFL2q1ijAsz32zIWr/u0DbJ1G+KqpporR2aHo6XfBYLdE75ag+ZrFnGH6CRnATOS+ 5eaB/dP5XwaovtbDhYVb7spl7RR8ylO3ZkOE0195V3Xek7vGyfWIOrAJRQhsLUUj+Pku wZoA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@dilger-ca.20150623.gappssmtp.com header.s=20150623 header.b=MfU9AJa0; 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 t16si2837072plr.63.2019.04.18.11.59.13; Thu, 18 Apr 2019 11:59:28 -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=@dilger-ca.20150623.gappssmtp.com header.s=20150623 header.b=MfU9AJa0; 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 S1725747AbfDRS6T (ORCPT + 99 others); Thu, 18 Apr 2019 14:58:19 -0400 Received: from mail-pl1-f196.google.com ([209.85.214.196]:39403 "EHLO mail-pl1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2389901AbfDRS6T (ORCPT ); Thu, 18 Apr 2019 14:58:19 -0400 Received: by mail-pl1-f196.google.com with SMTP id a96so1577996pla.6 for ; Thu, 18 Apr 2019 11:58:18 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=dilger-ca.20150623.gappssmtp.com; s=20150623; h=from:message-id:mime-version:subject:date:in-reply-to:cc:to :references; bh=Rls8ZXKxpitLdToJVhs5aQI6eogfraGi8L51K73vZHA=; b=MfU9AJa0duArcFo2+QYl8UPFXdYay3Rc1DAlk633euOpRQos/H2Qsq8hI9EHE0VglA l3lJzLNDZseM4FhVy+SjIJow8umIWXKZfKWSe+B/13SayWTmuivmwKEHIOFQd1yLkPCh d0axKanB3162FWykYa48SdDp9Oo982oGwQz//7yRu/0ny1j+dY1oUTW8Tsmyj9NGB4Kr +MXj6AUB8Qts7YFGyvOe0AU5DPwcFh/5C3QZMDFqarBOoMDaL72tVjlnHRT172BKo6I/ lpXDf4aU4cbrZZ5HW/IsBD0Gu1lkBL9BxDPv+K4tWSOC8F6+GFyTiNHRznNuWH0EHqz/ +e6g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:message-id:mime-version:subject:date :in-reply-to:cc:to:references; bh=Rls8ZXKxpitLdToJVhs5aQI6eogfraGi8L51K73vZHA=; b=dU8nvD+p1E2QO8SDriiiQBAhguSCKaZfKxIEZNKgaurgw/jvgPrSk5URC7s/JCLzuA AKLi1ApngAERg8utI/RkA2DxvzkSSJwjQnhZ+znjgMUUwgp/9tl6OZk8p/tNNAtAhi4h j8GqYOpcsuLZ5Jv7QMAuWHLIlT14VoaDvaNyooZQrzx1L63rt1+O//L7jBmocVQ5qHxg NgKHdNt8oa3v2RylKA1YvC0lUemdHNoUblqOyVFKVMOnAIakbiuKCcf4tUMnHYEgt0oy VvMGY1VBTgwVNth1GwhwVIXsFxypP4FjLzkIuspMdLv1dCNQ6r4lTeEuS0ZOJKfiO7HR ixPg== X-Gm-Message-State: APjAAAUQ+qRWJPjISNUCVg3EqqfEP3StNb+DMy/VSDmTaUgKWXKUz91A sM+hgEe2wARDYgTziPGZ2d0JCQ== X-Received: by 2002:a17:902:581:: with SMTP id f1mr55594044plf.304.1555613897955; Thu, 18 Apr 2019 11:58:17 -0700 (PDT) Received: from cabot-wlan.adilger.int (S0106a84e3fe4b223.cg.shawcable.net. [70.77.216.213]) by smtp.gmail.com with ESMTPSA id u5sm4225156pfm.121.2019.04.18.11.58.16 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 18 Apr 2019 11:58:17 -0700 (PDT) From: Andreas Dilger Message-Id: <9BD0C782-5967-4DCB-9D01-E5BCC73E653C@dilger.ca> Content-Type: multipart/signed; boundary="Apple-Mail=_E3FEA83A-9256-40CD-B4F8-E3FF6FED0F48"; protocol="application/pgp-signature"; micalg=pgp-sha256 Mime-Version: 1.0 (Mac OS X Mail 10.3 \(3273\)) Subject: Re: [PATCH v4 4/7] block: introduce write-hint to stream-id conversion Date: Thu, 18 Apr 2019 12:58:14 -0600 In-Reply-To: <20190418140603.GL28541@quack2.suse.cz> Cc: Kanchan Joshi , open list , linux-block , linux-nvme@lists.infradead.org, linux-fsdevel , linux-ext4@vger.kernel.org, prakash.v@samsung.com To: Jan Kara References: <1555523406-2380-1-git-send-email-joshi.k@samsung.com> <1555523406-2380-5-git-send-email-joshi.k@samsung.com> <20190418140603.GL28541@quack2.suse.cz> X-Mailer: Apple Mail (2.3273) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org --Apple-Mail=_E3FEA83A-9256-40CD-B4F8-E3FF6FED0F48 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=us-ascii On Apr 18, 2019, at 8:06 AM, Jan Kara wrote: >=20 > On Wed 17-04-19 23:20:03, Kanchan Joshi wrote: >> This patch moves write-hint-to-stream-id conversion in block-layer. >> Earlier this was done by driver (nvme). Current conversion is of the >> form "streamid =3D write-hint - 1", for both user and kernel streams. >> Conversion takes stream limit (maintained in request queue) into >> account. Write-hints beyond the exposed limit turn to 0. >> A new field 'streamid' has been added in request. While 'write-hint' >> field continues to exist. It keeps original value passed from upper >> layer, and used during merging checks. >>=20 >> Signed-off-by: Kanchan Joshi >> --- >> block/blk-core.c | 20 ++++++++++++++++++++ >> include/linux/blkdev.h | 1 + >> 2 files changed, 21 insertions(+) >>=20 >> diff --git a/block/blk-core.c b/block/blk-core.c >> index a55389b..712e6b7 100644 >> --- a/block/blk-core.c >> +++ b/block/blk-core.c >> @@ -730,6 +730,25 @@ bool blk_attempt_plug_merge(struct request_queue = *q, struct bio *bio, >> return false; >> } >>=20 >> +enum rw_hint blk_write_hint_to_streamid(struct request *req, >> + struct bio *bio) >> +{ >> + enum rw_hint streamid, nr_streams; >> + struct request_queue *q =3D req->q; >> + nr_streams =3D q->limits.nr_streams; >> + >> + streamid =3D bio->bi_write_hint; >> + if (!nr_streams || streamid =3D=3D WRITE_LIFE_NOT_SET || >> + streamid =3D=3D WRITE_LIFE_NONE) >> + streamid =3D 0; >> + else { >> + --streamid; >> + if(streamid > nr_streams) >> + streamid =3D 0; >> + } >> + return streamid; >> +} >> + >=20 > Someone told me that stream ids are potentially persistent on the = storage > so it isn't great to change the id for the same thing e.g. if we add > another user hint. So maybe we should allocate kernel hints from top = as > Dave Chinner suggested? I.e., something like the following mapping = function: >=20 > if (streamid <=3D BLK_MAX_USER_HINTS) { > streamid--; > if (streamid > nr_streams) > streamid =3D 0; > } else { > /* Kernel hints get allocated from top */ > streamid -=3D WRITE_LIFE_KERN_MIN; > if (streamid > nr_streams - BLK_MAX_USER_HINTS) > streamid =3D 0; > else > streamid =3D nr_streams - streamid - 1; > } >=20 > what do you think? Dave has expressed this sentiment several times, and I agree. We don't want the filesystem hint values/mapping to change over time, or it will conflict with data that was written with the previous hints (e.g. if data was written with a "short lifetime" hint suddenly changes to be grouped with a "long lifetime" hint). This is easily avoided with some simple changes now, but harder to fix after this patch has landed. Cheers, Andreas --Apple-Mail=_E3FEA83A-9256-40CD-B4F8-E3FF6FED0F48 Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename=signature.asc Content-Type: application/pgp-signature; name=signature.asc Content-Description: Message signed with OpenPGP -----BEGIN PGP SIGNATURE----- Comment: GPGTools - http://gpgtools.org iQIzBAEBCAAdFiEEDb73u6ZejP5ZMprvcqXauRfMH+AFAly4yMcACgkQcqXauRfM H+D0PRAAqc1IZBlPSc3z+RpgV6C85m4l3Yd3cAYdG+R0kOOUx23t/z/vT9Sb0Qgr mohRguY/t1dzZ9Kmu/XPYpuMVX2VNnymVjldxVVea7V0NYuEb7qDzMvPKrGr1tIR rHh4vrrx+Riq+4K6TqjfgsJI6hdjIhCTU37VcCcAW9/3tHOTHPpYuhcvSpIzAGxc 60Zm+btRFcrx0wKRd/F0x9D1tbv0LKXJlaC3bD6OquZ0QbM8Z4TncHkl4NjwG7IN iNJOOoYJKm623G3aJMLyPlXnJ5KCTgr9Swy4fiJDQOqtFb1oU0Jd2/1+gIXSmIVD sZ+72FId74kf5Iu3Upr9tFtRdFs/IkUVVJVKDOmpeTO0FJXVkIgejpKwhJTzhWE8 E50OkTAgEg11+6VfI072rhudkK5FbXZ3ACVnJp+htOdLiT6etlyYEfpE35l+mUhE XJ2TavOJi9P+SQ3VSsSpEXzNBDfho838ZkwaH43LdmBIWeZCdymf2FHS3DJ9mDOi ihGr0DQGQAqLwbgD+zjNI9dCXoTiGp4+SDA0CcfwNPc6j8CPtFpguCmrQu/FJTRF GjXBTeu07u+kw0Nh0B3nDbieS87ObR8XOqGtvQHCC0sOkIfr78KnKahgICXsqAna Mo9d9G6Iq6nW/oY4fgk2ZVFgL+ubMJX0h2ho4I9MxtdonFabeTk= =vct3 -----END PGP SIGNATURE----- --Apple-Mail=_E3FEA83A-9256-40CD-B4F8-E3FF6FED0F48--