Received: by 2002:a05:6902:102b:0:0:0:0 with SMTP id x11csp631804ybt; Wed, 8 Jul 2020 08:04:36 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzf1j8aXyqNtkfUWbG0Jr1xQnIvia4CEKYHsN7NgqnXFHiDX4SrY4pA3ldSvFbR//DGRBdz X-Received: by 2002:a17:906:5e0b:: with SMTP id n11mr49207644eju.15.1594220676136; Wed, 08 Jul 2020 08:04:36 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1594220676; cv=none; d=google.com; s=arc-20160816; b=eQ13YuFEj9MaFrGII5H4f4sDcbcKtx/AJRDsz1/AFFXhB4PmlXbAT2u8SIIExVU2ep DTMuTNjpFKLs46YvmNhmTy8VqZQsr64yzNUogWDJyV7rV0Xrnd/kjs9kc3zIvn3QZ4u0 w3OlBwuPQCIUayEZnot5A9lSNjLZ9RpwMGLaJB30nypoNTsCG9fPi6g2GciN3DbI7TrM kvicgfzeEZr6wko9TDHog2QddVjczetdAuuouLs086Sailyb3RM7NprxFhX4Lvvcz1cH LgrTbFjJSUDXgnrdcA3uApmf7V41+2P9IaessIYa2t5ojzQ64qLx8TEDJp+si7Sa3HuV XpnQ== 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=zBHCkuCe5RFCedmEBx2CZK7LS4k3WZ+7jOD5fQ9ed9Y=; b=sDC1ObR3D/4/gkMjKMmDHgzFJkMmwsrRVw8vkFj9RBMDbl42Ne+R4ATq1Q2abx+6ks HiAhoIxCzmiMpBf+AC71zjzEnLPQi/TNobWXJogTwWAkWs4sgHROL927hAyZnWND74AH 20UWeY7QzTEJd8p7CpYqkyvauQ+5sdjb8yC+bvxH7Yel3FVo7vh4cUgmn3nxkVkRjMcx LRzm44ROecmx19HUiFVQIVVyH4xW4GPCe5sDsHc4cbMcFma/nz13u7PCf/IsxkC2LKBz 3cOThuaSkw5UaqVZsBMLPyylKn5HGePqPBY+bgjyKMOaqQx2o8GHYV5Iqiii8Neh188o E3Qg== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@infradead.org header.s=casper.20170209 header.b=djVZpEIB; 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 ga5si54160ejb.567.2020.07.08.08.04.12; Wed, 08 Jul 2020 08:04:36 -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=djVZpEIB; 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 S1729954AbgGHPDe (ORCPT + 99 others); Wed, 8 Jul 2020 11:03:34 -0400 Received: from casper.infradead.org ([90.155.50.34]:36686 "EHLO casper.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729206AbgGHPDd (ORCPT ); Wed, 8 Jul 2020 11:03:33 -0400 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=zBHCkuCe5RFCedmEBx2CZK7LS4k3WZ+7jOD5fQ9ed9Y=; b=djVZpEIBtWMWxRw3CqqH/NFd4i a4zr7rIrC8/W8xunIZNCpi+Zb8uXFFQqUTfV6c/TR/p3OJCbxCExyLnKLGPBTSyChk2zmQz7wrGYL 4W/89zj8RJAInOQYr0SpZry7v5ixoHyXs33qzoOQGhaMjKrQbPpSfHZIfkbY0F+cVsQ/BINFM/fdA TO4zabYCHmemwCzKTU1ar+3trAsn7gMAR5EhPjkoHY3j17LHzQm/prWRt+QM97WXA11zcpZQrTq61 MvfXv5S2HGPsOJsW6NmTFLhSFetX+7cit4zXSnl0v8cg9gdsruyvn/+T0AhY5meP7ZEYT3F/OnRnc yfBttG4g==; Received: from willy by casper.infradead.org with local (Exim 4.92.3 #3 (Red Hat Linux)) id 1jtBat-00014u-JD; Wed, 08 Jul 2020 15:02:45 +0000 Date: Wed, 8 Jul 2020 16:02:40 +0100 From: Matthew Wilcox To: Jens Axboe Cc: Kanchan Joshi , 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: <20200708150240.GT25523@casper.infradead.org> References: <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> <2962cd68-de34-89be-0464-8b102a3f1d0e@kernel.dk> <20200708145826.GS25523@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 Wed, Jul 08, 2020 at 08:59:50AM -0600, Jens Axboe wrote: > On 7/8/20 8:58 AM, Matthew Wilcox wrote: > > On Wed, Jul 08, 2020 at 08:54:07AM -0600, Jens Axboe wrote: > >> On 7/8/20 6:58 AM, Kanchan Joshi wrote: > >>>>> +#define IOCB_NO_CMPL (15 << 28) > >>>>> > >>>>> struct kiocb { > >>>>> [...] > >>>>> - void (*ki_complete)(struct kiocb *iocb, long ret, long ret2); > >>>>> + loff_t __user *ki_uposp; > >>>>> - int ki_flags; > >>>>> + unsigned int ki_flags; > >>>>> > >>>>> +typedef void ki_cmpl(struct kiocb *, long ret, long ret2); > >>>>> +static ki_cmpl * const ki_cmpls[15]; > >>>>> > >>>>> +void ki_complete(struct kiocb *iocb, long ret, long ret2) > >>>>> +{ > >>>>> + unsigned int id = iocb->ki_flags >> 28; > >>>>> + > >>>>> + if (id < 15) > >>>>> + ki_cmpls[id](iocb, ret, ret2); > >>>>> +} > >>>>> > >>>>> +int kiocb_cmpl_register(void (*cb)(struct kiocb *, long, long)) > >>>>> +{ > >>>>> + for (i = 0; i < 15; i++) { > >>>>> + if (ki_cmpls[id]) > >>>>> + continue; > >>>>> + ki_cmpls[id] = cb; > >>>>> + return id; > >>>>> + } > >>>>> + WARN(); > >>>>> + return -1; > >>>>> +} > >>>> > >>>> That could work, we don't really have a lot of different completion > >>>> types in the kernel. > >>> > >>> Thanks, this looks sorted. > >> > >> Not really, someone still needs to do that work. I took a quick look, and > >> most of it looks straight forward. The only potential complication is > >> ocfs2, which does a swap of the completion for the kiocb. That would just > >> turn into an upper flag swap. And potential sync kiocb with NULL > >> ki_complete. The latter should be fine, I think we just need to reserve > >> completion nr 0 for being that. > > > > I was reserving completion 15 for that ;-) > > > > +#define IOCB_NO_CMPL (15 << 28) > > ... > > + if (id < 15) > > + ki_cmpls[id](iocb, ret, ret2); > > > > Saves us one pointer in the array ... > > That works. Are you going to turn this into an actual series of patches, > adding the functionality and converting users? I was under the impression Kanchan was going to do that, but I can run it off quickly ...