Received: by 2002:a05:6902:102b:0:0:0:0 with SMTP id x11csp630777ybt; Wed, 8 Jul 2020 08:03:31 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwwyIA92p4hwuHxGbm58qX95a0dl35TzHkwNn/FPVNqGeccymo2vULy5QuE1gsmusaf4Q27 X-Received: by 2002:a05:6402:6c4:: with SMTP id n4mr70035310edy.353.1594220611726; Wed, 08 Jul 2020 08:03:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1594220611; cv=none; d=google.com; s=arc-20160816; b=c86jmF6KBVh9+vMkkElb5mgqK/Ut1+kDwcyMbABkLMAjKYSUn7x+i/snw1ZH9aZLn3 KO0JBmIqZQWwhqbqiEFgmA4LTIq1Rv3EuSjDRwUlpPas5gMzj7NszmN6dr1FUXKfKRL1 DovVtXdeONVZp7k3EHWNlkOWGlTkcq4OrMAzOfeJ/gAvYkSp7TUhtcRZYaFpEIgNELGa wjlXNfoT0NLFOHjtNkujKqic+eBfVl1wttpP9nJE4DYmgylOtOxAz4TD0ZKXle+se8FQ ZM4fa61mB0JmrCgOkNcJc/ik6TlgrN7cGGuEtKZLebDBsvjd4j35RyslvVyGKQsb2kuX ACWw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject:dkim-signature; bh=tOY5WWCurwXjUIdxuXnE2O00KAaJIFSGqD8NNrWHd48=; b=fGI0/2//wVHf3SuX2T4zfYAXRJcIjxO+j+mtE1LmCnhoo10QQU25fhQnjAsUw7dvSP N5GU+80BkEP9DAFp+Bora0VQuiw1iVPyfjevBfMHwcVCvOGXXd+OW7fFuZuwlj+tdB+P StTaGWaLaDxOUQEWXQKQ5LktBpEkUBPDM8IGgYDeseFiG5UxW04TWaohQfE2sqfGv7QD c+tsu66OqUE6ihGvykJRHEveAc5VfOX1NqGZ5qqvPIPAWYqEsYdTNqpj9bzetE4S3AjD gb1DiuDZHD9nO/qRbzgWTXWkr56+B4VpKpqCwcLvFYFVBEPjThe3i4EcShpaJ6NxIAhX 1xBQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel-dk.20150623.gappssmtp.com header.s=20150623 header.b=J6Mu+tQo; 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 w2si149794edt.433.2020.07.08.08.03.08; Wed, 08 Jul 2020 08:03:31 -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=@kernel-dk.20150623.gappssmtp.com header.s=20150623 header.b=J6Mu+tQo; 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 S1730028AbgGHO74 (ORCPT + 99 others); Wed, 8 Jul 2020 10:59:56 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54984 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729921AbgGHO7y (ORCPT ); Wed, 8 Jul 2020 10:59:54 -0400 Received: from mail-il1-x141.google.com (mail-il1-x141.google.com [IPv6:2607:f8b0:4864:20::141]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 42DABC08C5CE for ; Wed, 8 Jul 2020 07:59:53 -0700 (PDT) Received: by mail-il1-x141.google.com with SMTP id h16so15985828ilj.11 for ; Wed, 08 Jul 2020 07:59:53 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel-dk.20150623.gappssmtp.com; s=20150623; h=subject:to:cc:references:from:message-id:date:user-agent :mime-version:in-reply-to:content-language:content-transfer-encoding; bh=tOY5WWCurwXjUIdxuXnE2O00KAaJIFSGqD8NNrWHd48=; b=J6Mu+tQo2VKTqNJY50vJGPEqgC2Hv2aO92KQYyUke8OoZ31C2NM3Uy7BOsMKJ19i+b FsZ+fS8EG0HEEzm9wMnX/88vLlZrLyIwGfMVOomLJO6ZuTg6C4UC/1jA5DqgJ79OuKWh wDtqW0c3HvdgHjm4+ZPTC653WUHfhOwIxvkevNULcfj8BacfLzKL9G9TfHZNt0NBcnzI 2Wn1MTlzuFtMvQ9TcRRYi4oLArSc26gYcZOvwMSNZbipCBe1WQYV4tU6G0g5BPXX+pTq mtp2eou8bi3zeegoHKAZ1DbCm4/m4ExV1/lw+3CVBjqu47X75ckXC+LMgE2TuA+7YCGZ FQ+Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=tOY5WWCurwXjUIdxuXnE2O00KAaJIFSGqD8NNrWHd48=; b=q4gv7rPmF9zSdQeQLO3Oa5Xgf676O0k52ZxAHl/A0SwW1bzKv+zu3oV+VIcFMPXgAN iZR9D39d71IXV0pL5EIJNw6GRrJPmn/xYACw9k7hn8UR6HoQKpsRSFdXpDuACjBI2qKp NTjF8mRk77nD0KM9Pl7Keo7mVusZsgbGiPFvbLOTnRfp3WAwVUMgQLRv+0LlF4zopeub 1ljWLUg/YM59ckDF5EBN4UOQkAGXbW/skVLIzG7mvcNTSsIf7Ku7wbmJbInCLS2cvutX YIaXYppc0a1EUgX+YOAaUjvEAUem+Ad59oFOtEd0hQsP0XwxuWLCgnmuuvdA+YCdR1sh Ptdg== X-Gm-Message-State: AOAM530wIOSRRmdoyxp+2AEINP5rsbAW6dA9F5W+WGHsu4Fw+TQ3rhgy S8uscCxHOrrCMy540IOFIyYkzg== X-Received: by 2002:a92:d6d2:: with SMTP id z18mr40514146ilp.272.1594220392530; Wed, 08 Jul 2020 07:59:52 -0700 (PDT) Received: from [192.168.1.58] ([65.144.74.34]) by smtp.gmail.com with ESMTPSA id m16sm13933887ili.26.2020.07.08.07.59.51 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 08 Jul 2020 07:59:51 -0700 (PDT) Subject: Re: [PATCH v3 4/4] io_uring: add support for zone-append To: Matthew Wilcox 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 References: <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> <2962cd68-de34-89be-0464-8b102a3f1d0e@kernel.dk> <20200708145826.GS25523@casper.infradead.org> From: Jens Axboe Message-ID: Date: Wed, 8 Jul 2020 08:59:50 -0600 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.8.0 MIME-Version: 1.0 In-Reply-To: <20200708145826.GS25523@casper.infradead.org> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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? -- Jens Axboe