From patchwork Wed Apr 17 17:50:00 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kanchan Joshi X-Patchwork-Id: 10905721 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 9A228922 for ; Wed, 17 Apr 2019 17:54:40 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 89B74289CA for ; Wed, 17 Apr 2019 17:54:40 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 7E50B28B7B; Wed, 17 Apr 2019 17:54:40 +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=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,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 3A6BF289CA for ; Wed, 17 Apr 2019 17:54:40 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1733236AbfDQRx5 (ORCPT ); Wed, 17 Apr 2019 13:53:57 -0400 Received: from mailout1.samsung.com ([203.254.224.24]:49145 "EHLO mailout1.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1733216AbfDQRx4 (ORCPT ); Wed, 17 Apr 2019 13:53:56 -0400 Received: from epcas1p1.samsung.com (unknown [182.195.41.45]) by mailout1.samsung.com (KnoxPortal) with ESMTP id 20190417175352epoutp016a9cdc22c6155e6dc86b582cadb6d63f~WVICU6CyB2230422304epoutp01z; Wed, 17 Apr 2019 17:53:52 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout1.samsung.com 20190417175352epoutp016a9cdc22c6155e6dc86b582cadb6d63f~WVICU6CyB2230422304epoutp01z DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1555523632; bh=AW0YDDi+9LxgJJQEsuX274rekHmOC8F5v9v1EvGolgI=; h=From:To:Cc:Subject:Date:In-reply-to:References:From; b=CIAyJN1CYDMKCCud09/haqoQpZjbcT2hfwQ+LfUCOi9HY5tC99O4yLQCjtKjWBkbU VsRyebgPc5vJlYUnGHTYeh3LrbtdGdSYlxzQPooSQ7C0F92s/AZ7B09ajwUJcTrkm/ kDTuGcfsNtihHX8WL4EhVmICVLDXNs+Int6OgSE4= Received: from epsmges1p1.samsung.com (unknown [182.195.42.53]) by epcas1p4.samsung.com (KnoxPortal) with ESMTP id 20190417175352epcas1p4a6189df1d2b856f7f07718004a7d11e3~WVICCiHsu1781617816epcas1p4Q; Wed, 17 Apr 2019 17:53:52 +0000 (GMT) Received: from epcas1p1.samsung.com ( [182.195.41.45]) by epsmges1p1.samsung.com (Symantec Messaging Gateway) with SMTP id 4E.63.04139.03867BC5; Thu, 18 Apr 2019 02:53:52 +0900 (KST) Received: from epsmgms2p1new.samsung.com (unknown [182.195.42.142]) by epcas1p4.samsung.com (KnoxPortal) with ESMTP id 20190417175351epcas1p481ec1bd87188022020a504447e88fde4~WVIBHFvwF2080520805epcas1p4G; Wed, 17 Apr 2019 17:53:51 +0000 (GMT) X-AuditID: b6c32a35-973ff7000000102b-4e-5cb76830be01 Received: from epmmp1.local.host ( [203.254.227.16]) by epsmgms2p1new.samsung.com (Symantec Messaging Gateway) with SMTP id EC.11.03598.F2867BC5; Thu, 18 Apr 2019 02:53:51 +0900 (KST) Received: from test-PowerEdge-R720.sa.corp.samsungelectronics.net ([107.108.221.212]) by mmp1.samsung.com (Oracle Communications Messaging Server 7.0.5.31.0 64bit (built May 5 2014)) with ESMTPA id <0PQ4006MF9PFCC30@mmp1.samsung.com>; Thu, 18 Apr 2019 02:53:51 +0900 (KST) From: Kanchan Joshi To: linux-kernel@vger.kernel.org, linux-block@vger.kernel.org, linux-nvme@lists.infradead.org, linux-fsdevel@vger.kernel.org, linux-ext4@vger.kernel.org Cc: prakash.v@samsung.com, Kanchan Joshi Subject: [PATCH v4 1/7] fs: introduce write-hint start point for in-kernel hints Date: Wed, 17 Apr 2019 23:20:00 +0530 Message-id: <1555523406-2380-2-git-send-email-joshi.k@samsung.com> X-Mailer: git-send-email 2.7.4 In-reply-to: <1555523406-2380-1-git-send-email-joshi.k@samsung.com> X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFupjkeLIzCtJLcpLzFFi42LZdlhTV9cgY3uMwZN2Houj/9+yWey9pW0x c94dNos9e0+yWFzeNYfNYv6yp+wWV6YsYnZg99i8pN6jb8sqRo/Pm+QCmKO4bFJSczLLUov0 7RK4Mjq6brIULGSt6GmYydjAuI6li5GTQ0LAROLlyjamLkYuDiGBHYwSvzbPZINwvjNK9D2/ xwRTdfrbdHYQW0hgN6PEin4diKLpTBKnFi5j7WLk4GAT0JS4MLkUJC4iMIdRYtm+acwgDcwC dhIzvr1mBbGFBYIkPv6+CLaaRUBVovXBW7AaXgEniSXXfrJDLJOTuHmuEyzOKeAs8ejKLTaI +E9WidvTZCBsF4mX13+B7ZUQkJa4dNQWIlws8evOUWaQGyQEOhglrjfMhHrTXuLinr9MEPfw Sbz72gPVyyvR0SYEUeIhsf95A9Tz0xglPm58xD6BUWIBI8MqRrHUguLc9NRiwwJDveLE3OLS vHS95PzcTYzgWNIy3cE45ZzPIUYBDkYlHl4Gje0xQqyJZcWVuYcYJTiYlUR4HVO2xAjxpiRW VqUW5ccXleakFh9ilOZgURLnXe/gHCMkkJ5YkpqdmlqQWgSTZeLglGpgPJac/yAuMjNzisx7 Ke+JpQ1hDLqmhc88fkudZrXzDjrMNaumx+Vl35q13DKHmPvW5iy68s69/6C0leD6PBH+D6me b3Zcq1C23jlnJ49+eeIOE3t3yZnHI24GBDakX1e/Wtca4Mt9wtQrfFet9auta2/deDZ7umaR xcXEwPUhC/bEcevxt2srsRRnJBpqMRcVJwIAP1CCjaECAAA= X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFmpgluLIzCtJLcpLzFFi42I5/e+xgK5+xvYYgxNvuS2O/n/LZrH3lrbF zHl32Cz27D3JYnF51xw2i/nLnrJbXJmyiNmB3WPzknqPvi2rGD0+b5ILYI7isklJzcksSy3S t0vgyujouslSsJC1oqdhJmMD4zqWLkZODgkBE4nT36azdzFycQgJ7GSUuNB5mhHCmckkcWV6 N1MXIwcHm4CmxIXJpSBxEYE5jBI9u9ezgnQzC9hJzPj2GswWFgiQ+NB0gh3EZhFQlWh98JYZ xOYVcJJYcu0nO8Q2OYmb5zrB4pwCzhKPrtxiA7GFgGpOr/rDPoGRZwEjwypGydSC4tz03GKj AsO81HK94sTc4tK8dL3k/NxNjMBw2XZYq28H4/0l8YcYBTgYlXh4V6hujxFiTSwrrsw9xCjB wawkwuuYsiVGiDclsbIqtSg/vqg0J7X4EKM0B4uSOO/tvGORQgLpiSWp2ampBalFMFkmDk6p BkbWS1FhsS5v7wufPmi45vux8zXCrIk9Apy/P3qbL1U91RA/YcH9J+X86/KKY3myPItmxXmn lr39LXC4UvP84e17vIPjohp5rfx2BTXmcQa8WXnwLlvJxzNqau8u+3Y3be5iy05My/3y5wxL PPeMy8a923OY/tRL3dijndodmnWgMyUp+CfDEyWW4oxEQy3mouJEAN5IJu0TAgAA X-CMS-MailID: 20190417175351epcas1p481ec1bd87188022020a504447e88fde4 CMS-TYPE: 101P X-CMS-RootMailID: 20190417175351epcas1p481ec1bd87188022020a504447e88fde4 References: <1555523406-2380-1-git-send-email-joshi.k@samsung.com> Sender: linux-block-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-block@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Introduce "WRITE_LIFE_KERN_MIN". Kernel mode components can define own write-hints using this as base. Signed-off-by: Kanchan Joshi --- include/linux/fs.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/include/linux/fs.h b/include/linux/fs.h index dd28e76..ee27eb4 100644 --- a/include/linux/fs.h +++ b/include/linux/fs.h @@ -299,6 +299,8 @@ enum rw_hint { WRITE_LIFE_MEDIUM = RWH_WRITE_LIFE_MEDIUM, WRITE_LIFE_LONG = RWH_WRITE_LIFE_LONG, WRITE_LIFE_EXTREME = RWH_WRITE_LIFE_EXTREME, +/* Kernel should use write-hint starting from this */ + WRITE_LIFE_KERN_MIN, }; #define IOCB_EVENTFD (1 << 0) From patchwork Wed Apr 17 17:50:01 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kanchan Joshi X-Patchwork-Id: 10905717 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 54C1313B5 for ; Wed, 17 Apr 2019 17:54:35 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 4557C289DD for ; Wed, 17 Apr 2019 17:54:35 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 38A7D28B7D; Wed, 17 Apr 2019 17:54:35 +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=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,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 E2640289DD for ; Wed, 17 Apr 2019 17:54:34 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1733251AbfDQRx6 (ORCPT ); Wed, 17 Apr 2019 13:53:58 -0400 Received: from mailout2.samsung.com ([203.254.224.25]:19367 "EHLO mailout2.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729446AbfDQRx6 (ORCPT ); Wed, 17 Apr 2019 13:53:58 -0400 Received: from epcas2p2.samsung.com (unknown [182.195.41.54]) by mailout2.samsung.com (KnoxPortal) with ESMTP id 20190417175354epoutp025903a323167096bff9d0bda60c7fc620~WVIEfu3OY0540005400epoutp02Q; Wed, 17 Apr 2019 17:53:54 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout2.samsung.com 20190417175354epoutp025903a323167096bff9d0bda60c7fc620~WVIEfu3OY0540005400epoutp02Q DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1555523634; bh=jnasjsltYOWI5j2h9cG9IGjDl+oZ1+awrFgJ1LtSdiY=; h=From:To:Cc:Subject:Date:In-reply-to:References:From; b=NpAmYO0mZcbTv7J+G27mRyyYZMGqYhKdal3UOVwgr7xsP9zbbZHB2ng7sDeVlKtrh 5zrGJt27BHKicbwTs7Y+mcHJVQgTPINIw53zJXLKBi2ZUXHlWxlWuv3+r9LyyR7Aed Exa8oWh9zz3p/2trk027R985AOgULSyJGm/qWlRw= Received: from epsmges2p4.samsung.com (unknown [182.195.42.72]) by epcas2p1.samsung.com (KnoxPortal) with ESMTP id 20190417175353epcas2p1054d178266c50e151c33f8a7f865ba9d~WVIDoB2E31198411984epcas2p1F; Wed, 17 Apr 2019 17:53:53 +0000 (GMT) Received: from epcas2p3.samsung.com ( [182.195.41.55]) by epsmges2p4.samsung.com (Symantec Messaging Gateway) with SMTP id CE.58.04207.13867BC5; Thu, 18 Apr 2019 02:53:53 +0900 (KST) Received: from epsmgms2p2new.samsung.com (unknown [182.195.42.143]) by epcas2p1.samsung.com (KnoxPortal) with ESMTP id 20190417175353epcas2p1eaec3fea0bf26bb97416149e11b1317e~WVIDVYopJ1198411984epcas2p1E; Wed, 17 Apr 2019 17:53:53 +0000 (GMT) X-AuditID: b6c32a48-689ff7000000106f-f0-5cb76831ec18 Received: from epmmp1.local.host ( [203.254.227.16]) by epsmgms2p2new.samsung.com (Symantec Messaging Gateway) with SMTP id D7.EF.03620.13867BC5; Thu, 18 Apr 2019 02:53:53 +0900 (KST) Received: from test-PowerEdge-R720.sa.corp.samsungelectronics.net ([107.108.221.212]) by mmp1.samsung.com (Oracle Communications Messaging Server 7.0.5.31.0 64bit (built May 5 2014)) with ESMTPA id <0PQ4006MF9PFCC30@mmp1.samsung.com>; Thu, 18 Apr 2019 02:53:53 +0900 (KST) From: Kanchan Joshi To: linux-kernel@vger.kernel.org, linux-block@vger.kernel.org, linux-nvme@lists.infradead.org, linux-fsdevel@vger.kernel.org, linux-ext4@vger.kernel.org Cc: prakash.v@samsung.com, Kanchan Joshi Subject: [PATCH v4 2/7] block: increase stream count for in-kernel use Date: Wed, 17 Apr 2019 23:20:01 +0530 Message-id: <1555523406-2380-3-git-send-email-joshi.k@samsung.com> X-Mailer: git-send-email 2.7.4 In-reply-to: <1555523406-2380-1-git-send-email-joshi.k@samsung.com> X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFprAIsWRmVeSWpSXmKPExsWy7bCmua5hxvYYg87TRhZH/79ls9h7S9ti 5rw7bBZ79p5ksbi8aw6bxfxlT9ktrkxZxOzA7rF5Sb1H35ZVjB6fN8kFMEdx2aSk5mSWpRbp 2yVwZbS8Eyw4ylrRtK2PsYHxJEsXIyeHhICJxNOOi0A2F4eQwA5GiYbTP5kgnO+MEjOvrGKH qbr55w0jRGI3o8St9haolulMEl8XzWDrYuTgYBPQlLgwuRQkLiIwh1Fi2b5pzCDdzAJ2EjO+ vWYFsYUF3CTaZqwBm8oioCoxc+lHMJtXwEni841jUNvkJG6e6wTr5RRwlnh05RYbyFAJgZ+s EvOvHGaEKHKROPvxKTOELS3xbNVGq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Yt23KT7echHDX2Zu/TDXmmbW/rrCyr0hh83O2R24iaee0 1G9p7NmuHG2QGKK3WfhYoEJ3isu9dOtJPmbvlFiKMxINtZiLihMBMA8bMRICAAA= X-CMS-MailID: 20190417175353epcas2p1eaec3fea0bf26bb97416149e11b1317e CMS-TYPE: 102P X-CMS-RootMailID: 20190417175353epcas2p1eaec3fea0bf26bb97416149e11b1317e References: <1555523406-2380-1-git-send-email-joshi.k@samsung.com> Sender: linux-block-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-block@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP This bumps up stream count to support in-kernel hints. Signed-off-by: Kanchan Joshi --- include/linux/blkdev.h | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/include/linux/blkdev.h b/include/linux/blkdev.h index 5c58a3b..f200aed 100644 --- a/include/linux/blkdev.h +++ b/include/linux/blkdev.h @@ -566,7 +566,9 @@ struct request_queue { struct work_struct release_work; -#define BLK_MAX_WRITE_HINTS 5 +#define BLK_MAX_USER_HINTS (WRITE_LIFE_KERN_MIN - 2) +#define BLK_MAX_KERN_HINTS 4 +#define BLK_MAX_WRITE_HINTS (1 + BLK_MAX_USER_HINTS + BLK_MAX_KERN_HINTS) u64 write_hints[BLK_MAX_WRITE_HINTS]; }; From patchwork Wed Apr 17 17:50:02 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kanchan Joshi X-Patchwork-Id: 10905713 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 99BC413B5 for ; Wed, 17 Apr 2019 17:54:32 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 88700289DD for ; Wed, 17 Apr 2019 17:54:32 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 798A028B7D; Wed, 17 Apr 2019 17:54:32 +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=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,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 279FE289DD for ; Wed, 17 Apr 2019 17:54:32 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729446AbfDQRyA (ORCPT ); Wed, 17 Apr 2019 13:54:00 -0400 Received: from mailout1.samsung.com ([203.254.224.24]:49153 "EHLO mailout1.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1733216AbfDQRyA (ORCPT ); Wed, 17 Apr 2019 13:54:00 -0400 Received: from epcas2p2.samsung.com (unknown [182.195.41.54]) by mailout1.samsung.com (KnoxPortal) with ESMTP id 20190417175357epoutp01e11dbaf51e9069fa95238330b4b9370b~WVIGzXioN1672816728epoutp01b; Wed, 17 Apr 2019 17:53:57 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout1.samsung.com 20190417175357epoutp01e11dbaf51e9069fa95238330b4b9370b~WVIGzXioN1672816728epoutp01b DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1555523637; bh=yngJd/i4HDdpI6vpdDUMKHnT/4qweub0+lvxLfq26PE=; h=From:To:Cc:Subject:Date:In-reply-to:References:From; b=ESyRflBlWa1xymU3US7nf6Q5SPw+fF859uskVDBoPONzkvYoSTnTfnDCOdHrfBmh6 lBX8AAAkUNk5ZHaavViaYiGqkkIaNpcKyDh7YriU1S6BIxGg9InQmmbCZh80RG2Vmw BBeswvUBkIiUj6IBFCF4MHxmCvo73Ey0qYg4udCU= Received: from epsmges2p1.samsung.com (unknown [182.195.42.69]) by epcas2p4.samsung.com (KnoxPortal) with ESMTP id 20190417175356epcas2p4ad63924958516c6cbc040dbe0f76a339~WVIGIZyIa2024920249epcas2p4F; Wed, 17 Apr 2019 17:53:56 +0000 (GMT) Received: from epcas2p4.samsung.com ( [182.195.41.56]) by epsmges2p1.samsung.com (Symantec Messaging Gateway) with SMTP id DF.A3.04195.43867BC5; Thu, 18 Apr 2019 02:53:56 +0900 (KST) Received: from epsmgms2p2new.samsung.com (unknown [182.195.42.143]) by epcas2p1.samsung.com (KnoxPortal) with ESMTP id 20190417175355epcas2p182a8626924a911310f7584d564d0a1ec~WVIFcJ_yt1198411984epcas2p1N; Wed, 17 Apr 2019 17:53:55 +0000 (GMT) X-AuditID: b6c32a45-d47ff70000001063-1c-5cb76834277f Received: from epmmp1.local.host ( [203.254.227.16]) by epsmgms2p2new.samsung.com (Symantec Messaging Gateway) with SMTP id 58.EF.03620.33867BC5; Thu, 18 Apr 2019 02:53:55 +0900 (KST) Received: from test-PowerEdge-R720.sa.corp.samsungelectronics.net ([107.108.221.212]) by mmp1.samsung.com (Oracle Communications Messaging Server 7.0.5.31.0 64bit (built May 5 2014)) with ESMTPA id <0PQ4006MF9PFCC30@mmp1.samsung.com>; Thu, 18 Apr 2019 02:53:55 +0900 (KST) From: Kanchan Joshi To: linux-kernel@vger.kernel.org, linux-block@vger.kernel.org, linux-nvme@lists.infradead.org, linux-fsdevel@vger.kernel.org, linux-ext4@vger.kernel.org Cc: prakash.v@samsung.com, Kanchan Joshi Subject: [PATCH v4 3/7] block: introduce API to register stream information with block-layer Date: Wed, 17 Apr 2019 23:20:02 +0530 Message-id: <1555523406-2380-4-git-send-email-joshi.k@samsung.com> X-Mailer: git-send-email 2.7.4 In-reply-to: <1555523406-2380-1-git-send-email-joshi.k@samsung.com> X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFupnkeLIzCtJLcpL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K0gNs4CdxIxvr8FsYYE4iUttu8BsFgFViXdHVjGB 2LwCThLzl59mhVgmJ3HzXCcziM0p4Czx6MotNohdThKnV/1hn8DIs4CRYRWjZGpBcW56brFR gVFearlecWJucWleul5yfu4mRmCobDus1b+D8fGS+EOMAhyMSjy8K1S3xwixJpYVV+YeYpTg YFYS4XVM2RIjxJuSWFmVWpQfX1Sak1p8iFGag0VJnJc//1ikkEB6YklqdmpqQWoRTJaJg1Oq gTFw3YNzAn+iVJq1TiXUslcutA92WZw82ex9kgWjoqj2rXkX72W7uJnXr8xYefbkzQWC/7od A3b+eN2WPmWB/q0A26b9ex5xvJBUa+h61Gp+f7XtnEDJ5rUyXy/EfVXMC5RVbrbZOy3Hq3ZV 56f67ueK/4/9m+PvtYrTIOrn5Kwf3zt5Pn+4cEqJpTgj0VCLuag4EQDJqtP7EQIAAA== X-CMS-MailID: 20190417175355epcas2p182a8626924a911310f7584d564d0a1ec CMS-TYPE: 102P X-CMS-RootMailID: 20190417175355epcas2p182a8626924a911310f7584d564d0a1ec References: <1555523406-2380-1-git-send-email-joshi.k@samsung.com> Sender: linux-block-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-block@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP This introduces stream limit (count of streams supported by underlying driver) in request-queue. Signed-off-by: Kanchan Joshi --- block/blk-settings.c | 12 ++++++++++++ include/linux/blkdev.h | 2 ++ 2 files changed, 14 insertions(+) diff --git a/block/blk-settings.c b/block/blk-settings.c index 6375afa..6023229 100644 --- a/block/blk-settings.c +++ b/block/blk-settings.c @@ -231,6 +231,18 @@ void blk_queue_max_discard_sectors(struct request_queue *q, EXPORT_SYMBOL(blk_queue_max_discard_sectors); /** + * blk_queue_stream_limits - set stream parameters + * @q: the request queue for the device + * @nr_streams: number of streams supported by device + **/ +void blk_queue_stream_limits(struct request_queue *q, + unsigned short nr_streams) +{ + q->limits.nr_streams = nr_streams; +} +EXPORT_SYMBOL(blk_queue_stream_limits); + +/** * blk_queue_max_write_same_sectors - set max sectors for a single write same * @q: the request queue for the device * @max_write_same_sectors: maximum number of sectors to write per command diff --git a/include/linux/blkdev.h b/include/linux/blkdev.h index f200aed..eb6eb60 100644 --- a/include/linux/blkdev.h +++ b/include/linux/blkdev.h @@ -340,6 +340,7 @@ struct queue_limits { unsigned char discard_misaligned; unsigned char raid_partial_stripes_expensive; enum blk_zoned_model zoned; + unsigned short nr_streams; }; #ifdef CONFIG_BLK_DEV_ZONED @@ -1065,6 +1066,7 @@ extern void blk_queue_dma_alignment(struct request_queue *, int); extern void blk_queue_update_dma_alignment(struct request_queue *, int); extern void blk_queue_rq_timeout(struct request_queue *, unsigned int); extern void blk_queue_write_cache(struct request_queue *q, bool enabled, bool fua); +extern void blk_queue_stream_limits(struct request_queue *q, unsigned short); /* * Number of physical segments as sent to the device. From patchwork Wed Apr 17 17:50:03 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kanchan Joshi X-Patchwork-Id: 10905705 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id E4C5413B5 for ; Wed, 17 Apr 2019 17:54:22 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id D5621289CA for ; Wed, 17 Apr 2019 17:54:22 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id C957D28B7B; Wed, 17 Apr 2019 17:54:22 +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=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,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 76495289CA for ; Wed, 17 Apr 2019 17:54:22 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1733282AbfDQRyE (ORCPT ); Wed, 17 Apr 2019 13:54:04 -0400 Received: from mailout3.samsung.com ([203.254.224.33]:28409 "EHLO mailout3.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1733270AbfDQRyD (ORCPT ); Wed, 17 Apr 2019 13:54:03 -0400 Received: from epcas1p3.samsung.com (unknown [182.195.41.47]) by mailout3.samsung.com (KnoxPortal) with ESMTP id 20190417175359epoutp03f78333186bdd1d4bb01fdf95db1377e1~WVIJCLpJL0261502615epoutp03Q; Wed, 17 Apr 2019 17:53:59 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout3.samsung.com 20190417175359epoutp03f78333186bdd1d4bb01fdf95db1377e1~WVIJCLpJL0261502615epoutp03Q DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1555523639; bh=NoFKI2vIGHfk5Szl9zBT5VVk2EURUjmYsy+rBSCVOUY=; h=From:To:Cc:Subject:Date:In-reply-to:References:From; b=Zr2TJVQqJCbNGWkScQRLJhD6EainYO2OPj2Mf+CzLWTdzM4I1z8N67jqtHa/y1o88 fnXgKeqJMjugo6/is0mpd0ZPGrQ11NcFKiEx91a2FcDV1LY0+Ct9xUUEE66Xjzsl/a tkkLVqx7kE9wKC++AyGlGqChZCGoG9BoHLO2S7ys= Received: from epsmges1p2.samsung.com (unknown [182.195.42.54]) by epcas1p1.samsung.com (KnoxPortal) with ESMTP id 20190417175358epcas1p1cd9027f37a2bf7190c73320797a91cf7~WVIINUeHK1874118741epcas1p1B; Wed, 17 Apr 2019 17:53:58 +0000 (GMT) Received: from epcas1p2.samsung.com ( [182.195.41.46]) by epsmges1p2.samsung.com (Symantec Messaging Gateway) with SMTP id F6.BB.04142.63867BC5; Thu, 18 Apr 2019 02:53:58 +0900 (KST) Received: from epsmgms2p1new.samsung.com (unknown [182.195.42.142]) by epcas1p4.samsung.com (KnoxPortal) with ESMTP id 20190417175358epcas1p41a0a4e349dfe0a70bdcc244161c71604~WVIHpBTbN1781617816epcas1p4Y; Wed, 17 Apr 2019 17:53:58 +0000 (GMT) X-AuditID: b6c32a36-cf9ff7000000102e-52-5cb768362621 Received: from epmmp1.local.host ( [203.254.227.16]) by epsmgms2p1new.samsung.com (Symantec Messaging Gateway) with SMTP id AD.11.03598.63867BC5; Thu, 18 Apr 2019 02:53:58 +0900 (KST) Received: from test-PowerEdge-R720.sa.corp.samsungelectronics.net ([107.108.221.212]) by mmp1.samsung.com (Oracle Communications Messaging Server 7.0.5.31.0 64bit (built May 5 2014)) with ESMTPA id <0PQ4006MF9PFCC30@mmp1.samsung.com>; Thu, 18 Apr 2019 02:53:57 +0900 (KST) From: Kanchan Joshi To: linux-kernel@vger.kernel.org, linux-block@vger.kernel.org, linux-nvme@lists.infradead.org, linux-fsdevel@vger.kernel.org, linux-ext4@vger.kernel.org Cc: prakash.v@samsung.com, Kanchan Joshi Subject: [PATCH v4 4/7] block: introduce write-hint to stream-id conversion Date: Wed, 17 Apr 2019 23:20:03 +0530 Message-id: <1555523406-2380-5-git-send-email-joshi.k@samsung.com> X-Mailer: git-send-email 2.7.4 In-reply-to: <1555523406-2380-1-git-send-email-joshi.k@samsung.com> X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFupnkeLIzCtJLcpLzFFi42LZdlhTT9csY3uMwdtPehZH/79ls9h7S9ti 5rw7bBZ79p5ksbi8aw6bxfxlT9ktrkxZxOzA7rF5Sb1H35ZVjB6fN8kFMEdx2aSk5mSWpRbp 2yVwZTx+/Ie5YLtgxdRzr9gaGJfxdTFycEgImEgsP6TYxcjFISSwg1Fi/bdfLBDOd0aJtiNz mbsYOcGKLkz9wg6R2M0ocWXmByhnOpPEjC9N7CCj2A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U5mBREue9nXcsUkggPbEkNTs1tSC1CCbLxMEp 1cDI/n1i4Tyj0t3PXqvVbVs491TBSfvfVi8zc7wkL88uzu1lmnFvkt5B6y3KJl33pM/wBO5e WDqP8UBT3qx179UZvK28JVVbZXcG5QR03v9pJjc5422moemrH1umsLZmrU6P0Fp2sTmrvVPL Q8D11X8n38VHG6N+b3H59u//S+MplpENM2KXCM1VYinOSDTUYi4qTgQAS7yOxRMCAAA= X-CMS-MailID: 20190417175358epcas1p41a0a4e349dfe0a70bdcc244161c71604 CMS-TYPE: 101P X-CMS-RootMailID: 20190417175358epcas1p41a0a4e349dfe0a70bdcc244161c71604 References: <1555523406-2380-1-git-send-email-joshi.k@samsung.com> Sender: linux-block-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-block@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP 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 = 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. Signed-off-by: Kanchan Joshi --- block/blk-core.c | 20 ++++++++++++++++++++ include/linux/blkdev.h | 1 + 2 files changed, 21 insertions(+) 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; } +enum rw_hint blk_write_hint_to_streamid(struct request *req, + struct bio *bio) +{ + enum rw_hint streamid, nr_streams; + struct request_queue *q = req->q; + nr_streams = q->limits.nr_streams; + + streamid = bio->bi_write_hint; + if (!nr_streams || streamid == WRITE_LIFE_NOT_SET || + streamid == WRITE_LIFE_NONE) + streamid = 0; + else { + --streamid; + if(streamid > nr_streams) + streamid = 0; + } + return streamid; +} + void blk_init_request_from_bio(struct request *req, struct bio *bio) { if (bio->bi_opf & REQ_RAHEAD) @@ -738,6 +757,7 @@ void blk_init_request_from_bio(struct request *req, struct bio *bio) req->__sector = bio->bi_iter.bi_sector; req->ioprio = bio_prio(bio); req->write_hint = bio->bi_write_hint; + req->streamid = blk_write_hint_to_streamid(req, bio); blk_rq_bio_prep(req->q, req, bio); } EXPORT_SYMBOL_GPL(blk_init_request_from_bio); diff --git a/include/linux/blkdev.h b/include/linux/blkdev.h index eb6eb60..7cd1c2d 100644 --- a/include/linux/blkdev.h +++ b/include/linux/blkdev.h @@ -217,6 +217,7 @@ struct request { #endif unsigned short write_hint; + unsigned short streamid; unsigned short ioprio; unsigned int extra_len; /* length of alignment and padding */ From patchwork Wed Apr 17 17:50:04 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kanchan Joshi X-Patchwork-Id: 10905707 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id A28AC922 for ; Wed, 17 Apr 2019 17:54:23 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 8C689289CA for ; Wed, 17 Apr 2019 17:54:23 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 8041728B7B; Wed, 17 Apr 2019 17:54:23 +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=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham 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 214BB289CA for ; Wed, 17 Apr 2019 17:54:23 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1733205AbfDQRyW (ORCPT ); Wed, 17 Apr 2019 13:54:22 -0400 Received: from mailout3.samsung.com ([203.254.224.33]:28413 "EHLO mailout3.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1733279AbfDQRyE (ORCPT ); Wed, 17 Apr 2019 13:54:04 -0400 Received: from epcas2p3.samsung.com (unknown [182.195.41.55]) by mailout3.samsung.com (KnoxPortal) with ESMTP id 20190417175400epoutp039229c55c9036ac787189769926a830bc~WVIKGH-RF3159031590epoutp03B; Wed, 17 Apr 2019 17:54:00 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout3.samsung.com 20190417175400epoutp039229c55c9036ac787189769926a830bc~WVIKGH-RF3159031590epoutp03B DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1555523640; bh=iP0XOFxFxW4dqp5UudF4yA1+ezdoL5xyOuz+dgVM6Tk=; h=From:To:Cc:Subject:Date:In-reply-to:References:From; b=utQTg6aRbKNBBC9fzqCj2hW7USv6659s2321i8+619vSmhLL2jhdOjys5Z6CFOyUr PjErWBJFBEjehKAACrAz93nleSqYTRAajMhSyUSPovD1EIyEJNfJWDA5y9kkRIamBq +NzcyemLet2TAgmlkK8VdDbX3z2DdL1NQgExKdQg= Received: from epsmges2p3.samsung.com (unknown [182.195.42.71]) by epcas2p3.samsung.com (KnoxPortal) with ESMTP id 20190417175400epcas2p38ccb0c4ea4da9aedfb7bf2270190b367~WVIJ0XxbZ1769817698epcas2p3M; Wed, 17 Apr 2019 17:54:00 +0000 (GMT) Received: from epcas2p2.samsung.com ( [182.195.41.54]) by epsmges2p3.samsung.com (Symantec Messaging Gateway) with SMTP id 16.64.04206.83867BC5; Thu, 18 Apr 2019 02:54:00 +0900 (KST) Received: from epsmgms2p2new.samsung.com (unknown [182.195.42.143]) by epcas2p2.samsung.com (KnoxPortal) with ESMTP id 20190417175400epcas2p2b166bfaef69f5a02e856743be76199f3~WVIJci7c93108131081epcas2p2U; Wed, 17 Apr 2019 17:54:00 +0000 (GMT) X-AuditID: b6c32a47-14bff7000000106e-16-5cb76838c683 Received: from epmmp1.local.host ( [203.254.227.16]) by epsmgms2p2new.samsung.com (Symantec Messaging Gateway) with SMTP id D8.EF.03620.73867BC5; Thu, 18 Apr 2019 02:54:00 +0900 (KST) Received: from test-PowerEdge-R720.sa.corp.samsungelectronics.net ([107.108.221.212]) by mmp1.samsung.com (Oracle Communications Messaging Server 7.0.5.31.0 64bit (built May 5 2014)) with ESMTPA id <0PQ4006MF9PFCC30@mmp1.samsung.com>; Thu, 18 Apr 2019 02:53:59 +0900 (KST) From: Kanchan Joshi To: linux-kernel@vger.kernel.org, linux-block@vger.kernel.org, linux-nvme@lists.infradead.org, linux-fsdevel@vger.kernel.org, linux-ext4@vger.kernel.org Cc: prakash.v@samsung.com, Kanchan Joshi Subject: [PATCH v4 5/7] nvme: register stream info with block layer Date: Wed, 17 Apr 2019 23:20:04 +0530 Message-id: <1555523406-2380-6-git-send-email-joshi.k@samsung.com> X-Mailer: git-send-email 2.7.4 In-reply-to: <1555523406-2380-1-git-send-email-joshi.k@samsung.com> X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFupnkeLIzCtJLcpLzFFi42LZdljTTNciY3uMQecXGYuj/9+yWey9pW0x c94dNos9e0+yWFzeNYfNYv6yp+wWV6YsYnZg99i8pN6jb8sqRo/Pm+QCmKO4bFJSczLLUov0 7RK4Mg49+M1c8EW4YmWHQAPjIoEuRk4OCQETiTU7njB3MXJxCAnsYJR41LCWCcL5zihx6O8s VpiqvStnsoHYQgK7GSVmvw6EKJrOJPF4fxNQEQcHm4CmxIXJpSBxEYE5jBLL9k1jBmlgFrCT mPHtNdggYQFnid4H09lBbBYBVYlNT7cwgdi8Ak4Sk57uZ4JYJidx81wnWC8nUP2jK7fYQIZK CPxklbgwZxILRJGLxJs509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jieKtitdlvwiqHqD40O8e28Ke1HdFLHtE8v+O53WLV5z Y+N/e74NX9bO598bKyBSnRD1re2Qv9Ay28nfU5VYijMSDbWYi4oTAS4871MSAgAA X-CMS-MailID: 20190417175400epcas2p2b166bfaef69f5a02e856743be76199f3 CMS-TYPE: 102P X-CMS-RootMailID: 20190417175400epcas2p2b166bfaef69f5a02e856743be76199f3 References: <1555523406-2380-1-git-send-email-joshi.k@samsung.com> Sender: linux-block-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-block@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Make nvme driver register number of streams with block layer. Block layer will use that for write-hint to stream-id conversion. Registration is done for each namespace. Since NVMe spec allow all available streams (within subsystem) to be used by all namespaces, no attempt has been made to add reservation at namespace level. Signed-off-by: Kanchan Joshi --- drivers/nvme/host/core.c | 23 ++++++----------------- 1 file changed, 6 insertions(+), 17 deletions(-) diff --git a/drivers/nvme/host/core.c b/drivers/nvme/host/core.c index 2c43e12..81b86fa 100644 --- a/drivers/nvme/host/core.c +++ b/drivers/nvme/host/core.c @@ -464,10 +464,6 @@ static int nvme_toggle_streams(struct nvme_ctrl *ctrl, bool enable) return nvme_submit_sync_cmd(ctrl->admin_q, &c, NULL, 0); } -static int nvme_disable_streams(struct nvme_ctrl *ctrl) -{ - return nvme_toggle_streams(ctrl, false); -} static int nvme_enable_streams(struct nvme_ctrl *ctrl) { @@ -510,14 +506,7 @@ static int nvme_configure_directives(struct nvme_ctrl *ctrl) return ret; ctrl->nssa = le16_to_cpu(s.nssa); - if (ctrl->nssa < BLK_MAX_WRITE_HINTS - 1) { - dev_info(ctrl->device, "too few streams (%u) available\n", - ctrl->nssa); - nvme_disable_streams(ctrl); - return 0; - } - - ctrl->nr_streams = min_t(unsigned, ctrl->nssa, BLK_MAX_WRITE_HINTS - 1); + ctrl->nr_streams = ctrl->nssa; dev_info(ctrl->device, "Using %u streams\n", ctrl->nr_streams); return 0; } @@ -530,12 +519,9 @@ static void nvme_assign_write_stream(struct nvme_ctrl *ctrl, struct request *req, u16 *control, u32 *dsmgmt) { - enum rw_hint streamid = req->write_hint; + enum rw_hint streamid = req->streamid; - if (streamid == WRITE_LIFE_NOT_SET || streamid == WRITE_LIFE_NONE) - streamid = 0; - else { - streamid--; + if (streamid != 0) { if (WARN_ON_ONCE(streamid > ctrl->nr_streams)) return; @@ -3189,6 +3175,7 @@ static int nvme_setup_streams_ns(struct nvme_ctrl *ctrl, struct nvme_ns *ns) { struct streams_directive_params s; int ret; + u16 nr_streams; if (!ctrl->nr_streams) return 0; @@ -3200,6 +3187,8 @@ static int nvme_setup_streams_ns(struct nvme_ctrl *ctrl, struct nvme_ns *ns) ns->sws = le32_to_cpu(s.sws); ns->sgs = le16_to_cpu(s.sgs); + nr_streams = min_t(unsigned, ctrl->nr_streams, BLK_MAX_WRITE_HINTS - 1); + blk_queue_stream_limits(ns->queue, nr_streams); if (ns->sws) { unsigned int bs = 1 << ns->lba_shift; From patchwork Wed Apr 17 17:50:05 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kanchan Joshi X-Patchwork-Id: 10905701 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id A9350922 for ; Wed, 17 Apr 2019 17:54:19 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 99560289CA for ; Wed, 17 Apr 2019 17:54:19 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 8D70C28B7B; Wed, 17 Apr 2019 17:54:19 +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=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,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 388E9289CA for ; Wed, 17 Apr 2019 17:54:19 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1733298AbfDQRyH (ORCPT ); Wed, 17 Apr 2019 13:54:07 -0400 Received: from mailout1.samsung.com ([203.254.224.24]:49165 "EHLO mailout1.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1733216AbfDQRyG (ORCPT ); Wed, 17 Apr 2019 13:54:06 -0400 Received: from epcas1p2.samsung.com (unknown [182.195.41.46]) by mailout1.samsung.com (KnoxPortal) with ESMTP id 20190417175402epoutp01bb20485114e59ef6cd5e7ad93b5c4067~WVILvwO922230122301epoutp012; Wed, 17 Apr 2019 17:54:02 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout1.samsung.com 20190417175402epoutp01bb20485114e59ef6cd5e7ad93b5c4067~WVILvwO922230122301epoutp012 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1555523642; bh=LslFbD0lwD/9SQNcuMJl+Vtr6HxJKs3jycHzydcCwpE=; h=From:To:Cc:Subject:Date:In-reply-to:References:From; b=Expsd6mcV4X39Er8zOJ41wmvK5P+8cdeTn3hzxPoBKyKtPeKtfzjjMdRdMU0HfwLO 0bjJwS9i9x2iCkPdfMLlG1kcsOBxFbLaZBy2uj3gNFup6cqFaCdT/H5aK1CHoQP+nu ZLYPMeCV3f5dpbZSHmzv/n7Glh4pm15uB+xWIrwY= Received: from epsmges1p3.samsung.com (unknown [182.195.42.55]) by epcas1p3.samsung.com (KnoxPortal) with ESMTP id 20190417175402epcas1p306a6de5194a9d64d7753fc065d456b5b~WVILfkgYe0859308593epcas1p3Y; Wed, 17 Apr 2019 17:54:02 +0000 (GMT) Received: from epcas1p1.samsung.com ( [182.195.41.45]) by epsmges1p3.samsung.com (Symantec Messaging Gateway) with SMTP id 4C.AE.04143.A3867BC5; Thu, 18 Apr 2019 02:54:02 +0900 (KST) Received: from epsmgms2p1new.samsung.com (unknown [182.195.42.142]) by epcas1p4.samsung.com (KnoxPortal) with ESMTP id 20190417175402epcas1p450f2617234aadf24cb4c8ae184d48c68~WVILRlCsI2081320813epcas1p4L; Wed, 17 Apr 2019 17:54:02 +0000 (GMT) X-AuditID: b6c32a37-f19ff7000000102f-a4-5cb7683a1bc7 Received: from epmmp1.local.host ( [203.254.227.16]) by epsmgms2p1new.samsung.com (Symantec Messaging Gateway) with SMTP id 2E.11.03598.93867BC5; Thu, 18 Apr 2019 02:54:02 +0900 (KST) Received: from test-PowerEdge-R720.sa.corp.samsungelectronics.net ([107.108.221.212]) by mmp1.samsung.com (Oracle Communications Messaging Server 7.0.5.31.0 64bit (built May 5 2014)) with ESMTPA id <0PQ4006MF9PFCC30@mmp1.samsung.com>; Thu, 18 Apr 2019 02:54:01 +0900 (KST) From: Kanchan Joshi To: linux-kernel@vger.kernel.org, linux-block@vger.kernel.org, linux-nvme@lists.infradead.org, linux-fsdevel@vger.kernel.org, linux-ext4@vger.kernel.org Cc: prakash.v@samsung.com, Kanchan Joshi Subject: [PATCH v4 6/7] fs: introduce APIs to enable passing write-hint with buffer-head Date: Wed, 17 Apr 2019 23:20:05 +0530 Message-id: <1555523406-2380-7-git-send-email-joshi.k@samsung.com> X-Mailer: git-send-email 2.7.4 In-reply-to: <1555523406-2380-1-git-send-email-joshi.k@samsung.com> X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFprAIsWRmVeSWpSXmKPExsWy7bCmrq5VxvYYg/NnRC2O/n/LZrH3lrbF zHl32Cz27D3JYnF51xw2i/nLnrJbXJmyiNmB3WPzknqPvi2rGD0+b5ILYI7isklJzcksSy3S t0vgyljcv5q54I1wxfK3S9gaGC8KdDFyckgImEjMP/GQsYuRi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NcxZUuMEG9KYmVValF+fFFpTmrxIUZpDhYlcd7beccihQTSE0tSs1NTC1KLYLJMHJxS DYzi58/f32TSffuOa+nKVyunVKcbn//3/vPG15V/FDynMM30W5B97uzWrzmVEzhteVInBurU 7rybU/HuGVN96blME/k99ZP0Tq2Km3r/y/deqy/+PyxthQ4mzdlrn1EVtWoFf7u/7wZ2Tv6p eyrq2Vw8zfQ0Xdx4vmbmXT24LOmghO/8B6I7b4spsRRnJBpqMRcVJwIA1KGVZRMCAAA= X-CMS-MailID: 20190417175402epcas1p450f2617234aadf24cb4c8ae184d48c68 CMS-TYPE: 101P X-CMS-RootMailID: 20190417175402epcas1p450f2617234aadf24cb4c8ae184d48c68 References: <1555523406-2380-1-git-send-email-joshi.k@samsung.com> Sender: linux-block-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-block@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP submit_bh and write_dirty_buffer do not take write-hint as parameter. This introduces variants which do, and pass write-hint to lower layer. Signed-off-by: Kanchan Joshi --- fs/buffer.c | 18 ++++++++++++++++-- include/linux/buffer_head.h | 3 +++ 2 files changed, 19 insertions(+), 2 deletions(-) diff --git a/fs/buffer.c b/fs/buffer.c index ce35760..dc1ea59 100644 --- a/fs/buffer.c +++ b/fs/buffer.c @@ -3105,6 +3105,13 @@ int submit_bh(int op, int op_flags, struct buffer_head *bh) } EXPORT_SYMBOL(submit_bh); +int submit_bh_write_hint(int op, int op_flags, struct buffer_head *bh, + enum rw_hint hint) +{ + return submit_bh_wbc(op, op_flags, bh, hint, NULL); +} +EXPORT_SYMBOL(submit_bh_write_hint); + /** * ll_rw_block: low-level access to block devices (DEPRECATED) * @op: whether to %READ or %WRITE @@ -3162,6 +3169,13 @@ EXPORT_SYMBOL(ll_rw_block); void write_dirty_buffer(struct buffer_head *bh, int op_flags) { + write_dirty_buffer_with_hint(bh, op_flags, 0); +} +EXPORT_SYMBOL(write_dirty_buffer); + +void write_dirty_buffer_with_hint(struct buffer_head *bh, int op_flags, + enum rw_hint hint) +{ lock_buffer(bh); if (!test_clear_buffer_dirty(bh)) { unlock_buffer(bh); @@ -3169,9 +3183,9 @@ void write_dirty_buffer(struct buffer_head *bh, int op_flags) } bh->b_end_io = end_buffer_write_sync; get_bh(bh); - submit_bh(REQ_OP_WRITE, op_flags, bh); + submit_bh_wbc(REQ_OP_WRITE, op_flags, bh, hint, NULL); } -EXPORT_SYMBOL(write_dirty_buffer); +EXPORT_SYMBOL(write_dirty_buffer_with_hint); /* * For a data-integrity writeout, we need to wait upon any in-progress I/O diff --git a/include/linux/buffer_head.h b/include/linux/buffer_head.h index 7b73ef7..3d682ac 100644 --- a/include/linux/buffer_head.h +++ b/include/linux/buffer_head.h @@ -200,7 +200,10 @@ void ll_rw_block(int, int, int, struct buffer_head * bh[]); int sync_dirty_buffer(struct buffer_head *bh); int __sync_dirty_buffer(struct buffer_head *bh, int op_flags); void write_dirty_buffer(struct buffer_head *bh, int op_flags); +void write_dirty_buffer_with_hint(struct buffer_head *bh, int op_flags, + enum rw_hint hint); int submit_bh(int, int, struct buffer_head *); +int submit_bh_write_hint(int, int, struct buffer_head *, enum rw_hint hint); void write_boundary_block(struct block_device *bdev, sector_t bblock, unsigned blocksize); int bh_uptodate_or_lock(struct buffer_head *bh); From patchwork Wed Apr 17 17:50:06 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kanchan Joshi X-Patchwork-Id: 10905697 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 1CEC513B5 for ; Wed, 17 Apr 2019 17:54:17 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 0D71B289CA for ; Wed, 17 Apr 2019 17:54:17 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 014FA28B7B; Wed, 17 Apr 2019 17:54:16 +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=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,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 88314289CA for ; Wed, 17 Apr 2019 17:54:16 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1733306AbfDQRyK (ORCPT ); Wed, 17 Apr 2019 13:54:10 -0400 Received: from mailout2.samsung.com ([203.254.224.25]:19389 "EHLO mailout2.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1733270AbfDQRyH (ORCPT ); Wed, 17 Apr 2019 13:54:07 -0400 Received: from epcas2p1.samsung.com (unknown [182.195.41.53]) by mailout2.samsung.com (KnoxPortal) with ESMTP id 20190417175404epoutp0288c2fbb7ca6af33bd277708600d09162~WVINqVbF00937009370epoutp02a; Wed, 17 Apr 2019 17:54:04 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout2.samsung.com 20190417175404epoutp0288c2fbb7ca6af33bd277708600d09162~WVINqVbF00937009370epoutp02a DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1555523644; bh=C76dKk0NmGHl/Qu5kKDvvmvO7y5dIxg97utO9LWSE00=; h=From:To:Cc:Subject:Date:In-reply-to:References:From; b=gobsLPViFWW1QCh76rBkz9VUva+tHQTkAHLWfnqJfEt2VQeTqga40ps/uXfD9vYte TKZaGupcioY/yguegS6L2PShuTE+GGvVaef8wBup0SRUpLneK8FSwbfXraFw34W6kb yyucSUIQs/f6edb+TFZu1YXBCtgmG2pj+f6Jvus4= Received: from epsmges2p4.samsung.com (unknown [182.195.42.72]) by epcas2p2.samsung.com (KnoxPortal) with ESMTP id 20190417175404epcas2p24c94ad70bd5598a486988dde7e5b5cf3~WVINZ8aPP0324203242epcas2p2O; Wed, 17 Apr 2019 17:54:04 +0000 (GMT) Received: from epcas2p4.samsung.com ( [182.195.41.56]) by epsmges2p4.samsung.com (Symantec Messaging Gateway) with SMTP id 30.68.04207.C3867BC5; Thu, 18 Apr 2019 02:54:04 +0900 (KST) Received: from epsmgms2p2new.samsung.com (unknown [182.195.42.143]) by epcas2p1.samsung.com (KnoxPortal) with ESMTP id 20190417175404epcas2p1380bc5b15bd1e3c09866765c581a34c3~WVINFF7xW1198411984epcas2p1c; Wed, 17 Apr 2019 17:54:04 +0000 (GMT) X-AuditID: b6c32a48-6a1ff7000000106f-01-5cb7683cfe84 Received: from epmmp1.local.host ( [203.254.227.16]) by epsmgms2p2new.samsung.com (Symantec Messaging Gateway) with SMTP id 59.EF.03620.B3867BC5; Thu, 18 Apr 2019 02:54:04 +0900 (KST) Received: from test-PowerEdge-R720.sa.corp.samsungelectronics.net ([107.108.221.212]) by mmp1.samsung.com (Oracle Communications Messaging Server 7.0.5.31.0 64bit (built May 5 2014)) with ESMTPA id <0PQ4006MF9PFCC30@mmp1.samsung.com>; Thu, 18 Apr 2019 02:54:03 +0900 (KST) From: Kanchan Joshi To: linux-kernel@vger.kernel.org, linux-block@vger.kernel.org, linux-nvme@lists.infradead.org, linux-fsdevel@vger.kernel.org, linux-ext4@vger.kernel.org Cc: prakash.v@samsung.com, Kanchan Joshi Subject: [PATCH v4 7/7] fs/ext4,jbd2: add support for sending write-hint with journal Date: Wed, 17 Apr 2019 23:20:06 +0530 Message-id: <1555523406-2380-8-git-send-email-joshi.k@samsung.com> X-Mailer: git-send-email 2.7.4 In-reply-to: <1555523406-2380-1-git-send-email-joshi.k@samsung.com> X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFprAIsWRmVeSWpSXmK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Gd9eg9nCAuESu54sZAexWQRUJQ5tOg0W 5xVwkniwpIkNYpucxM1zncwgNqeAs8SjK7fA4kJANadX/WGfwMizgJFhFaNkakFxbnpusVGB UV5quV5xYm5xaV66XnJ+7iZGYLBsO6zVv4Px8ZL4Q4wCHIxKPLwrVLfHCLEmlhVX5h5ilOBg VhLhdUzZEiPEm5JYWZValB9fVJqTWnyIUZqDRUmclz//WKSQQHpiSWp2ampBahFMlomDU6qB kf9Cj9idz4uWpbl82b5R3+f+3weWP7eoCz0sWT19wxnP31Hr/tXVrDwi0zddYnny+umTdr1S WVW0u9zvTGN0/g5DZ6FTOtpzpLLXFjw4d3Nb8Dx23stcWytnmjz6dTpsQ/iSx4ed+XZurZlp f2FV4ZFHYY8956avPcc6f/0H1vC5OpUs8qdPN29WYinOSDTUYi4qTgQAkhwY3BICAAA= X-CMS-MailID: 20190417175404epcas2p1380bc5b15bd1e3c09866765c581a34c3 CMS-TYPE: 102P X-CMS-RootMailID: 20190417175404epcas2p1380bc5b15bd1e3c09866765c581a34c3 References: <1555523406-2380-1-git-send-email-joshi.k@samsung.com> Sender: linux-block-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-block@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP For NAND based SSDs, mixing of data with different life-time reduces efficiency of internal garbage-collection. During FS operations, series of journal updates will follow/precede series of data/meta updates, causing intermixing inside SSD. By passing a write-hint with journal, its write can be isolated from other data/meta writes, leading to endurance/performance benefit on SSD. This patch introduces "j_writehint" member in JBD2 journal, using which Ext4 specifies write-hint for journal. Signed-off-by: Kanchan Joshi --- fs/ext4/ext4_jbd2.h | 1 + fs/ext4/super.c | 2 ++ fs/jbd2/commit.c | 11 +++++++---- fs/jbd2/journal.c | 3 ++- fs/jbd2/revoke.c | 3 ++- include/linux/jbd2.h | 8 ++++++++ 6 files changed, 22 insertions(+), 6 deletions(-) diff --git a/fs/ext4/ext4_jbd2.h b/fs/ext4/ext4_jbd2.h index 75a5309..ade47b2 100644 --- a/fs/ext4/ext4_jbd2.h +++ b/fs/ext4/ext4_jbd2.h @@ -16,6 +16,7 @@ #include #include "ext4.h" +#define EXT4_JOURNAL_WRITE_HINT (WRITE_LIFE_KERN_MIN) #define EXT4_JOURNAL(inode) (EXT4_SB((inode)->i_sb)->s_journal) /* Define the number of blocks we need to account to a transaction to diff --git a/fs/ext4/super.c b/fs/ext4/super.c index 6ed4eb8..238c0b5 100644 --- a/fs/ext4/super.c +++ b/fs/ext4/super.c @@ -4298,6 +4298,8 @@ static int ext4_fill_super(struct super_block *sb, void *data, int silent) set_task_ioprio(sbi->s_journal->j_task, journal_ioprio); + sbi->s_journal->j_writehint = EXT4_JOURNAL_WRITE_HINT; + sbi->s_journal->j_commit_callback = ext4_journal_commit_callback; no_journal: diff --git a/fs/jbd2/commit.c b/fs/jbd2/commit.c index efd0ce9..be3a0b9 100644 --- a/fs/jbd2/commit.c +++ b/fs/jbd2/commit.c @@ -153,10 +153,12 @@ static int journal_submit_commit_record(journal_t *journal, if (journal->j_flags & JBD2_BARRIER && !jbd2_has_feature_async_commit(journal)) - ret = submit_bh(REQ_OP_WRITE, - REQ_SYNC | REQ_PREFLUSH | REQ_FUA, bh); + ret = submit_bh_write_hint(REQ_OP_WRITE, + REQ_SYNC | REQ_PREFLUSH | REQ_FUA, bh, + journal->j_writehint); else - ret = submit_bh(REQ_OP_WRITE, REQ_SYNC, bh); + ret = submit_bh_write_hint(REQ_OP_WRITE, REQ_SYNC, bh, + journal->j_writehint); *cbh = bh; return ret; @@ -713,7 +715,8 @@ void jbd2_journal_commit_transaction(journal_t *journal) clear_buffer_dirty(bh); set_buffer_uptodate(bh); bh->b_end_io = journal_end_buffer_io_sync; - submit_bh(REQ_OP_WRITE, REQ_SYNC, bh); + submit_bh_write_hint(REQ_OP_WRITE, REQ_SYNC, + bh, journal->j_writehint); } cond_resched(); stats.run.rs_blocks_logged += bufs; diff --git a/fs/jbd2/journal.c b/fs/jbd2/journal.c index 382c030..6dc7c9a 100644 --- a/fs/jbd2/journal.c +++ b/fs/jbd2/journal.c @@ -1372,7 +1372,8 @@ static int jbd2_write_superblock(journal_t *journal, int write_flags) sb->s_checksum = jbd2_superblock_csum(journal, sb); get_bh(bh); bh->b_end_io = end_buffer_write_sync; - ret = submit_bh(REQ_OP_WRITE, write_flags, bh); + ret = submit_bh_write_hint(REQ_OP_WRITE, write_flags, bh, + journal->j_writehint); wait_on_buffer(bh); if (buffer_write_io_error(bh)) { clear_buffer_write_io_error(bh); diff --git a/fs/jbd2/revoke.c b/fs/jbd2/revoke.c index a1143e5..376b1d8 100644 --- a/fs/jbd2/revoke.c +++ b/fs/jbd2/revoke.c @@ -642,7 +642,8 @@ static void flush_descriptor(journal_t *journal, set_buffer_jwrite(descriptor); BUFFER_TRACE(descriptor, "write"); set_buffer_dirty(descriptor); - write_dirty_buffer(descriptor, REQ_SYNC); + write_dirty_buffer_with_hint(descriptor, REQ_SYNC, + journal->j_writehint); } #endif diff --git a/include/linux/jbd2.h b/include/linux/jbd2.h index 0f919d5..918f21e 100644 --- a/include/linux/jbd2.h +++ b/include/linux/jbd2.h @@ -1139,6 +1139,14 @@ struct journal_s */ __u32 j_csum_seed; + /** + * @j_writehint: + * + * write-hint for journal (set by FS). + */ + enum rw_hint j_writehint; + + #ifdef CONFIG_DEBUG_LOCK_ALLOC /** * @j_trans_commit_map: