Received: by 2002:a05:6902:102b:0:0:0:0 with SMTP id x11csp634833ybt; Wed, 8 Jul 2020 08:08:01 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzAeOjxqAcbvERNmVBU49ej5fKrBQlYuogYKzcFASX84Uqx+eCrAsLLQMHJXlTrfV617CO8 X-Received: by 2002:aa7:d78b:: with SMTP id s11mr62913909edq.319.1594220881088; Wed, 08 Jul 2020 08:08:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1594220881; cv=none; d=google.com; s=arc-20160816; b=OYEaJ/8v2w7idOZz4e89c5hpMufi0V1Pyp/9lUJFLOjkkkZOTEwz7m1HtgBcUjwKZm r2jyaZ71udydeQjdgwWgsAxxKIV8wYkop8S1JyC9Hq9YN/fg4GPfK6edPWnrjY1eFlOS tfxTHAmgacEdJoBySt+wFN6wWx76vs1Kql9bMEfW9XSv8lI/BIxl5drIcziiaKF7XEod JOGMw7i+t6rJI6qzJivS6LOqa1NOyw3QzZ6TCRIvUAd3y1eyilWucd31h3Ocvq2EsoSq gmEDAODJWxasyosOR5kyxChSzAIXISRei7QLr/UZBjyODmqIiL8ZhdLVmE1hgkZCGXNg bfsA== 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=QRr8IaIUSsGD3CeeBoEgXqxqpXOnhIwjY7NBGxGQZyo=; b=onQwlVkhAtN0GHREt/mSkrOB9ewTzHj21IsHde84LrqqS6+YbWYzZjBDS0irHStQvX dK/8n+CnJlUrzcJaehBKeKK696NwuMbgthkLQH9OWzKH4fOl6VioB8VGdQNYsh+vkCcq mmIXXmefKr/wyI1IMQ7jTIPvohpF1U2sLxTvLvBVpkb2Tt4TUA8zN/AW7rJy3UGsJCQe u++WEawZkz2uPSMahEXXpezmAhccvqzqKllbp8aYsRRMTVXtVRoGuf+Aw+h1z+NmvkVD nr173LRc0DCEQTQTUEVlRo+GOfJeS5Lo9G0CDVAPXw0Qbt1pfU4/jJFNTGOjNEDVwu7i p+jQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel-dk.20150623.gappssmtp.com header.s=20150623 header.b=DU3Ygtsc; 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 a2si147910edq.272.2020.07.08.08.07.37; Wed, 08 Jul 2020 08:08:01 -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=DU3Ygtsc; 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 S1729954AbgGHPGw (ORCPT + 99 others); Wed, 8 Jul 2020 11:06:52 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56090 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729022AbgGHPGv (ORCPT ); Wed, 8 Jul 2020 11:06:51 -0400 Received: from mail-io1-xd41.google.com (mail-io1-xd41.google.com [IPv6:2607:f8b0:4864:20::d41]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 59F90C061A0B for ; Wed, 8 Jul 2020 08:06:51 -0700 (PDT) Received: by mail-io1-xd41.google.com with SMTP id i4so47292703iov.11 for ; Wed, 08 Jul 2020 08:06:51 -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=QRr8IaIUSsGD3CeeBoEgXqxqpXOnhIwjY7NBGxGQZyo=; b=DU3Ygtsctl26AMlkTp4CMraQH0A+FA5vOVnNO0UIcYo9nxfYiCGy/ymLFOrzpSIPvq /CEOf6eB2iHMuxO2Uj9c0aYHbwNJ1koOfPwBQdxhbZrmEaBWTDcDovMfnMGuY7DQcBSl /59aWWLJ+6nNzZru72U0sGqPquAoF2yyEAtIyDRj97tm1CKkmn7DmgaPYWmycBfkGRdp 5HtQzvJXXi6Iy+ALPgddlkzwEo8R8hBRrz1sJuxfBm8lVmmwg3bJZMt12DHYs3qwlyPS rbB21x+49LQLxypL1cXpHtPNH1vD6NNvIYALazA0x6rwFXpzq1MciHcfiOlzuO9qSWGr iI2A== 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=QRr8IaIUSsGD3CeeBoEgXqxqpXOnhIwjY7NBGxGQZyo=; b=KJ6Z7rFYNrCqMC3QVxTZxjgbzCCE03VbqxyYTsKd7gmoWgwI5VIJhycTLQFLpXVQ5w fcuucK0ppRDKUnlt700R8jL3eE00bG6kEDflD6hImCx0y+4yN9FPGVQ7ldyQmPQ01c6j wCQJy9DH7RZqmNMCFXBNB0N3tScQj2DaNMiw3UjP5+acL2mNgb84PuNTS327/Annq5lW w/rVnZkfCESgOMoirj6B34cVWT422ILyal2H6PbK96qqSebuOHHTlAi20/5L/WpwGliP v5dKa24MRkL2xgprGtkzWyi4FUpB0HJYbxQSCHYZE6mQ5OVIiA/wv2L8LgWcyuEUn5Zi eJWQ== X-Gm-Message-State: AOAM532VO3XzUKcxf9wCABpyUX4KVepG5MCHOiM5OtvcF5HZ+1LS4UWv QYG8UlCmu5zNLsUYRsmmMT8izA== X-Received: by 2002:a05:6638:2591:: with SMTP id s17mr15513952jat.23.1594220810484; Wed, 08 Jul 2020 08:06:50 -0700 (PDT) Received: from [192.168.1.58] ([65.144.74.34]) by smtp.gmail.com with ESMTPSA id h11sm15046512ilh.69.2020.07.08.08.06.49 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 08 Jul 2020 08:06:49 -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: <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> <20200708150240.GT25523@casper.infradead.org> From: Jens Axboe Message-ID: <33b9887b-eaba-c7be-5dfd-fc7e7d416f48@kernel.dk> Date: Wed, 8 Jul 2020 09:06:48 -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: <20200708150240.GT25523@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 9:02 AM, Matthew Wilcox wrote: > 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 ... I just wanted to get clarification there, because to me it sounded like you expected Kanchan to do it, and Kanchan assuming it "was sorted". I'd consider that a prerequisite for the append series as far as io_uring is concerned, hence _someone_ needs to actually do it ;-) -- Jens Axboe