From patchwork Fri Mar 29 07:53:46 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kanchan Joshi X-Patchwork-Id: 10876573 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 0E7BC186D for ; Fri, 29 Mar 2019 07:58:34 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 03B5229077 for ; Fri, 29 Mar 2019 07:58:34 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id EC47729079; Fri, 29 Mar 2019 07:58:33 +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 A123E2907D for ; Fri, 29 Mar 2019 07:58:33 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728993AbfC2H5s (ORCPT ); Fri, 29 Mar 2019 03:57:48 -0400 Received: from mailout1.samsung.com ([203.254.224.24]:48382 "EHLO mailout1.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728989AbfC2H5r (ORCPT ); Fri, 29 Mar 2019 03:57:47 -0400 Received: from epcas1p2.samsung.com (unknown [182.195.41.46]) by mailout1.samsung.com (KnoxPortal) with ESMTP id 20190329075744epoutp01d139dea2c4a5c27df3797dbf3d58439c~QXvHKRxPr0504405044epoutp01Z; Fri, 29 Mar 2019 07:57:44 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout1.samsung.com 20190329075744epoutp01d139dea2c4a5c27df3797dbf3d58439c~QXvHKRxPr0504405044epoutp01Z DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1553846264; bh=GMWfG/UFPIw6K5QHny8wOIAe2Q2tBotihJWkxHDsKe4=; h=From:To:Cc:Subject:Date:In-reply-to:References:From; b=Tkpb0z8sX5Kw/Mstec0Yd3FHOBZBZ6Yw4/mV22puAUs0P+CkMoHWLOVyC6oiO9qTK yzXwcqZjLfAeO8ScssuUwgBhybO482TAoJ1f8OBAjcyBNjlml75euMMo3a21/9e0WC O/jLp24hF5SFgFCNv32IZ1FwanDP4eftvPpk1t88= Received: from epsmges1p1.samsung.com (unknown [182.195.42.53]) by epcas1p2.samsung.com (KnoxPortal) with ESMTP id 20190329075743epcas1p2279b119a3e51bab134f1ecf65ea1a9b3~QXvG8OPrT0065800658epcas1p2P; Fri, 29 Mar 2019 07:57:43 +0000 (GMT) Received: from epcas1p3.samsung.com ( [182.195.41.47]) by epsmges1p1.samsung.com (Symantec Messaging Gateway) with SMTP id 9B.45.04139.7FFCD9C5; Fri, 29 Mar 2019 16:57:43 +0900 (KST) Received: from epsmgms2p1new.samsung.com (unknown [182.195.42.142]) by epcas1p1.samsung.com (KnoxPortal) with ESMTP id 20190329075743epcas1p12f1d290e65ddf84eb74ed94a5ae6eb74~QXvGh3lDq0562405624epcas1p1X; Fri, 29 Mar 2019 07:57:43 +0000 (GMT) X-AuditID: b6c32a35-98bff7000000102b-27-5c9dcff7a16f Received: from epmmp1.local.host ( [203.254.227.16]) by epsmgms2p1new.samsung.com (Symantec Messaging Gateway) with SMTP id F6.7F.03598.7FFCD9C5; Fri, 29 Mar 2019 16:57:43 +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 <0PP40008VBFTTN20@mmp1.samsung.com>; Fri, 29 Mar 2019 16:57:43 +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: axboe@fb.com, prakash.v@samsung.com, anshul@samsung.com, joshiiitr@gmail.com, Kanchan Joshi Subject: [PATCH v3 1/7] block: extend stream count for in-kernel use Date: Fri, 29 Mar 2019 13:23:46 +0530 Message-id: <1553846032-4451-2-git-send-email-joshi.k@samsung.com> X-Mailer: git-send-email 2.7.4 In-reply-to: <1553846032-4451-1-git-send-email-joshi.k@samsung.com> X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFlrGIsWRmVeSWpSXmKPExsWy7bCmvu7383NjDFbs1rX4PX0Kq8X/PcfY LI7+f8tmcf7tYSaLvbe0LWbOu8NmsWfvSRaLy7vmsFnMX/aU3eLKlEXMDlweE5vfsXvsnHWX 3WPzknqPvi2rGD0+b5ILYI3isklJzcksSy3St0vgytj/I7/gKW/Fkc4O1gbGLdxdjJwcEgIm EjcX/GTsYuTiEBLYwSix4N83ZpCEkMB3Rol716tgiq59X80KUbSbUeLF9jNQznQmiTPPu4E6 ODjYBDQlLkwuBYmLCMxhlFi2bxrYJGaBcom/U64ygtjCAi4S25vOMoHYLAKqEn9vvmEDsXkF nCQmzP7KDrFNTuLmuU6wXk4BZ4mP15tZQIZKCCxhk3i95goLRJGLRPeMC+wgiyUEpCUuHbWF CBdL/LpzlBmivoNR4nrDTKh6e4mLe/4yQRzEJ/Huaw8rRC+vREebEESJh8TyP89ZIb6fxihx 9YHrBGCAMDKsYhRLLSjOTU8tNiww1CtOzC0uzUvXS87P3cQIjj0t0x2MU875HGIU4GBU4uGd sXNOjBBrYllxZe4hRgkOZiUR3sBzc2OEeFMSK6tSi/Lji0pzUosPMUpzsCiJ8653cI4REkhP LEnNTk0tSC2CyTJxcEo1MGZ4FDUmHyv3UzBxFLozj3lqX39R4aT4Azy1bz6f2iC6b8WKQMZc xd0PPBZs6WVW+lXRqHvtMC/jvCf/vCvv/Hqav6ytec/7nc/5f7yTuPD2/nE/oUmW2rrfNqjH Bj1n3/qSbfniMNZZt9S2d23NedrfveLV4UX1vquuejLx1x30+9j2xGJPi7ESS3FGoqEWc1Fx IgCWunMuuQIAAA== X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFprOLMWRmVeSWpSXmKPExsVy+t9jAd3v5+fGGNy5KGTxe/oUVov/e46x WRz9/5bN4vzbw0wWe29pW8ycd4fNYs/ekywWl3fNYbOYv+wpu8WVKYuYHbg8Jja/Y/fYOesu u8fmJfUefVtWMXp83iQXwBrFZZOSmpNZllqkb5fAlbH/R37BU96KI50drA2MW7i7GDk5JARM JK59X83axcjFISSwk1Hi7INnbBDOTCaJh2dWsXcxcnCwCWhKXJhcChIXEZjDKNGzez0rSJxZ oFxiyiZOkEHCAi4S25vOMoHYLAKqEn9vvmEDsXkFnCQmzP7KDrFMTuLmuU5mEJtTwFni4/Vm FhBbCKhm7f0G9gmMPAsYGVYxSqYWFOem5xYbFRjmpZbrFSfmFpfmpesl5+duYgQG17bDWn07 GO8viT/EKMDBqMTDO2PnnBgh1sSy4srcQ4wSHMxKIryB5+bGCPGmJFZWpRblxxeV5qQWH2KU 5mBREue9nXcsUkggPbEkNTs1tSC1CCbLxMEp1cBo8aaMs9P85Kmrv9hOh4jaTSz1XDLz70GJ 5PKH+78LRifzKMc6P+9n41Q1DE8Pyf02f5Lzc+1jy99L3Hc7PyfmYvon+x0PeP8nOl7Pv/jv Tegr17vqk7lO3ZivW5g31/9sR9hR9tUBUStcLv0verch7mKD7u6jpRt/t0aFMJ+1fRU5uTbq wrStSizFGYmGWsxFxYkACYMGAioCAAA= X-CMS-MailID: 20190329075743epcas1p12f1d290e65ddf84eb74ed94a5ae6eb74 CMS-TYPE: 101P X-CMS-RootMailID: 20190329075743epcas1p12f1d290e65ddf84eb74ed94a5ae6eb74 References: <1553846032-4451-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 bumps up stream count to suppor in-kernel hints. It also adds 'streamid' member in 'request' and declares new API for driver to register stream-info with block layer. Signed-off-by: Kanchan Joshi --- include/linux/blkdev.h | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/include/linux/blkdev.h b/include/linux/blkdev.h index 338604d..4088e21 100644 --- a/include/linux/blkdev.h +++ b/include/linux/blkdev.h @@ -214,6 +214,7 @@ struct request { #endif unsigned short write_hint; + unsigned short streamid; unsigned short ioprio; void *special; /* opaque pointer available for LLD use */ @@ -341,6 +342,8 @@ struct queue_limits { unsigned char misaligned; unsigned char discard_misaligned; unsigned char raid_partial_stripes_expensive; + + unsigned short nr_streams; enum blk_zoned_model zoned; }; @@ -567,8 +570,9 @@ struct request_queue { size_t cmd_size; 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]; }; @@ -1071,6 +1075,7 @@ 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_flush_queueable(struct request_queue *q, bool queueable); extern void blk_queue_write_cache(struct request_queue *q, bool enabled, bool fua); +extern void blk_queue_stream_limits(struct request_queue *, unsigned short); /* * Number of physical segments as sent to the device. From patchwork Fri Mar 29 07:53:47 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kanchan Joshi X-Patchwork-Id: 10876569 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 416D71669 for ; Fri, 29 Mar 2019 07:58:31 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 366E529077 for ; Fri, 29 Mar 2019 07:58:31 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 2B26E2907A; Fri, 29 Mar 2019 07:58:31 +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 DBFE829077 for ; Fri, 29 Mar 2019 07:58:30 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729015AbfC2H5v (ORCPT ); Fri, 29 Mar 2019 03:57:51 -0400 Received: from mailout1.samsung.com ([203.254.224.24]:48426 "EHLO mailout1.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728982AbfC2H5u (ORCPT ); Fri, 29 Mar 2019 03:57:50 -0400 Received: from epcas1p4.samsung.com (unknown [182.195.41.48]) by mailout1.samsung.com (KnoxPortal) with ESMTP id 20190329075747epoutp01bfda0d45c888b4a62685db863e232d71~QXvJ_MoV90504405044epoutp01e; Fri, 29 Mar 2019 07:57:47 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout1.samsung.com 20190329075747epoutp01bfda0d45c888b4a62685db863e232d71~QXvJ_MoV90504405044epoutp01e DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1553846267; bh=3ABOjlv0lfK3kx85YYrNVqMMcVW6sZA4ZmppvdcM598=; h=From:To:Cc:Subject:Date:In-reply-to:References:From; b=pdd5xlD8o7DTvUNMNMd/PqF9PypJhYGe9+1mqD8K4n+1El1qTvTTC4+HY1IZtdhfD YAa4NhCvDZ62bpSMwuutwaC7VOdB8JGIvKXOLdkwf6f6E2ilObcel4u4PmPjx6GzOn iYeLWmaESUZQ2hCCe6tNU/2oJJ+iYnuvasHgiTRM= Received: from epsmges1p4.samsung.com (unknown [182.195.42.56]) by epcas1p2.samsung.com (KnoxPortal) with ESMTP id 20190329075746epcas1p2fb83ec41e21b545c68e7a893a5e1ff50~QXvJhQqcL1199211992epcas1p2I; Fri, 29 Mar 2019 07:57:46 +0000 (GMT) Received: from epcas1p1.samsung.com ( [182.195.41.45]) by epsmges1p4.samsung.com (Symantec Messaging Gateway) with SMTP id 3A.BB.04257.AFFCD9C5; Fri, 29 Mar 2019 16:57:46 +0900 (KST) Received: from epsmgms2p1new.samsung.com (unknown [182.195.42.142]) by epcas1p1.samsung.com (KnoxPortal) with ESMTP id 20190329075746epcas1p19e5a93c1f593b5fed3f98eddf9159aa5~QXvJUveL93185131851epcas1p1l; Fri, 29 Mar 2019 07:57:46 +0000 (GMT) X-AuditID: b6c32a38-5e3ff700000010a1-c2-5c9dcffa3684 Received: from epmmp1.local.host ( [203.254.227.16]) by epsmgms2p1new.samsung.com (Symantec Messaging Gateway) with SMTP id A7.7F.03598.AFFCD9C5; Fri, 29 Mar 2019 16:57:46 +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 <0PP40008VBFTTN20@mmp1.samsung.com>; Fri, 29 Mar 2019 16:57:46 +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: axboe@fb.com, prakash.v@samsung.com, anshul@samsung.com, joshiiitr@gmail.com, Kanchan Joshi Subject: [PATCH v3 2/7] block: introduce API to register stream information with block layer Date: Fri, 29 Mar 2019 13:23:47 +0530 Message-id: <1553846032-4451-3-git-send-email-joshi.k@samsung.com> X-Mailer: git-send-email 2.7.4 In-reply-to: <1553846032-4451-1-git-send-email-joshi.k@samsung.com> X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFlrOIsWRmVeSWpSXmKPExsWy7bCmru6v83NjDA5NVLD4PX0Kq8X/PcfY LI7+f8tmcf7tYSaLvbe0LWbOu8NmsWfvSRaLy7vmsFnMX/aU3eLKlEXMDlweE5vfsXvsnHWX 3WPzknqPvi2rGD0+b5ILYI3isklJzcksSy3St0vgyli74hdLwSqOirPnbjM2MP5i62Lk5JAQ MJFY2nmEuYuRi0NIYAejxKct71khnO+MEs93HGPqYuQAqzo2PxykQUhgN6PEuRWSEDXTmSTW /HnNDFLDJqApcWFyKUhcRGAOo8SyfdOYQRqYBcol/k65yghiCwvESXS37wbbzCKgKvHh1XMW EJtXwEnibt9aFoiL5CRunusE6+UUcJb4eL2ZBWSohMASNokFU58xQhS5SBzY0cUKcZy0xKWj thDhYolfd44yQ9R3MEpcb5gJNdRe4uKev0wQB/FJvPvaA9XLK9HRJgRR4iGxcNMsFojHpjFK dL05yTiBUWIBI8MqRrHUguLc9NRiwwITveLE3OLSvHS95PzcTYzg6NOy2MG455zPIUYBDkYl Ht4ZO+fECLEmlhVX5h5ilOBgVhLhDTw3N0aINyWxsiq1KD++qDQntfgQozQHi5I473oH5xgh gfTEktTs1NSC1CKYLBMHp1QDY+NdDtZl/09UnrTYt+NAf+66Ur1dTU8+3XQu+7y/2jVuwZEP fpPYgyc7SMl9cLv5tlPTnVXkm/ZXTpH9C0VPH7j1kH2a5a11bUdvqTRPU5e/VvLF9fjrKNNp HQWLNCKKJnyWWvZb98X7a9seNqbddlpUz/07qI+rePHMEn6jowsOnBYJv2XHkKfEUpyRaKjF XFScCACWpPfYugIAAA== X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFprOLMWRmVeSWpSXmKPExsVy+t9jAd1f5+fGGJxbIGzxe/oUVov/e46x WRz9/5bN4vzbw0wWe29pW8ycd4fNYs/ekywWl3fNYbOYv+wpu8WVKYuYHbg8Jja/Y/fYOesu u8fmJfUefVtWMXp83iQXwBrFZZOSmpNZllqkb5fAlbF2xS+WglUcFWfP3WZsYPzF1sXIwSEh YCJxbH54FyMXh5DATkaJmw3fWSGcmUwS/asnMIEUsQloSlyYXAoSFxGYwyjRs3s9K0icWaBc Ysomzi5GTg5hgTiJ7vbdbCA2i4CqxIdXz1lAbF4BJ4m7fWvBbAkBOYmb5zqZQWxOAWeJj9eb weJCQDVr7zewT2DkWcDIsIpRMrWgODc9t9iowDAvtVyvODG3uDQvXS85P3cTIzC4th3W6tvB eH9J/CFGAQ5GJR7eGTvnxAixJpYVV+YeYpTgYFYS4Q08NzdGiDclsbIqtSg/vqg0J7X4EKM0 B4uSOO/tvGORQgLpiSWp2ampBalFMFkmDk6pBkaVx2dzb8WzaZk6yU8x/9P1U7Tzx5K8Bclt R7KkdWaYmO+46uFf+kF/64PLle26d6fuCli0m+vbsfueM0pYPdxmVvwsl9/Y/0s7bMrmYEnL YoZfH855RplbneubpnPu6AVpjXtXtr8qVLh/UEQl6w7z93trk1jmiz9SC72Zd/lH4F226svr LY2UWIozEg21mIuKEwGf7nWnKgIAAA== X-CMS-MailID: 20190329075746epcas1p19e5a93c1f593b5fed3f98eddf9159aa5 CMS-TYPE: 101P X-CMS-RootMailID: 20190329075746epcas1p19e5a93c1f593b5fed3f98eddf9159aa5 References: <1553846032-4451-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 associates stream limit (count of streams exposed by driver) with request queue. Signed-off-by: Kanchan Joshi --- block/blk-settings.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/block/blk-settings.c b/block/blk-settings.c index 3e7038e..bb0da61 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 From patchwork Fri Mar 29 07:53:48 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kanchan Joshi X-Patchwork-Id: 10876565 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 79C93922 for ; Fri, 29 Mar 2019 07:58:28 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 6E2C529077 for ; Fri, 29 Mar 2019 07:58:28 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 619B92907A; Fri, 29 Mar 2019 07:58:28 +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 12CE329077 for ; Fri, 29 Mar 2019 07:58:28 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729038AbfC2H5y (ORCPT ); Fri, 29 Mar 2019 03:57:54 -0400 Received: from mailout2.samsung.com ([203.254.224.25]:21991 "EHLO mailout2.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729037AbfC2H5x (ORCPT ); Fri, 29 Mar 2019 03:57:53 -0400 Received: from epcas2p3.samsung.com (unknown [182.195.41.55]) by mailout2.samsung.com (KnoxPortal) with ESMTP id 20190329075750epoutp0270df5fdeeffc9ff7dca52ed6838607bf~QXvNkw8WY0250102501epoutp02p; Fri, 29 Mar 2019 07:57:50 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout2.samsung.com 20190329075750epoutp0270df5fdeeffc9ff7dca52ed6838607bf~QXvNkw8WY0250102501epoutp02p DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1553846270; bh=GFd2cqqQm4KEQ7WGWfLlMJoZlKkcBBpbm5t3n+981Ec=; h=From:To:Cc:Subject:Date:In-reply-to:References:From; b=ZryUbLnmcpdZknCRb6RPVfOEezZtXNQI5cg0oVbGHAra62cNtQgisWqZW+IQqnC8n wn65PAkEd25JHCKMGmG37csvSSkpKM/VogQZv1EXL1f0eZDlKNhD3oqSVyDg7KVWDg kSNXL/5o2wyCPvl4mZPBQFpLN6bzibI/FTpm0cSA= Received: from epsmges2p4.samsung.com (unknown [182.195.42.72]) by epcas2p2.samsung.com (KnoxPortal) with ESMTP id 20190329075750epcas2p2e2852ebf4eef202afe7a9f9c8ac48529~QXvNMZfkZ2644326443epcas2p22; Fri, 29 Mar 2019 07:57:50 +0000 (GMT) Received: from epcas2p3.samsung.com ( [182.195.41.55]) by epsmges2p4.samsung.com (Symantec Messaging Gateway) with SMTP id 75.F1.04207.EFFCD9C5; Fri, 29 Mar 2019 16:57:50 +0900 (KST) Received: from epsmgms2p2new.samsung.com (unknown [182.195.42.143]) by epcas2p2.samsung.com (KnoxPortal) with ESMTP id 20190329075749epcas2p22b85cbdbb7ccb4f7f3ecf69b84f75dc9~QXvMgyc711454914549epcas2p2M; Fri, 29 Mar 2019 07:57:49 +0000 (GMT) X-AuditID: b6c32a48-6a1ff7000000106f-34-5c9dcffefa1b Received: from epmmp1.local.host ( [203.254.227.16]) by epsmgms2p2new.samsung.com (Symantec Messaging Gateway) with SMTP id EC.CF.03620.DFFCD9C5; Fri, 29 Mar 2019 16:57:49 +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 <0PP40008VBFTTN20@mmp1.samsung.com>; Fri, 29 Mar 2019 16:57:49 +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: axboe@fb.com, prakash.v@samsung.com, anshul@samsung.com, joshiiitr@gmail.com, Kanchan Joshi Subject: [PATCH v3 3/7] block: add write-hint to stream-id conversion Date: Fri, 29 Mar 2019 13:23:48 +0530 Message-id: <1553846032-4451-4-git-send-email-joshi.k@samsung.com> X-Mailer: git-send-email 2.7.4 In-reply-to: <1553846032-4451-1-git-send-email-joshi.k@samsung.com> X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFlrJIsWRmVeSWpSXmKPExsWy7bCmue6/83NjDBZ/lLD4PX0Kq8X/PcfY LI7+f8tmcf7tYSaLvbe0LWbOu8NmsWfvSRaLy7vmsFnMX/aU3eLKlEXMDlweE5vfsXvsnHWX 3WPzknqPvi2rGD0+b5ILYI3isklJzcksSy3St0vgypj49QZTwTG+ikfLNrE0MP7k7mLk5JAQ MJG4OWUeUxcjF4eQwA5Gif2310A53xklfs7fyQJTtWDlMqjEbkaJb4cWsEI405kkdv6eDuRw cLAJaEp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hZlVqUH19UmpNafIhR moNFSZyXP/9YpJBAemJJanZqakFqEUyWiYNTqoFx1QxWBpkfQeKd185kytgWLji5oPKn5Dfe EH+TRb+son/YurnPvXE2au69tIzuhHoba+6YppKilyZFdm/PVrRGVqrNaX4aZTKx9At/b8P2 LYx23GaTD+nHlgfu2dFtFeuw7sfWHVbPvms8qNGO9z+q0iTvuUqLb/LfGcF7z31QmLrS+PWO b81KLMUZiYZazEXFiQB9ziQhKgIAAA== X-CMS-MailID: 20190329075749epcas2p22b85cbdbb7ccb4f7f3ecf69b84f75dc9 CMS-TYPE: 102P X-CMS-RootMailID: 20190329075749epcas2p22b85cbdbb7ccb4f7f3ecf69b84f75dc9 References: <1553846032-4451-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 Earlier this conversion was done by driver (nvme). Current conversion is of the form "streamid = write-hint - 1", for both user and kernel streams (note that existing infra takes care that user-streams do not bump into kernel ones). Conversion takes stream limit (maintained in request queue) into account. Write-hints beyond the queue-limit turn to 0. 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 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/block/blk-core.c b/block/blk-core.c index 3c5f61c..c86daed 100644 --- a/block/blk-core.c +++ b/block/blk-core.c @@ -727,6 +727,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) @@ -735,6 +754,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); From patchwork Fri Mar 29 07:53:49 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kanchan Joshi X-Patchwork-Id: 10876549 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 EEE87186D for ; Fri, 29 Mar 2019 07:58:05 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id E2E9E29077 for ; Fri, 29 Mar 2019 07:58:05 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id D6FA52907A; Fri, 29 Mar 2019 07:58:05 +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 85C5829077 for ; Fri, 29 Mar 2019 07:58:05 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729056AbfC2H57 (ORCPT ); Fri, 29 Mar 2019 03:57:59 -0400 Received: from mailout2.samsung.com ([203.254.224.25]:22029 "EHLO mailout2.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729046AbfC2H56 (ORCPT ); Fri, 29 Mar 2019 03:57:58 -0400 Received: from epcas1p2.samsung.com (unknown [182.195.41.46]) by mailout2.samsung.com (KnoxPortal) with ESMTP id 20190329075754epoutp026ea0cde0c9fb5943454e57bd94f00aa3~QXvQ6ZkKX0250102501epoutp02u; Fri, 29 Mar 2019 07:57:54 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout2.samsung.com 20190329075754epoutp026ea0cde0c9fb5943454e57bd94f00aa3~QXvQ6ZkKX0250102501epoutp02u DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1553846274; bh=m/4T9WC/PqjxETlqSCQrMqU+MwhIfpKT2Hm8sepu9eU=; h=From:To:Cc:Subject:Date:In-reply-to:References:From; b=N072ZS+mFgWzUBiixloK2l+90kyWTofxNDEGC5LOEI1SuxfApjSIXfRw/vG1bfr4D sLQp2N1JRC8it0c0d9UrctR1obquhuVal+uiJVo/mXrFhtScQxBm0IS/z3qA7/KSf4 WkrGAcxx5nYecMkLrAzmOPDxX5c+flT4gFZVhN0M= Received: from epsmges1p3.samsung.com (unknown [182.195.42.55]) by epcas1p3.samsung.com (KnoxPortal) with ESMTP id 20190329075753epcas1p3a3c11cf9e270d2158e749c2d499b962e~QXvQCOmMv2558425584epcas1p3c; Fri, 29 Mar 2019 07:57:53 +0000 (GMT) Received: from epcas1p2.samsung.com ( [182.195.41.46]) by epsmges1p3.samsung.com (Symantec Messaging Gateway) with SMTP id DF.34.04143.100DD9C5; Fri, 29 Mar 2019 16:57:53 +0900 (KST) Received: from epsmgms2p1new.samsung.com (unknown [182.195.42.142]) by epcas1p1.samsung.com (KnoxPortal) with ESMTP id 20190329075753epcas1p16ce37362f83ccb8520a782b845dcb905~QXvPwS9q_1918919189epcas1p1J; Fri, 29 Mar 2019 07:57:53 +0000 (GMT) X-AuditID: b6c32a37-f19ff7000000102f-9c-5c9dd0016cbc Received: from epmmp1.local.host ( [203.254.227.16]) by epsmgms2p1new.samsung.com (Symantec Messaging Gateway) with SMTP id A8.7F.03598.100DD9C5; Fri, 29 Mar 2019 16:57: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 <0PP40008VBFTTN20@mmp1.samsung.com>; Fri, 29 Mar 2019 16:57: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: axboe@fb.com, prakash.v@samsung.com, anshul@samsung.com, joshiiitr@gmail.com, Kanchan Joshi Subject: [PATCH v3 4/7] nvme: register stream info with block layer Date: Fri, 29 Mar 2019 13:23:49 +0530 Message-id: <1553846032-4451-5-git-send-email-joshi.k@samsung.com> X-Mailer: git-send-email 2.7.4 In-reply-to: <1553846032-4451-1-git-send-email-joshi.k@samsung.com> X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFlrKIsWRmVeSWpSXmKPExsWy7bCmni7jhbkxBsvuylv8nj6F1eL/nmNs Fkf/v2WzOP/2MJPF3lvaFjPn3WGz2LP3JIvF5V1z2CzmL3vKbnFlyiJmBy6Pic3v2D12zrrL 7rF5Sb1H35ZVjB6fN8kFsEZx2aSk5mSWpRbp2yVwZdy638tSMEmwYkP7Z6YGxp+8XYycHBIC JhL3n/WydzFycQgJ7GCUWNvdzQrhfGeU+P55EyNMVfuWHhaIxG5GiV2n3jOBJIQEpjNJtOxM 7mLk4GAT0JS4MLkUpEZEYA6jxLJ905hBapgFyiX+TrkKNkhYwFni+s0usDiLgKrEw003wOK8 Ak4SU/q+QS2Tk7h5rhOshhOo/uP1ZrDFEgJL2CQmP7vIDrJMQsBFYl+jHoQpLXHpqC1Ea7HE rztHmSHKOxglrjfMZIFI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NYus0Tj2oWvZ/nUsbvZzZmyezaIgdfzcw1W37FuXt/0UbtS2+VX3zubyMm6GRLUCN277DRv/ piuxFGckGmoxFxUnAgAtqzszKwIAAA== X-CMS-MailID: 20190329075753epcas1p16ce37362f83ccb8520a782b845dcb905 CMS-TYPE: 101P X-CMS-RootMailID: 20190329075753epcas1p16ce37362f83ccb8520a782b845dcb905 References: <1553846032-4451-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 nvme registes number of streams with block layer, which will use that for write-hint to streamid 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 | 19 ++++++------------- 1 file changed, 6 insertions(+), 13 deletions(-) diff --git a/drivers/nvme/host/core.c b/drivers/nvme/host/core.c index 150e497..e34386b 100644 --- a/drivers/nvme/host/core.c +++ b/drivers/nvme/host/core.c @@ -513,14 +513,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; } @@ -533,12 +526,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; @@ -3138,6 +3128,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; @@ -3149,6 +3140,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 Fri Mar 29 07:53:50 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kanchan Joshi X-Patchwork-Id: 10876553 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 38AAA922 for ; Fri, 29 Mar 2019 07:58:21 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 2E99729077 for ; Fri, 29 Mar 2019 07:58:21 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 22A682907A; Fri, 29 Mar 2019 07:58:21 +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 BBF4C29077 for ; Fri, 29 Mar 2019 07:58:20 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729090AbfC2H6G (ORCPT ); Fri, 29 Mar 2019 03:58:06 -0400 Received: from mailout2.samsung.com ([203.254.224.25]:22059 "EHLO mailout2.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729037AbfC2H6A (ORCPT ); Fri, 29 Mar 2019 03:58:00 -0400 Received: from epcas2p1.samsung.com (unknown [182.195.41.53]) by mailout2.samsung.com (KnoxPortal) with ESMTP id 20190329075756epoutp02e3049f6b1b71f877ff6d28fc120e19f8~QXvTEMoOB0251002510epoutp02x; Fri, 29 Mar 2019 07:57:56 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout2.samsung.com 20190329075756epoutp02e3049f6b1b71f877ff6d28fc120e19f8~QXvTEMoOB0251002510epoutp02x DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1553846276; bh=o2dx41Jhej6AqxcttNIRSbItvBM9G6Zdz2rRQgL4ChM=; h=From:To:Cc:Subject:Date:In-reply-to:References:From; b=ndlrwYuZ/sX4+kSIrfHkkY0qgl8ya4DrXs4GVr7ffCZK0laiFkqB4d+Pe04FDVywi q2PKp7hTWxFwADQyx6pj0bohiLUr6JyQ67/Vs7c94LrhMVf1S2NaMG44bFlH7i4C0a Q2vkqpjUp1UOgurTr+IiTA0JXTmgUwJ2QsmpB40w= Received: from epsmges2p4.samsung.com (unknown [182.195.42.72]) by epcas2p2.samsung.com (KnoxPortal) with ESMTP id 20190329075756epcas2p210aace814bd6c7972388c31e6e2e199f~QXvSfDiyP3185131851epcas2p2y; Fri, 29 Mar 2019 07:57:56 +0000 (GMT) Received: from epcas2p4.samsung.com ( [182.195.41.56]) by epsmges2p4.samsung.com (Symantec Messaging Gateway) with SMTP id FF.F1.04207.400DD9C5; Fri, 29 Mar 2019 16:57:56 +0900 (KST) Received: from epsmgms2p2new.samsung.com (unknown [182.195.42.143]) by epcas2p2.samsung.com (KnoxPortal) with ESMTP id 20190329075755epcas2p2d2670db217ae3519d2c4b93d5e3749d1~QXvSND9UU1387513875epcas2p2X; Fri, 29 Mar 2019 07:57:55 +0000 (GMT) X-AuditID: b6c32a48-689ff7000000106f-45-5c9dd0046a3b Received: from epmmp1.local.host ( [203.254.227.16]) by epsmgms2p2new.samsung.com (Symantec Messaging Gateway) with SMTP id 9D.CF.03620.300DD9C5; Fri, 29 Mar 2019 16:57: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 <0PP40008VBFTTN20@mmp1.samsung.com>; Fri, 29 Mar 2019 16:57: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: axboe@fb.com, prakash.v@samsung.com, anshul@samsung.com, joshiiitr@gmail.com, Kanchan Joshi Subject: [PATCH v3 5/7] fs: introduce APIs to enable sending write-hint with buffer-head Date: Fri, 29 Mar 2019 13:23:50 +0530 Message-id: <1553846032-4451-6-git-send-email-joshi.k@samsung.com> X-Mailer: git-send-email 2.7.4 In-reply-to: <1553846032-4451-1-git-send-email-joshi.k@samsung.com> X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFlrOIsWRmVeSWpSXmKPExsWy7bCmhS7LhbkxBm9fsVv8nj6F1eL/nmNs Fkf/v2WzOP/2MJPF3lvaFjPn3WGz2LP3JIvF5V1z2CzmL3vKbnFlyiJmBy6Pic3v2D12zrrL 7rF5Sb1H35ZVjB6fN8kFsEZx2aSk5mSWpRbp2yVwZTz7eYm14JFwxcZHE5kaGE8KdDFyckgI mEhsaZ7L0sXIxSEksINRYtmHC+wQzndGiVfP1jHCVLWc/8sIkdjNKPHs1Q4WkISQwHQmiQeH DLsYOTjYBDQlLkwuBakREZgDNGnfNGaQGmaBcom/U64ygtQ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OTS1ILYLJMnFwSjUwluZvMzrWueXpofBT9wUMNknvX+S5fJNg+BpT re1F7CtP/d1+yL+feepN5emp56eoFOz67VpncW5y/5RlGnliU6IP7I5nmmZvtHw+R29l66Xq O1t28MzfJnph883sK2KfnPaHLo8NCW/elZi5YQKDv67Yvd7tCyT94jdWRF+bG25nWZwZ8Pjh byWW4oxEQy3mouJEAB+RxC4oAgAA X-CMS-MailID: 20190329075755epcas2p2d2670db217ae3519d2c4b93d5e3749d1 CMS-TYPE: 102P X-CMS-RootMailID: 20190329075755epcas2p2d2670db217ae3519d2c4b93d5e3749d1 References: <1553846032-4451-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 down. 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 52d024b..19cf910 100644 --- a/fs/buffer.c +++ b/fs/buffer.c @@ -3094,6 +3094,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 @@ -3151,6 +3158,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); @@ -3158,9 +3172,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 Fri Mar 29 07:53:51 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kanchan Joshi X-Patchwork-Id: 10876561 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 86E111669 for ; Fri, 29 Mar 2019 07:58:25 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 7CFFC29077 for ; Fri, 29 Mar 2019 07:58:25 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 714242907A; Fri, 29 Mar 2019 07:58:25 +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 213CC29077 for ; Fri, 29 Mar 2019 07:58:25 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729076AbfC2H6E (ORCPT ); Fri, 29 Mar 2019 03:58:04 -0400 Received: from mailout2.samsung.com ([203.254.224.25]:22079 "EHLO mailout2.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729046AbfC2H6C (ORCPT ); Fri, 29 Mar 2019 03:58:02 -0400 Received: from epcas1p3.samsung.com (unknown [182.195.41.47]) by mailout2.samsung.com (KnoxPortal) with ESMTP id 20190329075759epoutp027aca1c256b690275046284881e2748e3~QXvVW50Qk0251002510epoutp020; Fri, 29 Mar 2019 07:57:59 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout2.samsung.com 20190329075759epoutp027aca1c256b690275046284881e2748e3~QXvVW50Qk0251002510epoutp020 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1553846279; bh=IiZuU0ik+67oCr4Hd99R0DlNPChW1bLKnqJnQVC6KJM=; h=From:To:Cc:Subject:Date:In-reply-to:References:From; b=JJTVJXPCHnjAoQLWu5IwFkIuBh790afoO/B60aqphnD1dCyFgu6vberuW4mWVU1/A 6yQplHZnVzCO8eL6PyRdfcOKH7p7FAH+aBn4AJeVV3o6GCZfn7vlpNG61zLcNOAB1C HtpGN77OIgdCXmPBhe/RdqhYQBI9W12CZS689wH8= Received: from epsmges1p5.samsung.com (unknown [182.195.42.57]) by epcas1p4.samsung.com (KnoxPortal) with ESMTP id 20190329075759epcas1p4a83c17b18b8dd41c11e3f57c2e218e59~QXvVJiz_D0188401884epcas1p4w; Fri, 29 Mar 2019 07:57:59 +0000 (GMT) Received: from epcas1p3.samsung.com ( [182.195.41.47]) by epsmges1p5.samsung.com (Symantec Messaging Gateway) with SMTP id 26.B2.04108.600DD9C5; Fri, 29 Mar 2019 16:57:58 +0900 (KST) Received: from epsmgms2p1new.samsung.com (unknown [182.195.42.142]) by epcas1p3.samsung.com (KnoxPortal) with ESMTP id 20190329075758epcas1p335511dcb10bb5592ea72409a1d01e752~QXvUmpArt2752527525epcas1p3c; Fri, 29 Mar 2019 07:57:58 +0000 (GMT) X-AuditID: b6c32a39-8b7ff7000000100c-9d-5c9dd00644be Received: from epmmp1.local.host ( [203.254.227.16]) by epsmgms2p1new.samsung.com (Symantec Messaging Gateway) with SMTP id EA.7F.03598.600DD9C5; Fri, 29 Mar 2019 16:57: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 <0PP40008VBFTTN20@mmp1.samsung.com>; Fri, 29 Mar 2019 16:57: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: axboe@fb.com, prakash.v@samsung.com, anshul@samsung.com, joshiiitr@gmail.com, Kanchan Joshi Subject: [PATCH v3 6/7] fs: introduce write-hint start point for in-kernel hints Date: Fri, 29 Mar 2019 13:23:51 +0530 Message-id: <1553846032-4451-7-git-send-email-joshi.k@samsung.com> X-Mailer: git-send-email 2.7.4 In-reply-to: <1553846032-4451-1-git-send-email-joshi.k@samsung.com> X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFlrBIsWRmVeSWpSXmKPExsWy7bCmvi7bhbkxBu+WW1v8nj6F1eL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Xo3WBGbgKbEhcmlIHERgTmMEj2717OCxJkFyiWm bOLsYuTkEBYIkDh+9iILiM0ioCrxeM9NMJtXwEni3ct+ZhBbQkBO4ua5TjCbU8BZ4uP1ZrAa IaCatfcb2Ccw8ixgZFjFKJlaUJybnltsVGCYl1quV5yYW1yal66XnJ+7iREYXNsOa/XtYLy/ JP4QowAHoxIP74ydc2KEWBPLiitzDzFKcDArifAGnpsbI8SbklhZlVqUH19UmpNafIhRmoNF SZz3dt6xSCGB9MSS1OzU1ILUIpgsEwenVANjkuTlo8YZ6Tus7j12Xy4bN71V9/epeQqOV04/ 6z/R5uZzievVlgUlT9+o6T1SXdweIX8kY4WTYc/97vRV34U6PCw9hCa8ucD6tOeyUtKn3gMn zpis1zNLsu6/Zjw7olfn9PI1cv68u1jYlsfVPuuS9laKPW9s6a97/bkSZ3fui8/62U6/P+xQ YinOSDTUYi4qTgQAcNqBAioCAAA= X-CMS-MailID: 20190329075758epcas1p335511dcb10bb5592ea72409a1d01e752 CMS-TYPE: 101P X-CMS-RootMailID: 20190329075758epcas1p335511dcb10bb5592ea72409a1d01e752 References: <1553846032-4451-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 kernel-mode components can define own write-hints using "WRITE_LIFE_KERN_MIN" 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 29d8e2c..6a2673e 100644 --- a/include/linux/fs.h +++ b/include/linux/fs.h @@ -291,6 +291,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 Fri Mar 29 07:53:52 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kanchan Joshi X-Patchwork-Id: 10876557 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 0776A186D for ; Fri, 29 Mar 2019 07:58:23 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id EF42629077 for ; Fri, 29 Mar 2019 07:58:22 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id E0BE329079; Fri, 29 Mar 2019 07:58: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 5A2422907D for ; Fri, 29 Mar 2019 07:58:22 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729085AbfC2H6F (ORCPT ); Fri, 29 Mar 2019 03:58:05 -0400 Received: from mailout4.samsung.com ([203.254.224.34]:54866 "EHLO mailout4.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729071AbfC2H6D (ORCPT ); Fri, 29 Mar 2019 03:58:03 -0400 Received: from epcas2p2.samsung.com (unknown [182.195.41.54]) by mailout4.samsung.com (KnoxPortal) with ESMTP id 20190329075801epoutp04c1fec108b32434df87f50f4976867607~QXvXaO8VO1708117081epoutp046; Fri, 29 Mar 2019 07:58:01 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout4.samsung.com 20190329075801epoutp04c1fec108b32434df87f50f4976867607~QXvXaO8VO1708117081epoutp046 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1553846281; bh=E5wwBsBEqszLu5dTyefaKQBskuNKhYnyGEq6jYRnGPQ=; h=From:To:Cc:Subject:Date:In-reply-to:References:From; b=vcSXNcZaK2KYvTw9gaPG62J5NAvWFwx87eGFZf/lVlJx/wLIUbdixXYuo7fGfeX5F ipkRU586slxkBvfks8M2nzCrHsgChConZr+9hW1gnN8CdREGAKOsDA3UlAszVY4Ubg GUXAbiCajkpCW0SJ8NkZrbBJiZrwkZTY5xyx03k0= Received: from epsmges2p4.samsung.com (unknown [182.195.42.72]) by epcas2p1.samsung.com (KnoxPortal) with ESMTP id 20190329075801epcas2p1f79fdc4bebe14068fc0ef8d40df69182~QXvXCSoRn1450114501epcas2p13; Fri, 29 Mar 2019 07:58:01 +0000 (GMT) Received: from epcas2p4.samsung.com ( [182.195.41.56]) by epsmges2p4.samsung.com (Symantec Messaging Gateway) with SMTP id 9B.02.04207.800DD9C5; Fri, 29 Mar 2019 16:58:01 +0900 (KST) Received: from epsmgms2p2new.samsung.com (unknown [182.195.42.143]) by epcas2p4.samsung.com (KnoxPortal) with ESMTP id 20190329075800epcas2p4731f10eabf7d70dc7096117d161b05a3~QXvWypcB-2067620676epcas2p4A; Fri, 29 Mar 2019 07:58:00 +0000 (GMT) X-AuditID: b6c32a48-6a1ff7000000106f-5d-5c9dd008d417 Received: from epmmp1.local.host ( [203.254.227.16]) by epsmgms2p2new.samsung.com (Symantec Messaging Gateway) with SMTP id 7E.CF.03620.800DD9C5; Fri, 29 Mar 2019 16:58: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 <0PP40008VBFTTN20@mmp1.samsung.com>; Fri, 29 Mar 2019 16:58: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: axboe@fb.com, prakash.v@samsung.com, anshul@samsung.com, joshiiitr@gmail.com, Kanchan Joshi Subject: [PATCH v3 7/7] fs/ext4,jbd2: add support for passing write-hint with journal Date: Fri, 29 Mar 2019 13:23:52 +0530 Message-id: <1553846032-4451-8-git-send-email-joshi.k@samsung.com> X-Mailer: git-send-email 2.7.4 In-reply-to: <1553846032-4451-1-git-send-email-joshi.k@samsung.com> X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFlrGIsWRmVeSWpSXmKPExsWy7bCmhS7nhbkxBlfjLX5Pn8Jq8X/PMTaL o//fslmcf3uYyWLvLW2LmfPusFns2XuSxeLyrjlsFvOXPWW3uDJlEbMDl8fE5nfsHjtn3WX3 2Lyk3qNvyypGj8+b5AJYo7hsUlJzMstSi/TtErgypjQqFxxUqFi28wZbA2OHdBcjJ4eEgInE u2NHWLoYuTiEBHYwSqx5/JkJwvnOKNH66T0jTNWxBY9YQGwhgd2MEjemF0IUTWeSmP2vGaiI g4NNQFPiwuRSkLiIwBxGiWX7pjGDNDALlEv8nXIVbJCwQLjEp8dbwAaxCKhKXJzXDhbnFXCS mHt8HivEMjmJm+c6wXo5BZwlPl5vBjtPQmABm0TbncnsIMskBFwkbm31hqiXlni2aiPUocUS v+4cZYao72CUuN4wkwUiYS9xcc9fJoiD+CQ6Dv+FmsMr0dEmBFHiIfFi2hs2iMemMUqs7TvL PoFRYgEjwypGsdSC4tz01GKjAhO94sTc4tK8dL3k/NxNjODY0/LYwXjgnM8hRgEORiUe3g+7 58QIsSaWFVfmHmKU4GBWEuENPDc3Rog3JbGyKrUoP76oNCe1+BCjNAeLkjjvQ+m50UIC6Ykl qdmpqQWpRTBZJg5OqQbG1h7ZObr1CS7bL637u/c3n5KINoOcf5h0dJb+tyW7z6WflW85derq X8ezvWKtd6+3at7yWxFzhEm7U+uFo2W9g/Sj1brR1xPsVmiFstd7XLRu121lX72B1XLz4e/2 czMrfOUXnmbamblxc5G+0C2lizJdG8xvOnd/2O19dtN8hrym5xq/+mKUWIozEg21mIuKEwH9 +aQ6uQIAAA== X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFprGLMWRmVeSWpSXmKPExsVy+t9jAV2OC3NjDBbf1LP4PX0Kq8X/PcfY LI7+f8tmcf7tYSaLvbe0LWbOu8NmsWfvSRaLy7vmsFnMX/aU3eLKlEXMDlweE5vfsXvsnHWX 3WPzknqPvi2rGD0+b5ILYI3isklJzcksSy3St0vgypjSqFxwUKFi2c4bbA2MHdJdjJwcEgIm EscWPGIBsYUEdjJKrNhc2cXIBWTPZJL49+s/YxcjBwebgKbEhcmlIHERgTmMEj2717OCxJkF yiWmbOIE6RUWCJe4+u4sK4jNIqAqcXFeOyOIzSvgJDH3+DxWiF1yEjfPdTKD2JwCzhIfrzdD 7XWSWHu/gX0CI88CRoZVjJKpBcW56bnFRgVGeanlesWJucWleel6yfm5mxiBobXtsFb/DsbH S+IPMQpwMCrx8M7YOSdGiDWxrLgy9xCjBAezkghv4Lm5MUK8KYmVValF+fFFpTmpxYcYpTlY lMR5+fOPRQoJpCeWpGanphakFsFkmTg4pRoYJQ/Zsl9o7d/JVxt9IP6V3d/8wNk7beUeCP/g 5Nw74ef68tCtz02OXAi0b/XUc994zN1NTezu7JT6Fd7JXwK2twRdarJb9pk1/lS83MQn7r4l QaVmDx6edN7/8txXh/bQ2BtMorPey31sul8+3UHt19T0CWsPr4yZXSBT2hzO1brUcYdZkZKp EktxRqKhFnNRcSIAZVPYiCkCAAA= X-CMS-MailID: 20190329075800epcas2p4731f10eabf7d70dc7096117d161b05a3 CMS-TYPE: 102P X-CMS-RootMailID: 20190329075800epcas2p4731f10eabf7d70dc7096117d161b05a3 References: <1553846032-4451-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 (as SHORT) 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 15b6dd7..b589ca4 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 fb12d3c..9c2c73e 100644 --- a/fs/ext4/super.c +++ b/fs/ext4/super.c @@ -4289,6 +4289,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 2eb55c3..6da4c28 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; @@ -711,7 +713,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 8ef6b6d..804dc2c 100644 --- a/fs/jbd2/journal.c +++ b/fs/jbd2/journal.c @@ -1384,7 +1384,8 @@ static int jbd2_write_superblock(journal_t *journal, int write_flags) jbd2_superblock_csum_set(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: