Received: by 2002:a05:6902:102b:0:0:0:0 with SMTP id x11csp3391812ybt; Tue, 30 Jun 2020 01:20:49 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzfw+c6/yPOjnbsL80pvPVTUCPxw5P0gCzzTO/jgcmsl+MavupN0TCqICpRW1DoUXKefhI4 X-Received: by 2002:aa7:d353:: with SMTP id m19mr21067504edr.75.1593505248874; Tue, 30 Jun 2020 01:20:48 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1593505248; cv=none; d=google.com; s=arc-20160816; b=qFAdJVeMYyJOxYwJH7spb5f1uJ258v6m2M0uTrJAaYAX25Cb2xpvT90zqUDv0Ox7yf tqVK6NFHGqumhjPwvrATyifYYxI/50v8fOfbfnNctATA42zO9hliOh2erlGFoEZhTGiI VeMtFhhSUCeKzVr4DQkiQa2qLD4M6/kAF8NSrmV+u42U8dE5T9plqQnZ8qqVlCSDo1NJ S+kw3gE8G8ttho83XN6/mgjBqJ5zQqT4wU/MnzCTo55A2aCg28GAvOuP0ZxSAKY3J3p6 LW7OO4zInUEOhes2xu0sObSHAhnGV4uG2ibhQQv+Kxr8mFJ0u433YYwLgd7uhkDRCXW+ PH2A== 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:user-agent :in-reply-to:mime-version:message-id:subject:cc:to:from:date :dkim-signature:dkim-filter; bh=dX0FYDHshD/4zGJfTcc4+t2LjsR9tjhAB44sOSmgAmc=; b=SDZgbUROiWfyDMRD9BF+9Vs3ox9A91y/DM0FLOmn+qFAD9Xj+EOElYG0/K3SOsANXn RawHrPYMoaVgXPePNSxQJLn0kVMKD/1VX3AWmqTgknmI1KeWv2NyW6snaNrrcJFDDzzs 1s4R8Pm7ikFmwKgA8trsRBVSuhSHID6kXRWYWcOZQQwGXiX2x8qOenQtunHZqoOMKYOL DBcEQJpf8uyRs5go18IcE16eaiYCG90E9wu9vkEyDf6+eO6RnU8SJdckNfUfxBGLXTZ9 AtUSwLavU3QnhrRD5sKTkDpfvo+e295MWJeP53CSqjtjvmFmvB/m0398qD7WE8wSlJVX AwtA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@samsung.com header.s=mail20170921 header.b="Cjnu/cgB"; 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 v20si1305507ejx.754.2020.06.30.01.20.26; Tue, 30 Jun 2020 01:20:48 -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="Cjnu/cgB"; 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 S1731354AbgF3ITy (ORCPT + 99 others); Tue, 30 Jun 2020 04:19:54 -0400 Received: from mailout4.samsung.com ([203.254.224.34]:34614 "EHLO mailout4.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731353AbgF3ITv (ORCPT ); Tue, 30 Jun 2020 04:19:51 -0400 Received: from epcas5p3.samsung.com (unknown [182.195.41.41]) by mailout4.samsung.com (KnoxPortal) with ESMTP id 20200630081947epoutp04510f6d6d9d13219c27a66412b35ec2f2~dRIZe9YyX0905409054epoutp04m for ; Tue, 30 Jun 2020 08:19:47 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout4.samsung.com 20200630081947epoutp04510f6d6d9d13219c27a66412b35ec2f2~dRIZe9YyX0905409054epoutp04m DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1593505187; bh=dX0FYDHshD/4zGJfTcc4+t2LjsR9tjhAB44sOSmgAmc=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=Cjnu/cgBJ2ihbsbozbaSpsj81xCkfPIvvVafF/x1gmSoJoFU0T77FeJjZKhoEJw4C c99SQ2NIBYLDXyFiKCjD7Sw6TAG66NTbNsYjki4nTBaJzml8zjdFfORTnhxSuONrgW t9TvYIkWY07l+WlMjpEVdF64dh9HL9Xk2b39RbFY= Received: from epsmges5p3new.samsung.com (unknown [182.195.42.75]) by epcas5p4.samsung.com (KnoxPortal) with ESMTP id 20200630081945epcas5p40380ad27e58f2ab4bbc202733f2c7f59~dRIYatnrD0326303263epcas5p4l; Tue, 30 Jun 2020 08:19:45 +0000 (GMT) Received: from epcas5p2.samsung.com ( [182.195.41.40]) by epsmges5p3new.samsung.com (Symantec Messaging Gateway) with SMTP id 3B.91.09475.1A5FAFE5; Tue, 30 Jun 2020 17:19:45 +0900 (KST) Received: from epsmtrp1.samsung.com (unknown [182.195.40.13]) by epcas5p2.samsung.com (KnoxPortal) with ESMTPA id 20200630081945epcas5p2b4e11af3deed14541cb5d7be7c87142f~dRIX3LFHK2545625456epcas5p2J; Tue, 30 Jun 2020 08:19:45 +0000 (GMT) Received: from epsmgms1p1new.samsung.com (unknown [182.195.42.41]) by epsmtrp1.samsung.com (KnoxPortal) with ESMTP id 20200630081945epsmtrp1254a459dfb062293ae5f67e5a20457dc~dRIX2PU4t2572725727epsmtrp1Q; Tue, 30 Jun 2020 08:19:45 +0000 (GMT) X-AuditID: b6c32a4b-39fff70000002503-a9-5efaf5a10d82 Received: from epsmtip1.samsung.com ( [182.195.34.30]) by epsmgms1p1new.samsung.com (Symantec Messaging Gateway) with SMTP id 09.B3.08382.1A5FAFE5; Tue, 30 Jun 2020 17:19:45 +0900 (KST) Received: from test-zns (unknown [107.110.206.5]) by epsmtip1.samsung.com (KnoxPortal) with ESMTPA id 20200630081942epsmtip106e29c3ceba5015773cebc742c2a9b50~dRIVrtLlG1232312323epsmtip1Q; Tue, 30 Jun 2020 08:19:42 +0000 (GMT) Date: Tue, 30 Jun 2020 13:46:48 +0530 From: Kanchan Joshi To: Damien Le Moal Cc: "axboe@kernel.dk" , "viro@zeniv.linux.org.uk" , "bcrl@kvack.org" , "asml.silence@gmail.com" , "hch@infradead.org" , "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" , "selvakuma.s1@samsung.com" , "nj.shetty@samsung.com" , "javier.gonz@samsung.com" , Arnav Dawn Subject: Re: [PATCH v2 1/2] fs,block: Introduce RWF_ZONE_APPEND and handling in direct IO path Message-ID: <20200630081648.GB5701@test-zns> MIME-Version: 1.0 In-Reply-To: User-Agent: Mutt/1.9.4 (2018-02-28) X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFrrIKsWRmVeSWpSXmKPExsWy7bCmhu7Cr7/iDB6eN7L4ve0Ri8WcVdsY LVbf7Wez6Pq3hcWitf0bk8XpCYuYLN61nmOxeHznM7vFlGlNjBZ7b2lb7Nl7ksXi8q45bBYr th9hsdj2ez6zxesfJ9kszv89zuog4LFz1l12j80rtDwuny312PRpErtH99UfjB59W1Yxenze JOfRfqCbyWPTk7dMAZxRXDYpqTmZZalF+nYJXBkHFvexFyyQrfi6cBtbA+NBiS5GTg4JAROJ F68fM3UxcnEICexmlFi99wYjhPOJUWLdjLvMEM43RokPa5qYYVpurLzFApHYyygxbWkXE0hC SOAZo8SUTjsQm0VAVeLyo1fsXYwcHGwCmhIXJpeChEUEtCSW7XvHCtLLLPCZVaL1zno2kBph gQSJtZ89QWp4BXQk1r7dyghhC0qcnPmEBaSEUyBW4tcjsLCogLLEgW3Hwa6WELjDIdE9ZyEj xG0uEsevf2eCsIUlXh3fwg5hS0m87G+Dsosl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+d6wg9cwCP1klLv3YwAhSIyyQILH2sydIDa+AjsTat1sZoWay SDSsW8QEkRCUODnzCQuIzSxgJjFv80NmkF5mAWmJ5f84QExOgViJX48YQSpEBZQlDmw7zjSB UXAWkuZZSJpnITQvYGRexSiZWlCcm55bbFhgmJdarlecmFtcmpeul5yfu4kRHH1amjsYt6/6 oHeIkYmD8RCjBAezkgjvaYNfcUK8KYmVValF+fFFpTmpxYcYpTlYlMR5bxQujBMSSE8sSc1O TS1ILYLJMnFwSjUwLdIrM53fd/a5Vf064U/m3Mu71Fon6ykdz9z5u8euu9jlZVHdgkIDidZ1 Pn83s508qXdtsq2w8oQ5l7e6iU5p0Hdf++Gxos58nmc7Zj04trN1T+WbPsGemCTRYI4D58X/ zg/bfFmglUWmsWH/1q3Muz/P+cTo2zW9RuLDw6m5Cm+eLNS+HXSVe4/1S4YktnqFlv/3appk DbgOv74rs+5dakFuT1KqyrlnN9f0f1/xcWrzldxAp3VcN9unT5H0jpRgjZz9PjdwTsfGVXNv aD6IiHq6yfpQ4aY/r26bsi9j/ru05ODSq6bHlkh/0v7XaDhtQfFV/V4VF5tcMf2nzrIJRtlq cgwhriy/zwrf5nU6p8RSnJFoqMVcVJwIAF+M/2wtAwAA X-CMS-MailID: 20200630081945epcas5p2b4e11af3deed14541cb5d7be7c87142f X-Msg-Generator: CA Content-Type: multipart/mixed; boundary="----nai8lIH9ngBNHun9R6qswQcIIemhXBCkNXu5CagZqSM5j8ea=_ae588_" CMS-TYPE: 105P X-CMS-RootMailID: 20200625171834epcas5p226a24dfcb84cfa83fe29a2bd17795d85 References: <1593105349-19270-1-git-send-email-joshi.k@samsung.com> <1593105349-19270-2-git-send-email-joshi.k@samsung.com> <20200629183202.GA24003@test-zns> <20200630074005.GA5701@test-zns> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org ------nai8lIH9ngBNHun9R6qswQcIIemhXBCkNXu5CagZqSM5j8ea=_ae588_ Content-Type: text/plain; charset="utf-8"; format="flowed" Content-Disposition: inline On Tue, Jun 30, 2020 at 07:56:46AM +0000, Damien Le Moal wrote: >On 2020/06/30 16:53, Damien Le Moal wrote: >> On 2020/06/30 16:43, Kanchan Joshi wrote: >>> On Tue, Jun 30, 2020 at 12:37:07AM +0000, Damien Le Moal wrote: >>>> On 2020/06/30 3:35, Kanchan Joshi wrote: >>>>> On Fri, Jun 26, 2020 at 02:50:20AM +0000, Damien Le Moal wrote: >>>>>> On 2020/06/26 2:18, Kanchan Joshi wrote: >>>>>>> Introduce RWF_ZONE_APPEND flag to represent zone-append. User-space >>>>>>> sends this with write. Add IOCB_ZONE_APPEND which is set in >>>>>>> kiocb->ki_flags on receiving RWF_ZONE_APPEND. >>>>>>> Make direct IO submission path use IOCB_ZONE_APPEND to send bio with >>>>>>> append op. Direct IO completion returns zone-relative offset, in sector >>>>>>> unit, to upper layer using kiocb->ki_complete interface. >>>>>>> Report error if zone-append is requested on regular file or on sync >>>>>>> kiocb (i.e. one without ki_complete). >>>>>>> >>>>>>> Signed-off-by: Kanchan Joshi >>>>>>> Signed-off-by: SelvaKumar S >>>>>>> Signed-off-by: Arnav Dawn >>>>>>> Signed-off-by: Nitesh Shetty >>>>>>> Signed-off-by: Javier Gonzalez >>>>>>> --- >>>>>>> fs/block_dev.c | 28 ++++++++++++++++++++++++---- >>>>>>> include/linux/fs.h | 9 +++++++++ >>>>>>> include/uapi/linux/fs.h | 5 ++++- >>>>>>> 3 files changed, 37 insertions(+), 5 deletions(-) >>>>>>> >>>>>>> diff --git a/fs/block_dev.c b/fs/block_dev.c >>>>>>> index 47860e5..5180268 100644 >>>>>>> --- a/fs/block_dev.c >>>>>>> +++ b/fs/block_dev.c >>>>>>> @@ -185,6 +185,10 @@ static unsigned int dio_bio_write_op(struct kiocb *iocb) >>>>>>> /* avoid the need for a I/O completion work item */ >>>>>>> if (iocb->ki_flags & IOCB_DSYNC) >>>>>>> op |= REQ_FUA; >>>>>>> + >>>>>>> + if (iocb->ki_flags & IOCB_ZONE_APPEND) >>>>>>> + op |= REQ_OP_ZONE_APPEND; >>>>>> >>>>>> This is wrong. REQ_OP_WRITE is already set in the declaration of "op". How can >>>>>> this work ? >>>>> REQ_OP_ZONE_APPEND will override the REQ_WRITE op, while previously set op >>>>> flags (REQ_FUA etc.) will be retained. But yes, this can be made to look >>>>> cleaner. >>>>> V3 will include the other changes you pointed out. Thanks for the review. >>>>> >>>> >>>> REQ_OP_WRITE and REQ_OP_ZONE_APPEND are different bits, so there is no >>>> "override". A well formed BIO bi_opf is one op+flags. Specifying multiple OP >>>> codes does not make sense. >>> >>> one op+flags behavior is retained here. OP is not about bits (op flags are). >>> Had it been, REQ_OP_WRITE (value 1) can not be differentiated from >>> REQ_OP_ZONE_APPEND (value 13). >>> We do not do "bio_op(bio) & REQ_OP_WRITE", rather we look at the >>> absolute value "bio_op(bio) == REQ_OP_WRITE". >> >> Sure, the ops are not bits like the flags, but (excluding the flags) doing: >> >> op |= REQ_OP_ZONE_APPEND; >> >> will give you op == (REQ_OP_WRITE | REQ_OP_ZONE_APPEND). That's not what you want... > >And yes, REQ_OP_WRITE | REQ_OP_ZONE_APPEND == REQ_OP_ZONE_APPEND... But still >not a reason for not setting the op correctly :) Right, this is what op override was about, and intent was to minimize the changes in the existing function. As said before, completely agree about changing, code should not draw suspicion. ------nai8lIH9ngBNHun9R6qswQcIIemhXBCkNXu5CagZqSM5j8ea=_ae588_ Content-Type: text/plain; charset="utf-8" ------nai8lIH9ngBNHun9R6qswQcIIemhXBCkNXu5CagZqSM5j8ea=_ae588_--