From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-0.6 required=3.0 tests=DKIM_INVALID,DKIM_SIGNED, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 4C2B1C433DF for ; Wed, 8 Jul 2020 14:45:26 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 1D0CF20786 for ; Wed, 8 Jul 2020 14:45:26 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=infradead.org header.i=@infradead.org header.b="JMJwqmeT" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729881AbgGHOpZ (ORCPT ); Wed, 8 Jul 2020 10:45:25 -0400 Received: from casper.infradead.org ([90.155.50.34]:36326 "EHLO casper.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729595AbgGHOpZ (ORCPT ); Wed, 8 Jul 2020 10:45:25 -0400 X-Greylist: delayed 1276 seconds by postgrey-1.27 at vger.kernel.org; Wed, 08 Jul 2020 10:45:25 EDT DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=In-Reply-To:Content-Type:MIME-Version: References:Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description; bh=MrAnEvtYxJ3CG9gxR3loAOZTO73HHraqyOfrOks4hhg=; b=JMJwqmeTQ9cGJpeD9W93Dw1IjO XWotEiYbye0J2WZMFOcGjZcu3WbLV55gbbJHp4tN6THMa9cj8svxx7BtFefMqc5eD0hLPhSeiRHfc dht8oKIrdba3H++FPHoTHrH8o9AQOKTc5hTH/OdDHsBq21QVOWsKJkMnSgzwbdKEGeCAdNafeHIRP HEnmGYkfg5gUtC+4LV/Yixsovv71OLHrATMzHBfgyjOvNVwWFVhR/b96qceLBtbGfR6b7iZywHu96 xYgs+G2w1wHc8O/belST07+MM+apfnisUfdTHRfp0HtCEz7f1uB/VtCHjo6wP6mC5f+lUYi8bEbKU 1Q3ih66A==; Received: from willy by casper.infradead.org with local (Exim 4.92.3 #3 (Red Hat Linux)) id 1jtAyJ-0007LT-Jr; Wed, 08 Jul 2020 14:22:51 +0000 Date: Wed, 8 Jul 2020 15:22:51 +0100 From: Matthew Wilcox To: Kanchan Joshi Cc: Jens Axboe , viro@zeniv.linux.org.uk, bcrl@kvack.org, 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, Selvakumar S , Nitesh Shetty , Javier Gonzalez Subject: Re: [PATCH v3 4/4] io_uring: add support for zone-append Message-ID: <20200708142251.GQ25523@casper.infradead.org> References: <4a9bf73e-f3ee-4f06-7fad-b8f8861b0bc1@kernel.dk> <20200706143208.GA25523@casper.infradead.org> <20200707151105.GA23395@test-zns> <20200707155237.GM25523@casper.infradead.org> <20200707202342.GA28364@test-zns> <7a44d9c6-bf7d-0666-fc29-32c3cba9d1d8@kernel.dk> <20200707221812.GN25523@casper.infradead.org> <145cc0ad-af86-2d6a-78b3-9ade007aae52@kernel.dk> <20200708125805.GA16495@test-zns> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200708125805.GA16495@test-zns> Sender: io-uring-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: io-uring@vger.kernel.org On Wed, Jul 08, 2020 at 06:28:05PM +0530, Kanchan Joshi wrote: > The last thing is about the flag used to trigger this processing. Will it be > fine to intoduce new flag (RWF_APPEND2 or RWF_APPEND_OFFSET) > instead of using RWF_APPEND? > > New flag will do what RWF_APPEND does and will also return the > written-location (and therefore expects pointer setup in application). I think it's simpler to understand if it's called RWF_INDIRECT_OFFSET Then it'd look like: + rwf_t rwf = READ_ONCE(sqe->rw_flags); ... - iocb->ki_pos = READ_ONCE(sqe->off); + if (rwf & RWF_INDIRECT_OFFSET) { + loff_t __user *loffp = u64_to_user_ptr(sqe->addr2); + + if (get_user(iocb->ki_pos, loffp) + return -EFAULT; + iocb->ki_loffp = loffp; + } else { + iocb->ki_pos = READ_ONCE(sqe->off); + } ... - ret = kiocb_set_rw_flags(kiocb, READ_ONCE(sqe->rw_flags)); + ret = kiocb_set_rw_flags(kiocb, rwf);