From patchwork Tue Sep 10 15:01:55 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kanchan Joshi X-Patchwork-Id: 13798717 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.sourceforge.net (lists.sourceforge.net [216.105.38.7]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id EBEB2EDE99B for ; Tue, 10 Sep 2024 15:10:59 +0000 (UTC) Received: from [127.0.0.1] (helo=sfs-ml-4.v29.lw.sourceforge.com) by sfs-ml-4.v29.lw.sourceforge.com with esmtp (Exim 4.95) (envelope-from ) id 1so2W9-0005y4-Vd; Tue, 10 Sep 2024 15:10:57 +0000 Received: from [172.30.29.66] (helo=mx.sourceforge.net) by sfs-ml-4.v29.lw.sourceforge.com with esmtps (TLS1.2) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.95) (envelope-from ) id 1so2W8-0005xu-5W for linux-f2fs-devel@lists.sourceforge.net; Tue, 10 Sep 2024 15:10:56 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=sourceforge.net; s=x; h=References:Content-Type:Content-Transfer-Encoding: MIME-Version:Message-Id:Date:Subject:Cc:To:From:Sender:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:In-Reply-To:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=tMfHqVkUXqCWtSwhV1wBahjAVG+ZNtgPS/8uMug7K84=; b=dewl70HdcC3ZLgFitKM09FwBUu /SuOT+PW5ckJDKB9ntHcUJwYf6EFv6E9G38NJn73ue2sZIovjcde4LemYiYx8jSETymmHX3ORg+ya k93IUavVSmNiO08rNs2EL4ZVhQNgBW/EeOQnJ2DT8Sxcu8qTLYKN3rEhwe0VT4HyH7EM=; DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=sf.net; s=x ; h=References:Content-Type:Content-Transfer-Encoding:MIME-Version:Message-Id :Date:Subject:Cc:To:From:Sender:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: In-Reply-To:List-Id:List-Help:List-Unsubscribe:List-Subscribe:List-Post: List-Owner:List-Archive; bh=tMfHqVkUXqCWtSwhV1wBahjAVG+ZNtgPS/8uMug7K84=; b=S PxKZZWxmNchc4oD5yIDSQmalmhoffwvki61W8SQtiB7L1tDBH1cQnFTdZF6ONmxP5fGeBGwdKMGEn ElOwzIXfaII340zG5Qm83Fmu4WGaN7wHaDeJiLWjRrASLOcmXv0VIDvNv9TgaSTJr7grd6JYwxxk/ CK2VGV/d7kpezJPM=; Received: from mailout1.samsung.com ([203.254.224.24]) by sfi-mx-2.v28.lw.sourceforge.com with esmtps (TLS1.2:ECDHE-RSA-AES256-GCM-SHA384:256) (Exim 4.95) id 1so2W6-0006IL-Ic for linux-f2fs-devel@lists.sourceforge.net; Tue, 10 Sep 2024 15:10:56 +0000 Received: from epcas5p2.samsung.com (unknown [182.195.41.40]) by mailout1.samsung.com (KnoxPortal) with ESMTP id 20240910151042epoutp01f9c8eac4807ac0d19582920fee26ad00~z6p0GNApU0104601046epoutp01g for ; Tue, 10 Sep 2024 15:10:42 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout1.samsung.com 20240910151042epoutp01f9c8eac4807ac0d19582920fee26ad00~z6p0GNApU0104601046epoutp01g DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1725981042; bh=tMfHqVkUXqCWtSwhV1wBahjAVG+ZNtgPS/8uMug7K84=; h=From:To:Cc:Subject:Date:References:From; b=pcvIAVn/I1Bf/bXsOgx5w6iBRfwpdFuCQHqjJ4DMhUJK/RR+cse37Wq4k6ZFPCbfR IZauhR8TlenMhNGh9hap4go+nOlEsOaYnFkrbFuiqwDmrcXn/IBIWb4jlLyrvr7/gN xLM/cvd2dM6zhO6MnK7xomfDqpVsQ9lSRBLuFP9g= Received: from epsnrtp2.localdomain (unknown [182.195.42.163]) by epcas5p2.samsung.com (KnoxPortal) with ESMTP id 20240910151041epcas5p2048e076adae63fd931eff0bf46cfc739~z6pzhpH2J0258802588epcas5p2E; Tue, 10 Sep 2024 15:10:41 +0000 (GMT) Received: from epsmgec5p1new.samsung.com (unknown [182.195.38.182]) by epsnrtp2.localdomain (Postfix) with ESMTP id 4X36b43d18z4x9Pv; Tue, 10 Sep 2024 15:10:40 +0000 (GMT) Received: from epcas5p4.samsung.com ( [182.195.41.42]) by epsmgec5p1new.samsung.com (Symantec Messaging Gateway) with SMTP id 57.86.08855.07160E66; Wed, 11 Sep 2024 00:10:40 +0900 (KST) Received: from epsmtrp2.samsung.com (unknown [182.195.40.14]) by epcas5p3.samsung.com (KnoxPortal) with ESMTPA id 20240910151040epcas5p3f47fa7ea37a35f8b44dd9174689e1bb9~z6px9arLJ1076710767epcas5p3j; Tue, 10 Sep 2024 15:10:40 +0000 (GMT) Received: from epsmgms1p1new.samsung.com (unknown [182.195.42.41]) by epsmtrp2.samsung.com (KnoxPortal) with ESMTP id 20240910151040epsmtrp2d8703cd5c3ed857f83a2ea796785047b~z6px8alcl0448904489epsmtrp2v; Tue, 10 Sep 2024 15:10:40 +0000 (GMT) X-AuditID: b6c32a44-15fb870000002297-ea-66e061709026 Received: from epsmtip2.samsung.com ( [182.195.34.31]) by epsmgms1p1new.samsung.com (Symantec Messaging Gateway) with SMTP id 87.DC.08964.F6160E66; Wed, 11 Sep 2024 00:10:39 +0900 (KST) Received: from localhost.localdomain (unknown [107.99.41.245]) by epsmtip2.samsung.com (KnoxPortal) with ESMTPA id 20240910151035epsmtip265e38c1653c6a529f3d6411c350e9604~z6puGi-2A1662516625epsmtip2j; Tue, 10 Sep 2024 15:10:35 +0000 (GMT) From: Kanchan Joshi To: axboe@kernel.dk, kbusch@kernel.org, hch@lst.de, sagi@grimberg.me, martin.petersen@oracle.com, James.Bottomley@HansenPartnership.com, brauner@kernel.org, viro@zeniv.linux.org.uk, jack@suse.cz, jaegeuk@kernel.org, jlayton@kernel.org, chuck.lever@oracle.com, bvanassche@acm.org Date: Tue, 10 Sep 2024 20:31:55 +0530 Message-Id: <20240910150200.6589-1-joshi.k@samsung.com> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 X-Brightmail-Tracker: H4sIAAAAAAAAA02Te0xbVRzHPffe3ha05lIQjrAwrJvLmDCKUE4NDBMZuwuLIVkwmQr1hl4e A9qujzmNZhWETIi85mAwXntkQkEIZZsoYhy1vCdYxoBOSHElJCMbj85NBMGWy3T/fc7398r3 d84R4CIH6S/IVOpYjZLJFpOexA3z3uAQNWNPCysY9kXN0yUkWjCvAFSxtIqjzel5DE39/D2G mpotGLpQmYchR1s1jtpLBOje704+Wr1q5CPL5gMSlffcAajbtg9ZLx1CP3YPEKj+6hwfFU10 kuibvg0MtS4sEmjknz4eGqmu4b/lS4/dTqBHZtoJuqJ8kKTHbulpk/FLku64cpruanBidNeU gaSX52wEXXzNCOjhhl/4tNMUSJscD7BE4XtZ0Rkso2A1QawyVaXIVKbHiBOOyt+WR0rDJCES GYoSBymZHDZGHHckMSQ+M9vlWRx0ksnWu6RERqsV7z8QrVHpdWxQhkqrixGzakW2OkIdqmVy tHpleqiS1b0pCQsLj3QlfpiVYe/qwdUDAafKBpsxA1j0LgQeAkhFwLOTFqIQeApEVBeATTYT 7g6IqBUAHfl+XOAxgPMtrdjTCsvtXzEu0A2gqaMWcAcngKPWKbIQCAQktReOntW7dR+qDoO9 o5atJJwqx+Cy/VvS3crb1arZ4ABuJqjd0Gy0brGQioKWR3cBN24nrLI+4XO6FxyochBuxl16 3vULuLsppJYE8OboXzhXEAeflN7lc+wN7/dd22Z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uDC5FKRGRGAd k8SKaT4gNcwCc5gklnduZwZJCAMtWN3whBHEZhFQlTi86hKYzStgLnH0y21GiAXyEjMvfWeH iAtKnJz5hAXEZgaKN2+dzTyBkW8WktQsJKkFjEyrGCVTC4pz03OLDQsM81LL9YoTc4tL89L1 kvNzNzGC409Lcwfj9lUf9A4xMnEwHmKU4GBWEuHtt7uXJsSbklhZlVqUH19UmpNafIhRmoNF SZxX/EVvipBAemJJanZqakFqEUyWiYNTqoHJ6gffEdYCi0epl/5uf3BZ6KJJdbhnS6lDXHzC 9flRAc6ZZrkGKc/cJ/BIM/Qu2KN11a5oadWu0MBS470l7gXTDr+o1Jt00mALr8yOjxuEUxNW nGiZO6m029tSkb345wNdznlMUV8DRYtNznl+uzl/QavMk7h5n/eLd2xbeMJY6cesJRd80xpv qwhvt5mnPNOW/7P6bu78hiLvxSVhbxS8jQLm/zBgu3ZO2WfbOaXcc/WLFfv2sV0/waeyc7FC Jbf8us6/4Yenut9q/7FY97T+LFteU1vvrSeSK1OS8vN2cu08Mp15R9zZ9UYCFb6zVyxL+ilQ deib3Mc1gQdn9XC8Mn3aMt3d5kvC/ykbuJWVWIozEg21mIuKEwHCFYnNLgMAAA== X-CMS-MailID: 20240910151040epcas5p3f47fa7ea37a35f8b44dd9174689e1bb9 X-Msg-Generator: CA CMS-TYPE: 105P DLP-Filter: Pass X-CFilter-Loop: Reflected X-CMS-RootMailID: 20240910151040epcas5p3f47fa7ea37a35f8b44dd9174689e1bb9 References: X-Headers-End: 1so2W6-0006IL-Ic Subject: [f2fs-dev] [PATCH v5 0/5] data placement hints and FDP X-BeenThere: linux-f2fs-devel@lists.sourceforge.net X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: vishak.g@samsung.com, linux-scsi@vger.kernel.org, gost.dev@samsung.com, linux-nvme@lists.infradead.org, linux-f2fs-devel@lists.sourceforge.net, linux-block@vger.kernel.org, linux-fsdevel@vger.kernel.org, javier.gonz@samsung.com Errors-To: linux-f2fs-devel-bounces@lists.sourceforge.net Current write-hint infrastructure supports 6 temperature-based data lifetime hints. The series extends the infrastructure with a new temperature-agnostic placement-type hint. New fcntl codes F_{SET/GET}_RW_HINT_EX allow to send the hint type/value on file. See patch #3 commit description and interface example below [*]. Overall this creates 127 placement hint values that users can pass. Patch #5 adds the ability to map these new hint values to nvme-specific placement-identifiers. Patch #4 restricts SCSI to use only lifetime hint values. Patch #1 and #2 are simple prep patches. [*] #define _GNU_SOURCE #include #include #include #include #include #include #include int main(int argc, char *argv[]) { struct rw_hint_ex set_hint_ex={}, get_hint_ex={}; int fd, ret; if (argc < 4) { fprintf(stderr, "Usage: %s file \n", argv[0]); return 1; } fd = open(argv[1], O_CREAT|O_RDWR|O_DIRECT, 0644); if (fd < 0) { perror("open"); return 1; } set_hint_ex.type = atoi(argv[2]); set_hint_ex.val = atol(argv[3]); ret = fcntl(fd, F_SET_RW_HINT_EX, &set_hint_ex); if (ret < 0) { perror("fcntl: Error, F_SET_RW_HINT_EX"); goto close_fd; } ret = fcntl(fd, F_GET_RW_HINT_EX, &get_hint_ex); if (ret < 0) { perror("fcntl: Error, F_GET_RW_HINT_EX"); goto close_fd; } printf("set_hint (%d,%llu)\nget_hint (%d,%llu)\n", set_hint_ex.type, set_hint_ex.val, get_hint_ex.type, get_hint_ex.val); close_fd: close(fd); return 0; } /* set placement hint (type 2) with value 126 */ # ./a.out /dev/nvme0n1 2 126 set_hint (2,126) get_hint (2,126) /* invalid placement hint value */ # ./a.out /dev/nvme0n1 2 128 fcntl: Error, F_SET_RW_HINT_EX: Invalid argument Changes since v4: - Retain the size/type checking on the enum (Bart) - Use the name "*_lifetime_hint" rather than "*_life_hint" (Bart) Changes since v3: - 4 new patches to introduce placement hints - Make nvme patch use the placement hints rather than lifetime hints Changes since v2: - Base it on nvme-6.11 and resolve a merge conflict Changes since v1: - Reduce the fetched plids from 128 to 6 (Keith) - Use struct_size for a calculation (Keith) - Handle robot/sparse warning Kanchan Joshi (4): fs, block: refactor enum rw_hint fcntl: rename rw_hint_* to rw_lifetime_hint_* fcntl: add F_{SET/GET}_RW_HINT_EX nvme: enable FDP support Nitesh Shetty (1): sd: limit to use write life hints drivers/nvme/host/core.c | 81 ++++++++++++++++++++++++++++++++++++++ drivers/nvme/host/nvme.h | 4 ++ drivers/scsi/sd.c | 7 ++-- fs/buffer.c | 4 +- fs/f2fs/f2fs.h | 5 ++- fs/f2fs/segment.c | 5 ++- fs/fcntl.c | 79 ++++++++++++++++++++++++++++++++++--- include/linux/blk-mq.h | 2 +- include/linux/blk_types.h | 2 +- include/linux/fs.h | 2 +- include/linux/nvme.h | 19 +++++++++ include/linux/rw_hint.h | 17 +++++++- include/uapi/linux/fcntl.h | 14 +++++++ 13 files changed, 221 insertions(+), 20 deletions(-)