Received: by 2002:a25:e74b:0:0:0:0:0 with SMTP id e72csp59070ybh; Mon, 20 Jul 2020 10:15:10 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxRAw8h+SyO3bCBVx3gXlxYUBRx0dKR9mBoDH8DquFoI/pyPqijkgaowH4DEwpicSHws8Ys X-Received: by 2002:a05:6402:134e:: with SMTP id y14mr22742853edw.4.1595265310579; Mon, 20 Jul 2020 10:15:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1595265310; cv=none; d=google.com; s=arc-20160816; b=lNcFzjsZBA1vCE0Gp6C7o8VJ7L6knnwx42UP2YUWHQCKaUKrcn3kZeOOj3icphby87 QVR8tyOJDHhPQW61OaBis18uS58Jj8hrZ3nHfsobBr/+idaOiRNFyike8b8ios6EXZeV LLXxN7mDAR1mrh7CTYYT73K44/wa/uveLUMd9gSwRnm9jSr695uybAcSVTI8BV3uOmR/ LzugKoItRTgsBXQBPIcHt/2Ym6QwddXfk3kFkINbJb1J5JO8YNSqw2f5vMuA++QHX060 dzi/qsJfIN5N31yKWEU+YvHqe12PXLooPbqU7InixIx+pPlN3Hmljs1F+zMYXQQJfYhQ ZhHg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :dkim-signature; bh=d45SJ+BOtrVprN5peIref8u4gVYNL9L8EWPr0CD0nOs=; b=JS+9YqbVx7R96JuBWQZUunnxRrPvcNCbYUuJcvHMHI9VwHPg5QzUMKUN8IGqnw03pM PMtMhM7tNfhkzaq5jOxbKbTKUNNU11b3Nm6BVd31BZGLP8huM+p94xW27uMeGcF6QS3q MLnSlI+PtVmOJHK2t9zysVG+4n6cbsoGVqmvwkcS/oTWzLsgTcY8+k8rfxtGrxZM2Abl TaGBaP9L2PCC4lzuzhHyLimPkIhD15dpY+6hJ3OuHrUBPs4Er+vxq4qaJNwVQPXB5zLY Vy9Psw7hwnhuFMt/HIq0BEBFta0VzujrSyymw29BSK4AIPDCjzD3rKihvIN19JDQKx2Z QaWw== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@infradead.org header.s=casper.20170209 header.b=Qn43UcEx; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id a12si12178536edf.4.2020.07.20.10.14.47; Mon, 20 Jul 2020 10:15:10 -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=fail header.i=@infradead.org header.s=casper.20170209 header.b=Qn43UcEx; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729890AbgGTRO1 (ORCPT + 99 others); Mon, 20 Jul 2020 13:14:27 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53598 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728889AbgGTRO0 (ORCPT ); Mon, 20 Jul 2020 13:14:26 -0400 Received: from casper.infradead.org (casper.infradead.org [IPv6:2001:8b0:10b:1236::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3DA64C061794; Mon, 20 Jul 2020 10:14:26 -0700 (PDT) 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=d45SJ+BOtrVprN5peIref8u4gVYNL9L8EWPr0CD0nOs=; b=Qn43UcExzwvyrabYv+bSaietLB 7P14B46c5KQm8NZYBan4GaRIDj45LsNwNwArUaU7OZLcrqyZKS5Tx2dr5uXoM1glReH6jW+FCBglM XF+a8BwEWiZDXEDjXK9/kMkqlBKagUZH8nJ9xSCyIP/7MgjMAtfZ/gFCWM0Ywp01yCVpNBt0oSi4B k70PZdwvZ+vYVilV9Nz8vXzLSrpSG8VrAPGlioDQ04QqEWiSM/D337Su2iMlGk/DuUJSc7xtlxu/E T9mqc5nb+1xZYcUoVVltrip1njtJjF4677m/yH6bIeCltwnH6o7AQ4eEqxD+WAYKME/lPsa0VsOlB hVNDoRcg==; Received: from willy by casper.infradead.org with local (Exim 4.92.3 #3 (Red Hat Linux)) id 1jxZMm-0005hb-71; Mon, 20 Jul 2020 17:14:16 +0000 Date: Mon, 20 Jul 2020 18:14:16 +0100 From: Matthew Wilcox To: Kanchan Joshi Cc: Christoph Hellwig , Jens Axboe , Kanchan Joshi , viro@zeniv.linux.org.uk, bcrl@kvack.org, Damien.LeMoal@wdc.com, asml.silence@gmail.com, linux-fsdevel@vger.kernel.org, Matias Bj??rling , 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: <20200720171416.GY12769@casper.infradead.org> References: <2270907f-670c-5182-f4ec-9756dc645376@kernel.dk> <20200710131054.GB7491@infradead.org> <20200710134824.GK12769@casper.infradead.org> <20200710134932.GA16257@infradead.org> <20200710135119.GL12769@casper.infradead.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Jul 20, 2020 at 10:19:57PM +0530, Kanchan Joshi wrote: > On Fri, Jul 10, 2020 at 7:41 PM Kanchan Joshi wrote: > > If we are doing this for zone-append (and not general cases), "__s64 > > res64" should work -. > > 64 bits = 1 (sign) + 23 (bytes-copied: cqe->res) + 40 > > (written-location: chunk_sector bytes limit) No, don't do this. struct io_uring_cqe { __u64 user_data; /* sqe->data submission passed back */ - __s32 res; /* result code for this event */ - __u32 flags; + union { + struct { + __s32 res; /* result code for this event */ + __u32 flags; + }; + __s64 res64; + }; }; Return the value in bytes in res64, or a negative errno. Done. > * IO completion data structure (Completion Queue Entry) > */ > struct io_uring_cqe { > - __u64 user_data; /* sqe->data submission passed back */ > - __s32 res; /* result code for this event */ > - __u32 flags; > + __u64 user_data; /* sqe->data submission passed back */ > + union { > + struct { > + __s32 res; /* result code for > this event */ > + __u32 flags; > + }; > + /* Alternate for zone-append */ > + struct { > + union { > + /* > + * kernel uses this to store append result > + * Most significant 23 bits to return number of > + * bytes or error, and least significant 41 bits > + * to return zone-relative offset in bytes > + * */ > + __s64 res64; > + /*for user-space ease, kernel does not use*/ > + struct { > +#if defined(__LITTLE_ENDIAN_BITFIELD) > + __u64 append_offset : > APPEND_OFFSET_BITS; > + __s32 append_res : APPEND_RES_BITS; > +#elif defined(__BIG_ENDIAN_BITFIELD) > + __s32 append_res : APPEND_RES_BITS; > + __u64 append_offset : > APPEND_OFFSET_BITS; > +#endif > + }__attribute__ ((__packed__)); > + }; > + }; > + }; > }; > > -- > Joshi