From patchwork Thu Apr 25 11:19:56 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kanchan Joshi X-Patchwork-Id: 1090709 Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=vger.kernel.org (client-ip=209.132.180.67; helo=vger.kernel.org; envelope-from=linux-ext4-owner@vger.kernel.org; receiver=) Authentication-Results: ozlabs.org; dmarc=pass (p=none dis=none) header.from=samsung.com Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=samsung.com header.i=@samsung.com header.b="P5BvpAb7"; dkim-atps=neutral Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 44qZZS5Jwrz9s9T for ; Thu, 25 Apr 2019 21:24:00 +1000 (AEST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730896AbfDYLXz (ORCPT ); Thu, 25 Apr 2019 07:23:55 -0400 Received: from mailout1.samsung.com ([203.254.224.24]:30641 "EHLO mailout1.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727416AbfDYLXy (ORCPT ); Thu, 25 Apr 2019 07:23:54 -0400 Received: from epcas2p4.samsung.com (unknown [182.195.41.56]) by mailout1.samsung.com (KnoxPortal) with ESMTP id 20190425112351epoutp01f595b58953eedcf27a9a3c16b2d10d76~Ys9y9mY021904819048epoutp01b; Thu, 25 Apr 2019 11:23:51 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout1.samsung.com 20190425112351epoutp01f595b58953eedcf27a9a3c16b2d10d76~Ys9y9mY021904819048epoutp01b DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1556191431; bh=AW0YDDi+9LxgJJQEsuX274rekHmOC8F5v9v1EvGolgI=; h=From:To:Cc:Subject:Date:In-reply-to:References:From; b=P5BvpAb7RzoNy3TvxA834wqD9+mT1wXJrxinIC8eSvLaCYe+eB+VR6ZHDonJxvLRU QRppgQeT/bAoHZl1h1lUvkzyGkmu3OA9cyGpxDTO/038PTLKnOxk6jzgdDLIK1maKd WE6tL7jSOXFAR1h59nYAwhlpkM/zyQz09zHXvVdQ= Received: from epsmges2p4.samsung.com (unknown [182.195.42.72]) by epcas2p1.samsung.com (KnoxPortal) with ESMTP id 20190425112351epcas2p1f2722ccc0f8098dea956c5b95ed0737f~Ys9yeHBFV2287122871epcas2p1m; Thu, 25 Apr 2019 11:23:51 +0000 (GMT) Received: from epcas2p1.samsung.com ( [182.195.41.53]) by epsmges2p4.samsung.com (Symantec Messaging Gateway) with SMTP id 01.9C.04207.7C891CC5; Thu, 25 Apr 2019 20:23:51 +0900 (KST) Received: from epsmgms2p2new.samsung.com (unknown [182.195.42.143]) by epcas2p2.samsung.com (KnoxPortal) with ESMTP id 20190425112351epcas2p209fdb12872bdcdcb11afd7b6e196b85e~Ys9yTzvDF3134131341epcas2p2i; Thu, 25 Apr 2019 11:23:51 +0000 (GMT) X-AuditID: b6c32a48-689ff7000000106f-79-5cc198c7b760 Received: from epmmp2 ( [203.254.227.17]) by epsmgms2p2new.samsung.com (Symantec Messaging Gateway) with SMTP id F6.4D.03620.7C891CC5; Thu, 25 Apr 2019 20:23:51 +0900 (KST) Received: from test-PowerEdge-R720.sa.corp.samsungelectronics.net ([107.108.221.212]) by mmp2.samsung.com (Oracle Communications Messaging Server 7.0.5.31.0 64bit (built May 5 2014)) with ESMTPA id <0PQI007Z2KZ7JR40@mmp2.samsung.com>; Thu, 25 Apr 2019 20:23:50 +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, anshul@samsung.com, Kanchan Joshi Subject: [PATCH v5 1/7] fs: introduce write-hint start point for in-kernel hints Date: Thu, 25 Apr 2019 16:49:56 +0530 Message-id: <1556191202-3245-2-git-send-email-joshi.k@samsung.com> X-Mailer: git-send-email 2.7.4 In-reply-to: <1556191202-3245-1-git-send-email-joshi.k@samsung.com> X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFprMIsWRmVeSWpSXmKPExsWy7bCmqe7xGQdjDK4uFrP4PX0Kq8XR/2/Z LPbe0raYOe8Om8WevSdZLC7vmsNmMX/ZU3aLK1MWMTtweGxeUu/Rt2UVo8fnTXIBzFFcNimp OZllqUX6dglcGR1dN1kKFrJW9DTMZGxgXMfSxcjJISFgIjFl2nYgm4tDSGAHo0TXiteMEM53 RokZRzqYYaoOLfvJDmILCWxglJi+zhqiaDqTxP15r9m6GDk42AQ0JS5MLgWJiwjMYZRYtm8a WDOzQIjEiierWEBqhAWCJI4uDwUJswioSjzYdAOshFfASeLc2jZGiF1yEjfPdYLFOQWcJV78 eMYEEW9kk3h30BPCdpHY/vIcO4QtLfFs1Uao3mKJX3eOMoPcICHQwShxvWEm1Jv2Ehf3/GWC uIdPouPwX3aQeyQEeCU62oQgSjwk7m7fzgrx1zRGiTX71zBPYJRYwMiwilEstaA4Nz212KjA RK84Mbe4NC9dLzk/dxMjOKq0PHYwHjjnc4hRgINRiYdXIfJAjBBrYllxZe4hRgkOZiURXnXT gzFCvCmJlVWpRfnxRaU5qcWHGKU5WJTEeR9Kz40WEkhPLEnNTk0tSC2CyTJxcEo1ME6R0We1 SZy6Sv52RuCEPMlHxhH/PB//f7Zl05876hytIXpF4ekG35hkJsy6aOz2knVd6dm/K/jDVr19 8jyqe9ohgQ+rGQ/NlChd8Chh1tzHXZPuMIrt3+X220JE2OXU9gWcDnZ75r9IcOe8YZJY2VfI M/fBOfd9s0PXdntxOd/4JNmxY9nHsG1KLMUZiYZazEXFiQBhA6SepgIAAA== X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFmplluLIzCtJLcpLzFFi42I5/e+xoO7xGQdjDB78Z7f4PX0Kq8XR/2/Z LPbe0raYOe8Om8WevSdZLC7vmsNmMX/ZU3aLK1MWMTtweGxeUu/Rt2UVo8fnTXIBzFFcNimp OZllqUX6dglcGR1dN1kKFrJW9DTMZGxgXMfSxcjJISFgInFo2U/2LkYuDiGBdYwSXXv72CCc mUwSTa+eATkcHGwCmhIXJpeCxEUE5jBK9OxezwrSzSwQIjHr2WM2EFtYIEDiwMMesDiLgKrE g003mEFsXgEniXNr2xghtslJ3DzXCRbnFHCWePHjGROILQRUc23aJvYJjDwLGBlWMUqmFhTn pucWGxUY5aWW6xUn5haX5qXrJefnbmIEBs62w1r9OxgfL4k/xCjAwajEw6sQeSBGiDWxrLgy 9xCjBAezkgivuunBGCHelMTKqtSi/Pii0pzU4kOM0hwsSuK8/PnHIoUE0hNLUrNTUwtSi2Cy TBycUg2Mil0CC3+pfjRlEjrJfEp/xVbbaXbrAnnXBwcqruz48+GllNZJnY12dw9IPbT+fvhz 95QX271qRbyfnYk3M2HteyV+UPb7OQmB63e5DadkrfIw/dEcpt/yTOnohHktuuJSJ6Lf8Ur/ c5j27avU53dJfwoLDTvne0378Vxp/hm+pVfir36X6FI1U2Ipzkg01GIuKk4EAPXffksYAgAA X-CMS-MailID: 20190425112351epcas2p209fdb12872bdcdcb11afd7b6e196b85e CMS-TYPE: 102P X-CMS-RootMailID: 20190425112351epcas2p209fdb12872bdcdcb11afd7b6e196b85e References: <1556191202-3245-1-git-send-email-joshi.k@samsung.com> Sender: linux-ext4-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-ext4@vger.kernel.org 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 Thu Apr 25 11:19:57 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kanchan Joshi X-Patchwork-Id: 1090715 Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=vger.kernel.org (client-ip=209.132.180.67; helo=vger.kernel.org; envelope-from=linux-ext4-owner@vger.kernel.org; receiver=) Authentication-Results: ozlabs.org; dmarc=pass (p=none dis=none) header.from=samsung.com Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=samsung.com header.i=@samsung.com header.b="hPwRA2z/"; dkim-atps=neutral Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 44qZbL49K0z9sD4 for ; Thu, 25 Apr 2019 21:24:46 +1000 (AEST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730921AbfDYLYA (ORCPT ); Thu, 25 Apr 2019 07:24:00 -0400 Received: from mailout2.samsung.com ([203.254.224.25]:54309 "EHLO mailout2.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727416AbfDYLYA (ORCPT ); Thu, 25 Apr 2019 07:24:00 -0400 Received: from epcas2p2.samsung.com (unknown [182.195.41.54]) by mailout2.samsung.com (KnoxPortal) with ESMTP id 20190425112356epoutp0241c59a3d1d9bb5101b36ed6214063732~Ys93cum5Q1144111441epoutp02Y; Thu, 25 Apr 2019 11:23:56 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout2.samsung.com 20190425112356epoutp0241c59a3d1d9bb5101b36ed6214063732~Ys93cum5Q1144111441epoutp02Y DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1556191436; bh=a2P0lf+DiayoNKdNvyjb4q1Kc0v/LfWtzOzEep8KjgU=; h=From:To:Cc:Subject:Date:In-reply-to:References:From; b=hPwRA2z/bhnm9RYLLODycRwErUA1v2MIjW8Ukk5UMGPli1mDJo/cGTn88QbFOJGXO 3RBr+ySnnMnwR81HgcJd92PhsGj4eHN6zRy1hOMdUWVVQVuJnmOalNBdJVWkdN8+uE +7byW7KT+TQ1SMwXBNEeYUMplpDW+XqM3V7PAYd8= Received: from epsmges2p4.samsung.com (unknown [182.195.42.72]) by epcas2p3.samsung.com (KnoxPortal) with ESMTP id 20190425112355epcas2p3f4375e6c54426beaa92f424d5a4df42d~Ys92lI5MA3170231702epcas2p3O; Thu, 25 Apr 2019 11:23:55 +0000 (GMT) Received: from epcas2p4.samsung.com ( [182.195.41.56]) by epsmges2p4.samsung.com (Symantec Messaging Gateway) with SMTP id A3.9C.04207.BC891CC5; Thu, 25 Apr 2019 20:23:55 +0900 (KST) Received: from epsmgms2p2new.samsung.com (unknown [182.195.42.143]) by epcas2p1.samsung.com (KnoxPortal) with ESMTP id 20190425112355epcas2p11e197c8fc33698feb7150d1f4148407e~Ys92Unmtp1705417054epcas2p17; Thu, 25 Apr 2019 11:23:55 +0000 (GMT) X-AuditID: b6c32a48-689ff7000000106f-7f-5cc198cbbdef Received: from epmmp2 ( [203.254.227.17]) by epsmgms2p2new.samsung.com (Symantec Messaging Gateway) with SMTP id 87.4D.03620.BC891CC5; Thu, 25 Apr 2019 20:23:55 +0900 (KST) Received: from test-PowerEdge-R720.sa.corp.samsungelectronics.net ([107.108.221.212]) by mmp2.samsung.com (Oracle Communications Messaging Server 7.0.5.31.0 64bit (built May 5 2014)) with ESMTPA id <0PQI007Z2KZ7JR40@mmp2.samsung.com>; Thu, 25 Apr 2019 20:23: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, anshul@samsung.com, Kanchan Joshi Subject: [PATCH v5 2/7] block: increase stream count for in-kernel use Date: Thu, 25 Apr 2019 16:49:57 +0530 Message-id: <1556191202-3245-3-git-send-email-joshi.k@samsung.com> X-Mailer: git-send-email 2.7.4 In-reply-to: <1556191202-3245-1-git-send-email-joshi.k@samsung.com> X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFprKIsWRmVeSWpSXmKPExsWy7bCmhe7pGQdjDA7c0bb4PX0Kq8XR/2/Z LPbe0raYOe8Om8WevSdZLC7vmsNmMX/ZU3aLK1MWMTtweGxeUu/Rt2UVo8fnTXIBzFFcNimp OZllqUX6dglcGXue/GcsOMpacabpBGsD40mWLkZODgkBE4mbK78ydTFycQgJ7GCUeP7yHwuE 851RomvBMXaYqi+3+qGqNjBK7FhzmxnCmc4ksfv5dKAWDg42AU2JC5NLQeIiAnMYJZbtm8YM 0s0sECKx4skqsBphATeJvgtVIGEWAVWJ17c2sYLYvAJOEs2NX1khlslJ3DzXCdbKKeAs8eLH M7DFEgKNbBIfd3dCFblIvFqykgnClpZ4tmojI4RdLPHrzlFmiIYORonrDTOhHrWXuLjnLxPE QXwSHYf/soMcJCHAK9HRJgRR4iEx++lKqMemMUq8m7SYbQKjxAJGhlWMYqkFxbnpqcVGBSZ6 xYm5xaV56XrJ+bmbGMGRpeWxg/HAOZ9DjAIcjEo8vAqRB2KEWBPLiitzDzFKcDArifCqmx6M EeJNSaysSi3Kjy8qzUktPsQozcGiJM77UHputJBAemJJanZqakFqEUyWiYNTqoFRqbC80bzd cUL/Z47N8m8uGm5bK3L+5vNrM00sUlc0XhV5mNqSwvX80WeBUyeYX3yIlnzw9J7V2+bYhi0V vcy2O8OufZm/d8Px1wkKrsXtD61vzHrzWenl+eaVv2NXB25pzHk6+frDN7OXNnEHrXW7H/GI 28js84et3zUWWqzhTd17vav1tv+tm0osxRmJhlrMRcWJANU/jFWoAgAA X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFmphluLIzCtJLcpLzFFi42I5/e+xoO7pGQdjDA7dlbH4PX0Kq8XR/2/Z LPbe0raYOe8Om8WevSdZLC7vmsNmMX/ZU3aLK1MWMTtweGxeUu/Rt2UVo8fnTXIBzFFcNimp OZllqUX6dglcGXue/GcsOMpacabpBGsD40mWLkZODgkBE4kvt/qZuhi5OIQE1jFK/H1wlQ3C mckkcWz5OiCHg4NNQFPiwuRSkLiIwBxGiZ7d61lBupkFQiRmPXsMViMs4CbRd6EKJMwioCrx +tYmsBJeASeJ5savrBDL5CRunutkBrE5BZwlXvx4xgRiCwHVXJu2iX0CI88CRoZVjJKpBcW5 6bnFRgVGeanlesWJucWleel6yfm5mxiBYbPtsFb/DsbHS+IPMQpwMCrx8CpEHogRYk0sK67M PcQowcGsJMKrbnowRog3JbGyKrUoP76oNCe1+BCjNAeLkjgvf/6xSCGB9MSS1OzU1ILUIpgs EwenVAOj5CyWp/G1y43lX7fOfP3Ob7pTUerH9pnzOtwMpW2TGFOCDiVFqPWvbVSXW8di+sWh YvGhVf+2FW9t7Wku6tdQN/bbPZPDqrvHKPTSVzOu3y77jZIeCIgcSnPun/GE0XTRv3gZd6aH J40u7Kzh2SH/6qtm5+m1B7/Z5OhsTlFddf/+Xr25soeVWIozEg21mIuKEwE2tYWXFwIAAA== X-CMS-MailID: 20190425112355epcas2p11e197c8fc33698feb7150d1f4148407e CMS-TYPE: 102P X-CMS-RootMailID: 20190425112355epcas2p11e197c8fc33698feb7150d1f4148407e References: <1556191202-3245-1-git-send-email-joshi.k@samsung.com> Sender: linux-ext4-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-ext4@vger.kernel.org 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 317ab30..2826225 100644 --- a/include/linux/blkdev.h +++ b/include/linux/blkdev.h @@ -565,7 +565,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 Thu Apr 25 11:19:58 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kanchan Joshi X-Patchwork-Id: 1090710 Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=vger.kernel.org (client-ip=209.132.180.67; helo=vger.kernel.org; envelope-from=linux-ext4-owner@vger.kernel.org; receiver=) Authentication-Results: ozlabs.org; dmarc=pass (p=none dis=none) header.from=samsung.com Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=samsung.com header.i=@samsung.com header.b="rKK8QIMb"; dkim-atps=neutral Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 44qZZb19Ggz9s9y for ; Thu, 25 Apr 2019 21:24:06 +1000 (AEST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730942AbfDYLYC (ORCPT ); Thu, 25 Apr 2019 07:24:02 -0400 Received: from mailout4.samsung.com ([203.254.224.34]:33259 "EHLO mailout4.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730913AbfDYLYB (ORCPT ); Thu, 25 Apr 2019 07:24:01 -0400 Received: from epcas1p4.samsung.com (unknown [182.195.41.48]) by mailout4.samsung.com (KnoxPortal) with ESMTP id 20190425112359epoutp04655bdbd95c99277ee127d522430461f2~Ys95zQs4S0936909369epoutp04h; Thu, 25 Apr 2019 11:23:59 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout4.samsung.com 20190425112359epoutp04655bdbd95c99277ee127d522430461f2~Ys95zQs4S0936909369epoutp04h DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1556191439; bh=KLOEKjb5V5E+T1HtUcoX4RHlie7JdKqebqAxB4h+Ixw=; h=From:To:Cc:Subject:Date:In-reply-to:References:From; b=rKK8QIMbjRaNrbD0uYlU7ZyFFoZbdVig7RvapLtWC+5C1KKwF9OAHZNTCvmTJuq5E iw/5yXQsDPbKEu1bP++k6q8ZGaGRM/2o8JtGXBhDGF2dJ8BT+RtKCIKVqCkSTNHfdK 2JMDhd5m1nuanjJij5C6ysDma0H5iDJ7r2cZ3RWw= Received: from epsmges1p3.samsung.com (unknown [182.195.42.55]) by epcas1p1.samsung.com (KnoxPortal) with ESMTP id 20190425112358epcas1p1a77b97033ef3e40fad5746b6919d9d3f~Ys95YKGMe2830228302epcas1p1R; Thu, 25 Apr 2019 11:23:58 +0000 (GMT) Received: from epcas1p2.samsung.com ( [182.195.41.46]) by epsmges1p3.samsung.com (Symantec Messaging Gateway) with SMTP id A4.9E.04143.EC891CC5; Thu, 25 Apr 2019 20:23:58 +0900 (KST) Received: from epsmgms2p1new.samsung.com (unknown [182.195.42.142]) by epcas1p1.samsung.com (KnoxPortal) with ESMTP id 20190425112358epcas1p13da4f182241366c309cb2c76df3fb048~Ys95AHiQQ3094630946epcas1p1z; Thu, 25 Apr 2019 11:23:58 +0000 (GMT) X-AuditID: b6c32a37-f31ff7000000102f-28-5cc198ce5896 Received: from epmmp2 ( [203.254.227.17]) by epsmgms2p1new.samsung.com (Symantec Messaging Gateway) with SMTP id 6D.BF.03598.EC891CC5; Thu, 25 Apr 2019 20:23:58 +0900 (KST) Received: from test-PowerEdge-R720.sa.corp.samsungelectronics.net ([107.108.221.212]) by mmp2.samsung.com (Oracle Communications Messaging Server 7.0.5.31.0 64bit (built May 5 2014)) with ESMTPA id <0PQI007Z2KZ7JR40@mmp2.samsung.com>; Thu, 25 Apr 2019 20:23:58 +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, anshul@samsung.com, Kanchan Joshi Subject: [PATCH v5 3/7] block: introduce API to register stream information with block-layer Date: Thu, 25 Apr 2019 16:49:58 +0530 Message-id: <1556191202-3245-4-git-send-email-joshi.k@samsung.com> X-Mailer: git-send-email 2.7.4 In-reply-to: <1556191202-3245-1-git-send-email-joshi.k@samsung.com> X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFprMIsWRmVeSWpSXmKPExsWy7bCmnu65GQdjDN5f1bX4PX0Kq8XR/2/Z LPbe0raYOe8Om8WevSdZLC7vmsNmMX/ZU3aLK1MWMTtweGxeUu/Rt2UVo8fnTXIBzFFcNimp OZllqUX6dglcGRumb2QsWM9f8X31KpYGxp88XYycHBICJhLdR5ewdjFycQgJ7GCU+HTnKTtI QkjgO6PEvtWVMEWT/p5ngSjawChx8fpmNghnOpPE9lcdQBkODjYBTYkLk0tB4iICcxgllu2b xgzSzSwQIrHiySoWEFtYIE7iV/dBMJtFQFXiy5HdYNt4BZwkXu34xQqxTU7i5rlOsF5OAWeJ Fz+eMYEMlRDoYZOYdfAzI0SRi8Tki0eZQBZLCEhLXDpqCxEulvh15ygzRH0Ho8T1hpksEAl7 iYt7/jJBHMQn8e5rDytEL69ER5sQhOkh8WmmPsRf04Babzxlm8AosYCRYRWjWGpBcW56arFh gbFecWJucWleul5yfu4mRnBUaZnvYNxwzucQowAHoxIPr0LkgRgh1sSy4srcQ4wSHMxKIrzq pgdjhHhTEiurUovy44tKc1KLDzFKc7AoifOud3COERJITyxJzU5NLUgtgskycXBKNTD2brP1 VRa1vcoe++gcf+KFzhemHw395K9KWu9/uDhxZ6X2SW99374w/sQvR48vd2A8wBd/SuHIdxOh mJzQtp8fC7b/zMpuvuZ/U7Pk3LQjq9ZrOjC7y13rW/729CP5/ogt5vt4dMIVpW3srNvu7V4t tDHR586ECT6nGsTuPX9qo5V2bMF5yzdKLMUZiYZazEXFiQB+MoyApgIAAA== X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFmplluLIzCtJLcpLzFFi42I5/e+xoO65GQdjDNY9FLT4PX0Kq8XR/2/Z LPbe0raYOe8Om8WevSdZLC7vmsNmMX/ZU3aLK1MWMTtweGxeUu/Rt2UVo8fnTXIBzFFcNimp OZllqUX6dglcGRumb2QsWM9f8X31KpYGxp88XYycHBICJhKT/p5n6WLk4hASWMco8er5GVYI ZyaTxIkr19i6GDk42AQ0JS5MLgWJiwjMYZTo2b2eFaSbWSBEYtazx2wgtrBAnMSv7oMsIDaL gKrElyO72UFsXgEniVc7frFCbJOTuHmukxnE5hRwlnjx4xkTiC0EVHNt2ib2CYw8CxgZVjFK phYU56bnFhsVGOallusVJ+YWl+al6yXn525iBAbOtsNafTsY7y+JP8QowMGoxMN7IfZAjBBr YllxZe4hRgkOZiURXnXTgzFCvCmJlVWpRfnxRaU5qcWHGKU5WJTEeW/nHYsUEkhPLEnNTk0t SC2CyTJxcEo1MKqKHRMwVcmc+M3TVWPD298sO2VmuxjeP2LAZrTl4+SNB05kxCtZV2rmt+ZK P328+9Waq5fFP0v+rbq3Rtgge+KXacrJKR6cS7qe9n9ZYnptx/WJk344a23dYPNW6e3EC/Iu JtXNe7Y92GoRrin19qd2h80Rlvt37q+L/Nn0eJ+Td8Lutsv1McVKLMUZiYZazEXFiQDt5mUU GAIAAA== X-CMS-MailID: 20190425112358epcas1p13da4f182241366c309cb2c76df3fb048 CMS-TYPE: 101P X-CMS-RootMailID: 20190425112358epcas1p13da4f182241366c309cb2c76df3fb048 References: <1556191202-3245-1-git-send-email-joshi.k@samsung.com> Sender: linux-ext4-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-ext4@vger.kernel.org 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 2826225..5b6cb9747 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 @@ -1064,6 +1065,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 Thu Apr 25 11:19:59 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kanchan Joshi X-Patchwork-Id: 1090714 Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=vger.kernel.org (client-ip=209.132.180.67; helo=vger.kernel.org; envelope-from=linux-ext4-owner@vger.kernel.org; receiver=) Authentication-Results: ozlabs.org; dmarc=pass (p=none dis=none) header.from=samsung.com Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=samsung.com header.i=@samsung.com header.b="AAYrDUkT"; dkim-atps=neutral Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 44qZbD3gnJz9sB8 for ; Thu, 25 Apr 2019 21:24:40 +1000 (AEST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2387776AbfDYLYf (ORCPT ); Thu, 25 Apr 2019 07:24:35 -0400 Received: from mailout1.samsung.com ([203.254.224.24]:30678 "EHLO mailout1.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2387545AbfDYLYE (ORCPT ); Thu, 25 Apr 2019 07:24:04 -0400 Received: from epcas1p2.samsung.com (unknown [182.195.41.46]) by mailout1.samsung.com (KnoxPortal) with ESMTP id 20190425112401epoutp0154f3efce8b08a5c57f52a4872319583e~Ys976J_2g1904819048epoutp01f; Thu, 25 Apr 2019 11:24:01 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout1.samsung.com 20190425112401epoutp0154f3efce8b08a5c57f52a4872319583e~Ys976J_2g1904819048epoutp01f DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1556191441; bh=4S6KChIBk/IqG41ydTdXRNYQIbozJTHYfmrQ7Y29Fy0=; h=From:To:Cc:Subject:Date:In-reply-to:References:From; b=AAYrDUkThUv+58pIWELgbqysEharMon4iX4btuzrVtKp++QDF6hYi4CWunIcsFtY/ CNqeYCEVVKIxChsSGsGf8P3WOJThjnRHs1NWJ4pPFigqo4GEaPR7uAYt8oR3skGl99 uLhEryKhRDC4G4GFbgAb+BIS+yEDk+j/28ZeXuMU= Received: from epsmges1p2.samsung.com (unknown [182.195.42.54]) by epcas1p4.samsung.com (KnoxPortal) with ESMTP id 20190425112400epcas1p468414a681f5575952ec05e4abb0f1f1b~Ys97bOP_X2380823808epcas1p4H; Thu, 25 Apr 2019 11:24:00 +0000 (GMT) Received: from epcas1p1.samsung.com ( [182.195.41.45]) by epsmges1p2.samsung.com (Symantec Messaging Gateway) with SMTP id B5.D7.04142.0D891CC5; Thu, 25 Apr 2019 20:24:00 +0900 (KST) Received: from epsmgms2p1new.samsung.com (unknown [182.195.42.142]) by epcas1p2.samsung.com (KnoxPortal) with ESMTP id 20190425112400epcas1p26e7634f95a185a83c31470006d291161~Ys97JOliC0718107181epcas1p22; Thu, 25 Apr 2019 11:24:00 +0000 (GMT) X-AuditID: b6c32a36-ce1ff7000000102e-7d-5cc198d09ab8 Received: from epmmp2 ( [203.254.227.17]) by epsmgms2p1new.samsung.com (Symantec Messaging Gateway) with SMTP id 1E.BF.03598.0D891CC5; Thu, 25 Apr 2019 20:24:00 +0900 (KST) Received: from test-PowerEdge-R720.sa.corp.samsungelectronics.net ([107.108.221.212]) by mmp2.samsung.com (Oracle Communications Messaging Server 7.0.5.31.0 64bit (built May 5 2014)) with ESMTPA id <0PQI007Z2KZ7JR40@mmp2.samsung.com>; Thu, 25 Apr 2019 20:24:00 +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, anshul@samsung.com, Kanchan Joshi Subject: [PATCH v5 4/7] block: introduce write-hint to stream-id conversion Date: Thu, 25 Apr 2019 16:49:59 +0530 Message-id: <1556191202-3245-5-git-send-email-joshi.k@samsung.com> X-Mailer: git-send-email 2.7.4 In-reply-to: <1556191202-3245-1-git-send-email-joshi.k@samsung.com> X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFprMIsWRmVeSWpSXmKPExsWy7bCmru6FGQdjDL59MLP4PX0Kq8XR/2/Z LPbe0raYOe8Om8WevSdZLC7vmsNmMX/ZU3aLK1MWMTtweGxeUu/Rt2UVo8fnTXIBzFFcNimp OZllqUX6dglcGa8n7GIpmKlYcfrde/YGxibpLkZODgkBE4nOh4dYuhi5OIQEdjBKXJn4Esr5 zijxq3suE0xVy+79bBCJDYwSX38vZwVJCAlMZ5I4dSyui5GDg01AU+LC5FKQGhGBOYwSy/ZN YwapYRYIkVjxZBULiC0s4C2xec4vsDiLgKrEyZ4XbCC9vAJOEgs+CEPskpO4ea4TrIRTwFni xY9nTCAzJQQ62CRer1/ADlHkIvHsWBsLSK+EgLTEpaO2EOFiiV93jjJD1TNKXG+YyQKRsJe4 uOcvE8Q9fBLvvvawQvTySnS0CUGUeEjsebedCeLHaYwS0961M05glFjAyLCKUSy1oDg3PbXY sMBIrzgxt7g0L10vOT93EyM4qrTMdjAuOudziFGAg1GJh1ch8kCMEGtiWXFl7iFGCQ5mJRFe ddODMUK8KYmVValF+fFFpTmpxYcYpTlYlMR51zs4xwgJpCeWpGanphakFsFkmTg4pRoYJYs/ XV3wPPi63bOZFcwnZgrMTlnqf+eej/9jmyX98jPbYlJX3H+6nOnSNYZNT3/dXy1SznjJ9NeH Q4dv7md/svW6wJ5H3C6pP+c+7rnAOH8LTw9z9Y35S9jseR5aRFlKH90QvGP22/Jbakqvr235 J7r35+rl7zMOzll7carTmmdsJj8OrVyU/r9SiaU4I9FQi7moOBEAwGk3waYCAAA= X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFmphluLIzCtJLcpLzFFi42I5/e+xoO6FGQdjDH7PV7X4PX0Kq8XR/2/Z LPbe0raYOe8Om8WevSdZLC7vmsNmMX/ZU3aLK1MWMTtweGxeUu/Rt2UVo8fnTXIBzFFcNimp OZllqUX6dglcGa8n7GIpmKlYcfrde/YGxibpLkZODgkBE4mW3fvZuhi5OIQE1jFKNM3dxQLh zGSSePzzIVMXIwcHm4CmxIXJpSBxEYE5jBI9u9ezgnQzC4RIzHr2mA3EFhbwltg85xcziM0i oCpxsucFG0gvr4CTxIIPwhDL5CRunusEK+EUcJZ48eMZE4gtBFRybdom9gmMPAsYGVYxSqYW FOem5xYbFRjmpZbrFSfmFpfmpesl5+duYgSGzbbDWn07GO8viT/EKMDBqMTDeyH2QIwQa2JZ cWXuIUYJDmYlEV5104MxQrwpiZVVqUX58UWlOanFhxilOViUxHlv5x2LFBJITyxJzU5NLUgt gskycXBKNTBK35jqYRryorTJ/l/dC+mrZ36Z/1r234L5tnRJxmetrby97jvnGB7c9WJtVGQ2 x8mitqwisQNL2q+xy33qnNYkWD3fbueeaNvUprj3dZOPKW25t7Ioa8KpFw28yU2fTvx6Lv77 /YFZbdyaH+6V8x08tmP2JIncDQ6WzFVbvgXdeCpoZmvz4e0eJZbijERDLeai4kQA1T38wRcC AAA= X-CMS-MailID: 20190425112400epcas1p26e7634f95a185a83c31470006d291161 CMS-TYPE: 101P X-CMS-RootMailID: 20190425112400epcas1p26e7634f95a185a83c31470006d291161 References: <1556191202-3245-1-git-send-email-joshi.k@samsung.com> Sender: linux-ext4-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-ext4@vger.kernel.org This patch moves write-hint-to-stream-id conversion in block-layer. Earlier this was done by driver (nvme). For user write-hints, conversion is of the form "streamid = write-hint - 1". For kernel write-hints, streams are allocated in top-to-bottom fashion. This has the effect of mapping user-hints to lower range of stream-ids and kernel-hints to upper range of stream-ids. 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 has been removed. For merging checks, 'bi_write_hint' (of bio) is used instead. Signed-off-by: Kanchan Joshi --- block/blk-core.c | 29 ++++++++++++++++++++++++++++- block/blk-merge.c | 4 ++-- drivers/nvme/host/core.c | 7 ++----- include/linux/blkdev.h | 2 +- 4 files changed, 33 insertions(+), 9 deletions(-) diff --git a/block/blk-core.c b/block/blk-core.c index a55389b..0485c20 100644 --- a/block/blk-core.c +++ b/block/blk-core.c @@ -730,6 +730,33 @@ 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, write_hint, nr_streams; + struct request_queue *q = req->q; + + nr_streams = q->limits.nr_streams; + + write_hint = bio->bi_write_hint; + + if (!nr_streams || write_hint == WRITE_LIFE_NOT_SET || + write_hint == WRITE_LIFE_NONE) + streamid = 0; + else if (write_hint < WRITE_LIFE_KERN_MIN) { /*user-space hints*/ + streamid = write_hint - 1; + if (streamid > nr_streams) + streamid = 0; + } else { /* kernel hints */ + streamid = write_hint - WRITE_LIFE_KERN_MIN + 1; + if (streamid > (nr_streams - BLK_MAX_USER_HINTS)) + streamid = 0; + else + streamid = nr_streams - streamid + 1; + } + return streamid; +} + void blk_init_request_from_bio(struct request *req, struct bio *bio) { if (bio->bi_opf & REQ_RAHEAD) @@ -737,7 +764,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/block/blk-merge.c b/block/blk-merge.c index 1c9d4f0..1435634 100644 --- a/block/blk-merge.c +++ b/block/blk-merge.c @@ -832,7 +832,7 @@ static struct request *attempt_merge(struct request_queue *q, * Don't allow merge of different write hints, or for a hint with * non-hint IO. */ - if (req->write_hint != next->write_hint) + if (req->bio->bi_write_hint != next->bio->bi_write_hint) return NULL; if (req->ioprio != next->ioprio) @@ -964,7 +964,7 @@ bool blk_rq_merge_ok(struct request *rq, struct bio *bio) * Don't allow merge of different write hints, or for a hint with * non-hint IO. */ - if (rq->write_hint != bio->bi_write_hint) + if (rq->bio->bi_write_hint != bio->bi_write_hint) return false; if (rq->ioprio != bio_prio(bio)) diff --git a/drivers/nvme/host/core.c b/drivers/nvme/host/core.c index 2c43e12..f3000d9 100644 --- a/drivers/nvme/host/core.c +++ b/drivers/nvme/host/core.c @@ -530,12 +530,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; diff --git a/include/linux/blkdev.h b/include/linux/blkdev.h index 5b6cb9747..9cf8a40 100644 --- a/include/linux/blkdev.h +++ b/include/linux/blkdev.h @@ -216,7 +216,7 @@ struct request { unsigned short nr_integrity_segments; #endif - unsigned short write_hint; + unsigned short streamid; unsigned short ioprio; unsigned int extra_len; /* length of alignment and padding */ From patchwork Thu Apr 25 11:20: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: 1090713 Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=vger.kernel.org (client-ip=209.132.180.67; helo=vger.kernel.org; envelope-from=linux-ext4-owner@vger.kernel.org; receiver=) Authentication-Results: ozlabs.org; dmarc=pass (p=none dis=none) header.from=samsung.com Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=samsung.com header.i=@samsung.com header.b="lW7KeMC3"; dkim-atps=neutral Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 44qZb46j4mz9sB8 for ; Thu, 25 Apr 2019 21:24:32 +1000 (AEST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2387646AbfDYLYK (ORCPT ); Thu, 25 Apr 2019 07:24:10 -0400 Received: from mailout4.samsung.com ([203.254.224.34]:33282 "EHLO mailout4.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2387580AbfDYLYI (ORCPT ); Thu, 25 Apr 2019 07:24:08 -0400 Received: from epcas1p3.samsung.com (unknown [182.195.41.47]) by mailout4.samsung.com (KnoxPortal) with ESMTP id 20190425112404epoutp045b25d253735467c4670790affac7533f~Ys9_TRUfL0936909369epoutp04j; Thu, 25 Apr 2019 11:24:04 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout4.samsung.com 20190425112404epoutp045b25d253735467c4670790affac7533f~Ys9_TRUfL0936909369epoutp04j DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1556191444; bh=GkSqbdrDJV1STm2bKdKjWIfP93iOF5XNeEs045WX1h8=; h=From:To:Cc:Subject:Date:In-reply-to:References:From; b=lW7KeMC3Idq49/+l6VZ1og8T2CThtWxP1qO9lDiZc77vtklVYQWVxw5Ngkhf8A90B T0bwRVTBqjlBwY1TdHW2zlZb3pXIV2JlcOe1EmzhLkjIHKMmgmd3/1og5G8ZMN617I BpmZQ+E1/jOzy+6oK0UrHb74h2R/wdYyBqq6UvRA= Received: from epsmges1p2.samsung.com (unknown [182.195.42.54]) by epcas1p2.samsung.com (KnoxPortal) with ESMTP id 20190425112403epcas1p2e03bab8b9169e8cf575401bd63da598c~Ys9_CJ7Qg0216202162epcas1p2P; Thu, 25 Apr 2019 11:24:03 +0000 (GMT) Received: from epcas1p4.samsung.com ( [182.195.41.48]) by epsmges1p2.samsung.com (Symantec Messaging Gateway) with SMTP id E7.D7.04142.3D891CC5; Thu, 25 Apr 2019 20:24:03 +0900 (KST) Received: from epsmgms2p1new.samsung.com (unknown [182.195.42.142]) by epcas1p1.samsung.com (KnoxPortal) with ESMTP id 20190425112403epcas1p13006198cda351a08c8403c2b85c9f102~Ys99wKxS91172511725epcas1p1U; Thu, 25 Apr 2019 11:24:03 +0000 (GMT) X-AuditID: b6c32a36-ce1ff7000000102e-85-5cc198d35208 Received: from epmmp2 ( [203.254.227.17]) by epsmgms2p1new.samsung.com (Symantec Messaging Gateway) with SMTP id CE.BF.03598.3D891CC5; Thu, 25 Apr 2019 20:24:03 +0900 (KST) Received: from test-PowerEdge-R720.sa.corp.samsungelectronics.net ([107.108.221.212]) by mmp2.samsung.com (Oracle Communications Messaging Server 7.0.5.31.0 64bit (built May 5 2014)) with ESMTPA id <0PQI007Z2KZ7JR40@mmp2.samsung.com>; Thu, 25 Apr 2019 20:24: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, anshul@samsung.com, Kanchan Joshi Subject: [PATCH v5 5/7] nvme: register stream info with block layer Date: Thu, 25 Apr 2019 16:50:00 +0530 Message-id: <1556191202-3245-6-git-send-email-joshi.k@samsung.com> X-Mailer: git-send-email 2.7.4 In-reply-to: <1556191202-3245-1-git-send-email-joshi.k@samsung.com> X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFprEIsWRmVeSWpSXmKPExsWy7bCmge7lGQdjDDbd0bH4PX0Kq8XR/2/Z LPbe0raYOe8Om8WevSdZLC7vmsNmMX/ZU3aLK1MWMTtweGxeUu/Rt2UVo8fnTXIBzFFcNimp OZllqUX6dglcGUdPbGAuuCZYsW3hFOYGxot8XYycHBICJhKzOp6ydTFycQgJ7GCUuNyxmxHC +c4ocXzfRmaYqt1NWxlBbCGBDYwSU1/nQBRNZ5J4cHoKUIKDg01AU+LC5FKQuIjAHEaJZfum gTUzC4RIrHiyigWkRljAWeLWTxOQMIuAqkT7wh2sIDavgJPE+7UrWCB2yUncPNcJ1soJVP7i xzMmkJkSAo1sEgv+3GeCKHKReP/5LdheCQFpiUtHbSHCxRK/7hxlhqjvYJS43jATaqi9xMU9 f5kg7uGTePe1hxWil1eio00IwvSQ+Lk2C+KtaYwSs6dvZ5vAKLGAkWEVo1hqQXFuemqxYYGR XnFibnFpXrpecn7uJkZwTGmZ7WBcdM7nEKMAB6MSD69C5IEYIdbEsuLK3EOMEhzMSiK86qYH Y4R4UxIrq1KL8uOLSnNSiw8xSnOwKInzrndwjhESSE8sSc1OTS1ILYLJMnFwSjUwLnaeNrFi 79Hdz6bNkT28qjLX1N/rw/n9r61uT/Hbv4zLpfB2vPnPsHWHnf6qPznZ/7r4yWe3h1lL+sV2 nT7fkN+rvMn4+Jnrm/19KrVy1657dvO/0PwpZ/bmNhrtd3t1cF2s36Vfz+qXnFqdINOz//ya /L/qX86uvt1mZ6kX7RAw+3SU/rwJJieVWIozEg21mIuKEwEy5fJypQIAAA== X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFmphluLIzCtJLcpLzFFi42I5/e+xoO7lGQdjDN5tlrD4PX0Kq8XR/2/Z LPbe0raYOe8Om8WevSdZLC7vmsNmMX/ZU3aLK1MWMTtweGxeUu/Rt2UVo8fnTXIBzFFcNimp OZllqUX6dglcGUdPbGAuuCZYsW3hFOYGxot8XYycHBICJhK7m7YydjFycQgJrGOUaHkzjQnC mckk8XnhFKAMBwebgKbEhcmlIHERgTmMEj2717OCdDMLhEjMevaYDaRGWMBZ4tZPE5Awi4Cq RPvCHWAlvAJOEu/XrmCBWCYncfNcJzOIzQlU/uLHMyYQWwio5tq0TewTGHkWMDKsYpRMLSjO Tc8tNiowzEst1ytOzC0uzUvXS87P3cQIDJtth7X6djDeXxJ/iFGAg1GJh/dC7IEYIdbEsuLK 3EOMEhzMSiK86qYHY4R4UxIrq1KL8uOLSnNSiw8xSnOwKInz3s47FikkkJ5YkpqdmlqQWgST ZeLglGpg1L3sbJI267X39/MCkn5bolYdSOH3sgleo7r+eciBFdPKH7hu7PjP8laoNDGvKSm1 sc68gbeqprThqO2vtzcvf427w8X913pJiLN6Mn9SqPM6j7vLJwu+YJx+bffNKRmvne48OHnw opbC4evLV168udA9e/XmuTqZ95fZm4QJPJ/w6VVf6eLri5RYijMSDbWYi4oTAWbZlXwXAgAA X-CMS-MailID: 20190425112403epcas1p13006198cda351a08c8403c2b85c9f102 CMS-TYPE: 101P X-CMS-RootMailID: 20190425112403epcas1p13006198cda351a08c8403c2b85c9f102 References: <1556191202-3245-1-git-send-email-joshi.k@samsung.com> Sender: linux-ext4-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-ext4@vger.kernel.org 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. Also driver no longer disables stream feature if device reported less than 4 streams. Any write-hint beyond exported number of streams will be mapped to 0 by block layer. Signed-off-by: Kanchan Joshi --- drivers/nvme/host/core.c | 16 ++++------------ 1 file changed, 4 insertions(+), 12 deletions(-) diff --git a/drivers/nvme/host/core.c b/drivers/nvme/host/core.c index f3000d9..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; } @@ -3186,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; @@ -3197,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 Thu Apr 25 11:20: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: 1090711 Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=vger.kernel.org (client-ip=209.132.180.67; helo=vger.kernel.org; envelope-from=linux-ext4-owner@vger.kernel.org; receiver=) Authentication-Results: ozlabs.org; dmarc=pass (p=none dis=none) header.from=samsung.com Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=samsung.com header.i=@samsung.com header.b="CX2upkFr"; dkim-atps=neutral Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 44qZZq65Mkz9sBr for ; Thu, 25 Apr 2019 21:24:19 +1000 (AEST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2387679AbfDYLYL (ORCPT ); Thu, 25 Apr 2019 07:24:11 -0400 Received: from mailout1.samsung.com ([203.254.224.24]:30699 "EHLO mailout1.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2387620AbfDYLYL (ORCPT ); Thu, 25 Apr 2019 07:24:11 -0400 Received: from epcas1p3.samsung.com (unknown [182.195.41.47]) by mailout1.samsung.com (KnoxPortal) with ESMTP id 20190425112406epoutp01fdcef32e667086729f27c1b7a49aa4e2~Ys_AqWt091904819048epoutp01h; Thu, 25 Apr 2019 11:24:06 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout1.samsung.com 20190425112406epoutp01fdcef32e667086729f27c1b7a49aa4e2~Ys_AqWt091904819048epoutp01h DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1556191446; bh=LslFbD0lwD/9SQNcuMJl+Vtr6HxJKs3jycHzydcCwpE=; h=From:To:Cc:Subject:Date:In-reply-to:References:From; b=CX2upkFrOZ/YwIy/oJ16XhFhIKKpiWCihFDyZjgsM7ue4UBbzgl8hP9YsKmRXTuCK ZrVc9KyK38HDy0yWNS7pInHhd0F/tSSal5112dUM3hgMyT8qNTM2DFPGwyQx/tfWpM 4Ef+1iKErFRY3o0DBvr4Ohq9zfidZCd7oVQKGNeI= Received: from epsmges1p1.samsung.com (unknown [182.195.42.53]) by epcas1p3.samsung.com (KnoxPortal) with ESMTP id 20190425112406epcas1p379af84defcdee33c109eb4d7d59e92e1~Ys_AXDg7k2352823528epcas1p33; Thu, 25 Apr 2019 11:24:06 +0000 (GMT) Received: from epcas1p2.samsung.com ( [182.195.41.46]) by epsmges1p1.samsung.com (Symantec Messaging Gateway) with SMTP id FF.10.04139.6D891CC5; Thu, 25 Apr 2019 20:24:06 +0900 (KST) Received: from epsmgms2p1new.samsung.com (unknown [182.195.42.142]) by epcas1p4.samsung.com (KnoxPortal) with ESMTP id 20190425112406epcas1p4a54b2c5d15ae42a53ff3c206cf7a7892~Ys_AMy97V2380823808epcas1p4V; Thu, 25 Apr 2019 11:24:06 +0000 (GMT) X-AuditID: b6c32a35-98bff7000000102b-05-5cc198d63200 Received: from epmmp2 ( [203.254.227.17]) by epsmgms2p1new.samsung.com (Symantec Messaging Gateway) with SMTP id 7F.BF.03598.5D891CC5; Thu, 25 Apr 2019 20:24:06 +0900 (KST) Received: from test-PowerEdge-R720.sa.corp.samsungelectronics.net ([107.108.221.212]) by mmp2.samsung.com (Oracle Communications Messaging Server 7.0.5.31.0 64bit (built May 5 2014)) with ESMTPA id <0PQI007Z2KZ7JR40@mmp2.samsung.com>; Thu, 25 Apr 2019 20:24:05 +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, anshul@samsung.com, Kanchan Joshi Subject: [PATCH v5 6/7] fs: introduce APIs to enable passing write-hint with buffer-head Date: Thu, 25 Apr 2019 16:50:01 +0530 Message-id: <1556191202-3245-7-git-send-email-joshi.k@samsung.com> X-Mailer: git-send-email 2.7.4 In-reply-to: <1556191202-3245-1-git-send-email-joshi.k@samsung.com> X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFprIIsWRmVeSWpSXmKPExsWy7bCmnu61GQdjDBpvClj8nj6F1eLo/7ds FntvaVvMnHeHzWLP3pMsFpd3zWGzmL/sKbvFlSmLmB04PDYvqffo27KK0ePzJrkA5igum5TU nMyy1CJ9uwSujMX9q5kL3ghXLH+7hK2B8aJAFyMnh4SAicTUBS+Zuxi5OIQEdjBKnF94jQ3C +c4o8er9T6YuRg6wqmftoSANQgIbGCW2PoyCsKczSdx9YQ5SwiagKXFhcilIq4jAHEaJZfum MYPUMAuESKx4sooFxBYWiJJY8fQNG4jNIqAq0Tf5O1gNr4CTxJ11TWwQB8lJ3DzXCRbnFHCW ePHjGRPIUAmBRjaJ/03nGCHucZF4tFQAwpSWuHTUFqK1WOLXnaPMEOUdjBLXG2ayQCTsJS7u +csEcQ+fxLuvPawQvbwSHW1CECUeEv8nvGKEeH0ao8SXru+sExglFjAyrGIUSy0ozk1PLTYs MNQrTswtLs1L10vOz93ECI4oLdMdjFPO+RxiFOBgVOLhVYg8ECPEmlhWXJl7iFGCg1lJhFfd 9GCMEG9KYmVValF+fFFpTmrxIUZpDhYlcd71Ds4xQgLpiSWp2ampBalFMFkmDk6pBsZ9v35u Sno5Q3bKtlZxkyaGlo8Ttn3cHjij51iMl6jn5O/O75MUZ6g2sE4v1J6arT5L23HDTP6jjsUb 5n6vO/N81gKm92y/HlpafFrGcjjSrp41Qruz1vbzwetFG+6/Pla4Ka6pcdHBTPXu1NtiyaXz hLfd9mDUfFo3L+MRV2vp8wcnPjqU3alSYinOSDTUYi4qTgQAFhaWh6QCAAA= X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFmpiluLIzCtJLcpLzFFi42I5/e+xoO61GQdjDJqCLX5Pn8JqcfT/WzaL vbe0LWbOu8NmsWfvSRaLy7vmsFnMX/aU3eLKlEXMDhwem5fUe/RtWcXo8XmTXABzFJdNSmpO Zllqkb5dAlfG4v7VzAVvhCuWv13C1sB4UaCLkYNDQsBE4ll7aBcjJ4eQwDpGicNHLbsYuYDs mUwS3z9PYwSpYRPQlLgwuRQkLiIwh1GiZ/d6VpAGZoEQiVnPHrOB2MICURIrnr4Bs1kEVCX6 Jn9nBrF5BZwk7qxrAotLCMhJ3DzXCRbnFHCWePHjGRPEYieJa9M2sU9g5FnAyLCKUTK1oDg3 PbfYqMAwL7Vcrzgxt7g0L10vOT93EyMwZLYd1urbwXh/SfwhRgEORiUe3guxB2KEWBPLiitz DzFKcDArifCqmx6MEeJNSaysSi3Kjy8qzUktPsQozcGiJM57O+9YpJBAemJJanZqakFqEUyW iYNTqoFRb1qKbr/c5CpR+7f1t24LxkY5GZu47J51RYDxCENI2COBrWEx9auaHr23ZIw9WLpd xCjpys1JvGdkdfpFpixl86n2vrKlUkJlhfH2yyI21yI5d65aaPCq+QUn64tCP7enXaUPZHqS 3/65+GXzFH/rORpZnnsNPnbtOzH1/bv5iWvnnPe/fi1biaU4I9FQi7moOBEAZpu6dhUCAAA= X-CMS-MailID: 20190425112406epcas1p4a54b2c5d15ae42a53ff3c206cf7a7892 CMS-TYPE: 101P X-CMS-RootMailID: 20190425112406epcas1p4a54b2c5d15ae42a53ff3c206cf7a7892 References: <1556191202-3245-1-git-send-email-joshi.k@samsung.com> Sender: linux-ext4-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-ext4@vger.kernel.org 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 Thu Apr 25 11:20: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: 1090712 Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=vger.kernel.org (client-ip=209.132.180.67; helo=vger.kernel.org; envelope-from=linux-ext4-owner@vger.kernel.org; receiver=) Authentication-Results: ozlabs.org; dmarc=pass (p=none dis=none) header.from=samsung.com Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=samsung.com header.i=@samsung.com header.b="aNPZ16MP"; dkim-atps=neutral Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 44qZZy2jqVz9sB8 for ; Thu, 25 Apr 2019 21:24:26 +1000 (AEST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730945AbfDYLYV (ORCPT ); Thu, 25 Apr 2019 07:24:21 -0400 Received: from mailout1.samsung.com ([203.254.224.24]:30713 "EHLO mailout1.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2387624AbfDYLYL (ORCPT ); Thu, 25 Apr 2019 07:24:11 -0400 Received: from epcas2p3.samsung.com (unknown [182.195.41.55]) by mailout1.samsung.com (KnoxPortal) with ESMTP id 20190425112408epoutp01b2d61ce0294a373a6259eb77e27ed697~Ys_CzMAyq1921819218epoutp01S; Thu, 25 Apr 2019 11:24:08 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout1.samsung.com 20190425112408epoutp01b2d61ce0294a373a6259eb77e27ed697~Ys_CzMAyq1921819218epoutp01S DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1556191448; bh=C76dKk0NmGHl/Qu5kKDvvmvO7y5dIxg97utO9LWSE00=; h=From:To:Cc:Subject:Date:In-reply-to:References:From; b=aNPZ16MPX4xsbeNO6I6B3SQWrijtqOKpEIzqKZLrebADGg0GJad7qHA8Mna5Asyjt k8CYuCdzh4dW75C0iY1pUociQm861LX1Vzw6934qBefxD7kD9ctcnbqf0J8oUe0x2O FLoKzXf17FcwJXalpY2MacLmkFGXB+182z2jTEaI= Received: from epsmges2p3.samsung.com (unknown [182.195.42.71]) by epcas2p3.samsung.com (KnoxPortal) with ESMTP id 20190425112408epcas2p30eecd8269be3909764b5a2e35ad36a9b~Ys_CbZvyq3170231702epcas2p3k; Thu, 25 Apr 2019 11:24:08 +0000 (GMT) Received: from epcas2p3.samsung.com ( [182.195.41.55]) by epsmges2p3.samsung.com (Symantec Messaging Gateway) with SMTP id A8.C9.04206.8D891CC5; Thu, 25 Apr 2019 20:24:08 +0900 (KST) Received: from epsmgms2p2new.samsung.com (unknown [182.195.42.143]) by epcas2p2.samsung.com (KnoxPortal) with ESMTP id 20190425112408epcas2p2ddba9fdf175645dd2647da191eac5e1c~Ys_CRhRhI0083200832epcas2p2G; Thu, 25 Apr 2019 11:24:08 +0000 (GMT) X-AuditID: b6c32a47-14bff7000000106e-f1-5cc198d8b568 Received: from epmmp2 ( [203.254.227.17]) by epsmgms2p2new.samsung.com (Symantec Messaging Gateway) with SMTP id BB.4D.03620.8D891CC5; Thu, 25 Apr 2019 20:24:08 +0900 (KST) Received: from test-PowerEdge-R720.sa.corp.samsungelectronics.net ([107.108.221.212]) by mmp2.samsung.com (Oracle Communications Messaging Server 7.0.5.31.0 64bit (built May 5 2014)) with ESMTPA id <0PQI007Z2KZ7JR40@mmp2.samsung.com>; Thu, 25 Apr 2019 20:24:08 +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, anshul@samsung.com, Kanchan Joshi Subject: [PATCH v5 7/7] fs/ext4,jbd2: add support for sending write-hint with journal Date: Thu, 25 Apr 2019 16:50:02 +0530 Message-id: <1556191202-3245-8-git-send-email-joshi.k@samsung.com> X-Mailer: git-send-email 2.7.4 In-reply-to: <1556191202-3245-1-git-send-email-joshi.k@samsung.com> X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFprMIsWRmVeSWpSXmKPExsWy7bCmue6NGQdjDP78lrX4PX0Kq8XR/2/Z LPbe0raYOe8Om8WevSdZLC7vmsNmMX/ZU3aLK1MWMTtweGxeUu/Rt2UVo8fnTXIBzFFcNimp OZllqUX6dglcGX9ebWcrOKZQsf6ffANjt3QXIyeHhICJxM2T/9m7GLk4hAR2MEp8ubEDyvnO KLGjZQsLTNXtgzvZIBIbGCWm7HvGBOFMZ5LYdfYQUIaDg01AU+LC5FKQuIjAHEaJZfumMYN0 MwuESKx4sooFpEZYIFyi80EpiMkioCrxcY4MSAWvgJPElm3T2CB2yUncPNcJ1skp4Czx4gfE KgmBDjaJ5tenGCGKXCR6bj1mhrClJZ6t2ggVL5b4decoM1QDo8T1hplQH9hLXNzzlwniHj6J jsN/2UGOkBDglehoE4Io8ZC4cPYB1F/TGCWe3dnLNIFRYgEjwypGsdSC4tz01GKjAmO94sTc 4tK8dL3k/NxNjOCo0nLfwbjtnM8hRgEORiUeXoXIAzFCrIllxZW5hxglOJiVRHjVTQ/GCPGm JFZWpRblxxeV5qQWH2KU5mBREud9KD03WkggPbEkNTs1tSC1CCbLxMEp1cCo/DJEuX6hiEXV ndBnjv+bbM8ucPaJeHBgu7DG5959fdpXzj5+2Mb85d3KFRXyP1+5GSn9uXjoxaeuWeGN7LKb z3w2PN9/xFj+SF6X3ztLNdGZ78R9GFdVBBRtPmFRMG/+qexUybRYB/WWc9uOdxX779F71L/+ eu2HC2lGp64bCS4oCZigz22mxFKckWioxVxUnAgA9ozqpqYCAAA= X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFmpmluLIzCtJLcpLzFFi42I5/e+xoO6NGQdjDB4eEbb4PX0Kq8XR/2/Z LPbe0raYOe8Om8WevSdZLC7vmsNmMX/ZU3aLK1MWMTtweGxeUu/Rt2UVo8fnTXIBzFFcNimp OZllqUX6dglcGX9ebWcrOKZQsf6ffANjt3QXIyeHhICJxO2DO9m6GLk4hATWMUo0/jnPCOHM ZJK4+7SRvYuRg4NNQFPiwuRSkLiIwBxGiZ7d61lBupkFQiRmPXvMBmILC4RLNLTuBqtnEVCV +DhHBiTMK+AksWXbNDaIZXISN891MoPYnALOEi9+PGMCsYWAaq5N28Q+gZFnASPDKkbJ1ILi 3PTcYqMCo7zUcr3ixNzi0rx0veT83E2MwKDZdlirfwfj4yXxhxgFOBiVeHgVIg/ECLEmlhVX 5h5ilOBgVhLhVTc9GCPEm5JYWZValB9fVJqTWnyIUZqDRUmclz//WKSQQHpiSWp2ampBahFM lomDU6qBMTRO8NoijrUqC/lza/edjLOQe839pTd8FUtM4Pk3k6Uf1WuzO8t5t55hOVPzdvrq 3m+/lE+fL7pjrBP2yWBTXsLxW4IHjuZO9ug/MVF9w5W5jSuXnv+3sO+m/XV23Q72jKdHcl/d Z/4YX/2r4LxdwNKqT+VXi95MtVB+VvXxwXVui8JdP8+/XaDEUpyRaKjFXFScCADnuS1mFgIA AA== X-CMS-MailID: 20190425112408epcas2p2ddba9fdf175645dd2647da191eac5e1c CMS-TYPE: 102P X-CMS-RootMailID: 20190425112408epcas2p2ddba9fdf175645dd2647da191eac5e1c References: <1556191202-3245-1-git-send-email-joshi.k@samsung.com> Sender: linux-ext4-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-ext4@vger.kernel.org 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: