Received: by 2002:a05:6902:102b:0:0:0:0 with SMTP id x11csp3957882ybt; Sun, 5 Jul 2020 11:52:56 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyGewHVq869Mu8OxE3lAtQQsoJ4fbpmWb9KVT3GLO2WautLX7c/Wlk7/2Uwqfv+tydyE2nb X-Received: by 2002:a50:ec8b:: with SMTP id e11mr40574157edr.344.1593975176658; Sun, 05 Jul 2020 11:52:56 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1593975176; cv=none; d=google.com; s=arc-20160816; b=dBoWbXj7dkep/Eb3hkSnYr4CqnWX7ehsnyONP7+45PshH0DpJ6/8JTd70eUbCN6SL9 GlIbCv4UH7I7nt1cr1KsI5PYnWvNP/Y8+UdkpLXEUckB4qLb4mGBpf0PKhfcRcqN6Sju WcBe+OZLPS8sLwwfAlQqm/yejxlVEGvIteC+I2I77fjSTZnPVmVkRS2VbYw0zElP5stQ JaPFNftaavLkCzUdTcrxafPlyK9Eu4SDgOp2cDlxZYUu22ok5fOWH0y/qxYV+j9a8LpA DjSWpm6b1x3Tl03JRD23lLzSBaliQ3akzTpSHWKCwiRBOeCBHXFNXt8ZJt8HAuCH2QeX Q6oQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:cms-type:in-reply-to :message-id:date:subject:cc:to:from:dkim-signature:dkim-filter; bh=EdQAf5+zw6N5J2+HOrsvrQfxx8kc7JZeLZVVK6M6PcA=; b=0ZQM2yvGLANK0Yt3fzo3e9RFRjm1BfhlXJTgek6JYBkInr8UAm6JF5nuRrsktSsWHv oBIt2rhlddhFoOO9x1o1e8Dar/w4xBTR3g88utb+WlPUMMDR5WogJeeFCnMIDgtzEk8m YOQvtdA1nhMP5WkreaalnQwtSNZbsrmfUYy7BLcwbJuWYkGL/2BIaan+iNEPS7enyHC4 3jMK15Pw8IivMbEqRyO7qePr8sBerljDYVRMECBDbmq8dH6xkqunlU7a0vgLkJo+eNvv K876C/qJUOgj82AU9ioyszlQlAqOwYCaV4P91eJLlUf5hsQoFXoG58AnLpOLL9q9UtFa Q1uQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@samsung.com header.s=mail20170921 header.b=TCGvSGVy; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=samsung.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id c11si11420388edy.498.2020.07.05.11.52.34; Sun, 05 Jul 2020 11:52:56 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@samsung.com header.s=mail20170921 header.b=TCGvSGVy; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=samsung.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728104AbgGESwT (ORCPT + 99 others); Sun, 5 Jul 2020 14:52:19 -0400 Received: from mailout3.samsung.com ([203.254.224.33]:40468 "EHLO mailout3.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728109AbgGESwR (ORCPT ); Sun, 5 Jul 2020 14:52:17 -0400 Received: from epcas5p4.samsung.com (unknown [182.195.41.42]) by mailout3.samsung.com (KnoxPortal) with ESMTP id 20200705185214epoutp0360df4559c5df4652f52b9bda6fee2bd8~e7-BwBiqy2496824968epoutp03X for ; Sun, 5 Jul 2020 18:52:14 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout3.samsung.com 20200705185214epoutp0360df4559c5df4652f52b9bda6fee2bd8~e7-BwBiqy2496824968epoutp03X DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1593975134; bh=EdQAf5+zw6N5J2+HOrsvrQfxx8kc7JZeLZVVK6M6PcA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=TCGvSGVyqOKSya2EEIuudSvnZj5fnJRrSwoTnr5kY4jH09H83B+QgsK0iBJcrOiAi PNhxyOeKwO5R1lWtfF/DzJ/mHJ+Wma5Gw/8kDUD84szYoe9LttBuX0NhA2tsU9hvNY Bag031VVnUjczQb3NDjpYsXQqftHbSBpkWOoBU44= Received: from epsmges5p2new.samsung.com (unknown [182.195.42.74]) by epcas5p3.samsung.com (KnoxPortal) with ESMTP id 20200705185212epcas5p3f7db3dbbf75a909dbc5d85f66b033014~e7-AqOR6C0482204822epcas5p3x; Sun, 5 Jul 2020 18:52:12 +0000 (GMT) Received: from epcas5p4.samsung.com ( [182.195.41.42]) by epsmges5p2new.samsung.com (Symantec Messaging Gateway) with SMTP id 4F.B7.09703.C51220F5; Mon, 6 Jul 2020 03:52:12 +0900 (KST) Received: from epsmtrp1.samsung.com (unknown [182.195.40.13]) by epcas5p4.samsung.com (KnoxPortal) with ESMTPA id 20200705185211epcas5p4059d05d2fcedb91829300a7a7d03fda3~e7_-ewc7F1418914189epcas5p45; Sun, 5 Jul 2020 18:52:11 +0000 (GMT) Received: from epsmgms1p2.samsung.com (unknown [182.195.42.42]) by epsmtrp1.samsung.com (KnoxPortal) with ESMTP id 20200705185211epsmtrp1bb12d193d2271b7451da13042d046c6d~e7_-dwRAV0303903039epsmtrp10; Sun, 5 Jul 2020 18:52:11 +0000 (GMT) X-AuditID: b6c32a4a-4cbff700000025e7-37-5f02215c0cd3 Received: from epsmtip2.samsung.com ( [182.195.34.31]) by epsmgms1p2.samsung.com (Symantec Messaging Gateway) with SMTP id D9.37.08303.B51220F5; Mon, 6 Jul 2020 03:52:11 +0900 (KST) Received: from localhost.localdomain (unknown [107.110.206.5]) by epsmtip2.samsung.com (KnoxPortal) with ESMTPA id 20200705185209epsmtip2b4cf5e349418fb0b9c4ddd3670b42090~e7_9FQgN73204832048epsmtip2s; Sun, 5 Jul 2020 18:52:08 +0000 (GMT) From: Kanchan Joshi To: axboe@kernel.dk, viro@zeniv.linux.org.uk, bcrl@kvack.org Cc: hch@infradead.org, Damien.LeMoal@wdc.com, asml.silence@gmail.com, linux-fsdevel@vger.kernel.org, mb@lightnvm.io, linux-kernel@vger.kernel.org, linux-aio@kvack.org, io-uring@vger.kernel.org, linux-block@vger.kernel.org, Kanchan Joshi , Selvakumar S , Nitesh Shetty , Javier Gonzalez Subject: [PATCH v3 1/4] fs: introduce FMODE_ZONE_APPEND and IOCB_ZONE_APPEND Date: Mon, 6 Jul 2020 00:17:47 +0530 Message-Id: <1593974870-18919-2-git-send-email-joshi.k@samsung.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1593974870-18919-1-git-send-email-joshi.k@samsung.com> X-Brightmail-Tracker: H4sIAAAAAAAAA0WSaUwTURSFfTPTdopWJ8XEJ+JCgRhqRBE0z7jgho5GAvpLCYpVxkKEgi11 qxhAKaUNgkpksW5AFDGKFoJQBE21YkGoFmRLJaJFBXdwISAopVX/ffeec899uXkkzr/AciOj JQmMVCKKEbBdiIoHPsL54R5YxEJzmx8azslmIW1JBUDXX2SykXq0nECpaT8w1JBVgKFPqU0E em0d4CDj749slH02BaCaznnobo2JQM16LRsV33lIoIrhizhqyS7A0ftBExuZR+pYq/h0Vf4L Dl1WLKSbG+W0rv80h9Y8HwT0yfISQA/oZtFp9zUYrbN9xEK5YS7LI5mY6AOMdMHKXS5RhZ15 WLze9VDbryxWEkih1IBLQioAGqsfse3Mp6oBHLwfqAYuY9wP4NtXD4CjGAAwrcDG+jvRbqti OQQ9gPW1mcQ/182Ox5gakCSb8oFPz8jtOJVaDquKvOwWnErDYavJMh7kSm2GQw3vMDsTlDds vNgI7Myj1sJ6UynbsWwW7GhKx+3MpdZBZXUDbg+CVCUJW5Lfju+CY4LmK+3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PlyEjfPdYLt5RRwkWjbfZoZZL4QUM3US4oTGPkWMDKsYpRMLSjOTc8tNiww ykst1ytOzC0uzUvXS87P3cQIjgEtrR2Me1Z90DvEyMTBeIhRgoNZSYS3V5sxXog3JbGyKrUo P76oNCe1+BCjNAeLkjjv11kL44QE0hNLUrNTUwtSi2CyTBycUg1MJZOKTjFq/ymPNP230afs 44L3k6K3bDyU8CV3rWrA3vmZK5dPeyD45JALV98m3sVaQVHNOx0X6Rk0P79SEfuyQ4PH/0wJ Q5zipqszFjhOTGWZWXu96e6dLTdv5dot/2gqsk0tUGWqTXihZfLnbYJLC9TMCzcKaDBW/e3l 1pedyLhrJZ+PiJ+hvMH7o7/nss/3D5rS0nuQ6btzw5mCVkY/kWMt/1Xmfr183W7GidqE5TMz C9c1/tqyMuZEvX7kO5cU+RUSL/uv8c2cq+XYNefknsLVYX9kanh2PdPpUL0X5lpcsubk6swb XTlN3TuuxdTemrf/0RpP8ZzdqZauva8rhDUT11qd2My+z3KCuy+TEktxRqKhFnNRcSIAqAaK GPACAAA= X-CMS-MailID: 20200705185211epcas5p4059d05d2fcedb91829300a7a7d03fda3 X-Msg-Generator: CA Content-Type: text/plain; charset="utf-8" CMS-TYPE: 105P X-CMS-RootMailID: 20200705185211epcas5p4059d05d2fcedb91829300a7a7d03fda3 References: <1593974870-18919-1-git-send-email-joshi.k@samsung.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Enable zone-append using existing O_APPEND and RWF_APPEND infra. Unlike file-append, zone-apppend requires bit of additional processing in common path to send completion-result to upper layer. To skip that for non-zoned block-devices/files, introduce FMODE_ZONE_APPEND and IOCB_ZONE_APPEND. When a file is opened, it can subscribe to zone-append by setting FMODE_ZONE_APPEND. Add IOCB_ZONE_APPEND which is set in kiocb->ki_flags if write meets existing file-append critera, and file has subscribed to zone-append. Signed-off-by: Selvakumar S Signed-off-by: Kanchan Joshi Signed-off-by: Nitesh Shetty Signed-off-by: Javier Gonzalez --- include/linux/fs.h | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/include/linux/fs.h b/include/linux/fs.h index 6c4ab4d..ef13df4 100644 --- a/include/linux/fs.h +++ b/include/linux/fs.h @@ -175,6 +175,9 @@ typedef int (dio_iodone_t)(struct kiocb *iocb, loff_t offset, /* File does not contribute to nr_files count */ #define FMODE_NOACCOUNT ((__force fmode_t)0x20000000) +/* File can support zone-append */ +#define FMODE_ZONE_APPEND ((__force fmode_t)0x40000000) + /* * Flag for rw_copy_check_uvector and compat_rw_copy_check_uvector * that indicates that they should check the contents of the iovec are @@ -315,6 +318,7 @@ enum rw_hint { #define IOCB_SYNC (1 << 5) #define IOCB_WRITE (1 << 6) #define IOCB_NOWAIT (1 << 7) +#define IOCB_ZONE_APPEND (1 << 8) struct kiocb { struct file *ki_filp; @@ -3427,8 +3431,11 @@ static inline bool vma_is_fsdax(struct vm_area_struct *vma) static inline int iocb_flags(struct file *file) { int res = 0; - if (file->f_flags & O_APPEND) + if (file->f_flags & O_APPEND) { res |= IOCB_APPEND; + if (file->f_mode & FMODE_ZONE_APPEND) + res |= IOCB_ZONE_APPEND; + } if (file->f_flags & O_DIRECT) res |= IOCB_DIRECT; if ((file->f_flags & O_DSYNC) || IS_SYNC(file->f_mapping->host)) @@ -3454,8 +3461,11 @@ static inline int kiocb_set_rw_flags(struct kiocb *ki, rwf_t flags) ki->ki_flags |= IOCB_DSYNC; if (flags & RWF_SYNC) ki->ki_flags |= (IOCB_DSYNC | IOCB_SYNC); - if (flags & RWF_APPEND) + if (flags & RWF_APPEND) { ki->ki_flags |= IOCB_APPEND; + if (ki->ki_filp->f_mode & FMODE_ZONE_APPEND) + ki->ki_flags |= IOCB_ZONE_APPEND; + } return 0; } -- 2.7.4