Received: by 2002:a05:6902:102b:0:0:0:0 with SMTP id x11csp1646896ybt; Thu, 9 Jul 2020 11:51:06 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzunf87NcGDzykdSXDYNgvHqC1IiG46WMd31CYBj0KvY6T/MX9MhV0dxWsufLNm73p0BHjm X-Received: by 2002:a17:906:950c:: with SMTP id u12mr56813104ejx.37.1594320666806; Thu, 09 Jul 2020 11:51:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1594320666; cv=none; d=google.com; s=arc-20160816; b=rM6pyfCv7Whl+tmrRFHYepg7UqlQfHpIX+cgCUlr/QJM4vSB5A/RnHUS2ugAdn3oOM EArRpa842bR8kzZDipmK2WSt0VIctdyapFV0McSf3PiLsTxGqc6xyP7lA6qayj3cC0Je ijcFfxHFyy4tlzsrN5CiCRc95XPNDqkZv9etJMRmrbmDNpdyOyhV834YUBNV+XD0wrdL HmfpPz621ViOwtDa+AaiehcgnxIOBKHDWrugpaoGslJ1XQ1zXTFCw9RpecfEwD8K7qax qTIk2OAkYcvL32+bVzNtul309W92P7cR4O6HG7OwN5Wusjb/1QcK8zk2rhA5btEAeDXp iT7w== 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=GrXsYtapGjnrw/pbMa/SCV0S2qwzLccMpD6Nkl4dtwc=; b=iNYUMydIaV2E2lpWIcDWh7KWG3SxcrI8WKhfEUMdUaWtgZxZGMQoPYvbQJhUMcGRCw 13twoEcOlLayd4mDQUG4Zbq6pQcDU84m65iJW6+rQONVl3hgd8hDfcYLO24srNNrXtTI 0BGeVmvIqnlw1OZRmftxJPALP5+ANozJLZFAQzpoWyEj1AXUq8Q8xeWNEDabb24hiNA9 2vIs8U8GZqVxfqcWSYb9l8CCaDBRZuzH5dpXUfznYmaNCjJGxteRktU323HEHI81gRyn DvvHfbKf221aRvm0bppk1jMU+QPZhOQiFBQXTjn1/4bbH0vHhhvVgBzAU9Dkxkfb2+3e ZKHA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel-dk.20150623.gappssmtp.com header.s=20150623 header.b=aTdn7W3a; 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 bq21si2427189ejb.301.2020.07.09.11.50.42; Thu, 09 Jul 2020 11:51:06 -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=aTdn7W3a; 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 S1726196AbgGISua (ORCPT + 99 others); Thu, 9 Jul 2020 14:50:30 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59004 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726183AbgGISua (ORCPT ); Thu, 9 Jul 2020 14:50:30 -0400 Received: from mail-il1-x144.google.com (mail-il1-x144.google.com [IPv6:2607:f8b0:4864:20::144]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 53C9EC08C5DC for ; Thu, 9 Jul 2020 11:50:30 -0700 (PDT) Received: by mail-il1-x144.google.com with SMTP id a11so2953994ilk.0 for ; Thu, 09 Jul 2020 11:50:30 -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=GrXsYtapGjnrw/pbMa/SCV0S2qwzLccMpD6Nkl4dtwc=; b=aTdn7W3aKnzYYH25d4xjro+x9lOU10DgL79FjCdBUV3lL6pn85CVhfX8oebWA0SyrF 3wGWR1q8CnliJkzDuNjGG/kheGgTY670srmrNmeU8Sd//u0Cqy5TRJdSLMmFzFQvbUVN skPESlg+HSvgUiQ2ZKBZHwolc061Tr+bJQC0Ee46M0Sf7+ZPeR9oP3FT+S05JYsHN3/U GvmgVIoRagYR2ZWEo6Yp32ZFfGKmxTXy8DKs3G93V5ovP5hUsX+3cK3lAKwd/PSsHh0P vcqI44/2+bWLTeneFWA/73vV+9RRdw5nkSCAyE26a+UBNA+vanzGfU8UsLBJOzlUo1gU XfLg== 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=GrXsYtapGjnrw/pbMa/SCV0S2qwzLccMpD6Nkl4dtwc=; b=t4oaHETKmCnQ7UFf6cza3nOPURqPVmTflcfUlCDYEA4GNFGzHei36yGSnacq14Hn0i SfQHa2jOV1NrPUPObmo+p/QtSkNUEDiHdAa7eWX2h5lcpMMkjptwjTk2+zEF+uDiYppp Rbegk7iAeFZs9CBJ9FahXtiBtE8mnVxgQKLNMIxGYL0206cl6CkfrA3z9V2K6D+Q1rcp OztauS6pPo7/qCI7ygR8rgJMECRMCpVK+dnoV2GzOqApTSvSN9N2dxbfUHzO5fvHFjdn N2EWGhB58/gUoNPwaNhWjYWDmatXA3fXTjuTxWAVBlKdqb2EnTqJ2EgP35jf2VMc1H3z VEKQ== X-Gm-Message-State: AOAM5306kVQMBGRTYQckQkRZVOoJMkVRDmLhyJSUpCSnj7ra9B1ZVTC9 LD5Tci9GQ5bXKWvGHRN6v4+POQ== X-Received: by 2002:a92:c806:: with SMTP id v6mr47666474iln.10.1594320629560; Thu, 09 Jul 2020 11:50:29 -0700 (PDT) Received: from [192.168.1.58] ([65.144.74.34]) by smtp.gmail.com with ESMTPSA id h1sm2629701iob.8.2020.07.09.11.50.28 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 09 Jul 2020 11:50:29 -0700 (PDT) Subject: Re: [PATCH v3 4/4] io_uring: add support for zone-append To: Kanchan Joshi Cc: Christoph Hellwig , Kanchan Joshi , viro@zeniv.linux.org.uk, bcrl@kvack.org, Damien.LeMoal@wdc.com, asml.silence@gmail.com, linux-fsdevel@vger.kernel.org, =?UTF-8?Q?Matias_Bj=c3=b8rling?= , 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: <1593974870-18919-1-git-send-email-joshi.k@samsung.com> <1593974870-18919-5-git-send-email-joshi.k@samsung.com> <20200709085501.GA64935@infradead.org> <20200709140053.GA7528@infradead.org> <2270907f-670c-5182-f4ec-9756dc645376@kernel.dk> From: Jens Axboe Message-ID: Date: Thu, 9 Jul 2020 12:50:27 -0600 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.10.0 MIME-Version: 1.0 In-Reply-To: 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/9/20 12:36 PM, Kanchan Joshi wrote: > On Thu, Jul 9, 2020 at 7:36 PM Jens Axboe wrote: >> >> On 7/9/20 8:00 AM, Christoph Hellwig wrote: >>> On Thu, Jul 09, 2020 at 07:58:04AM -0600, Jens Axboe wrote: >>>>> We don't actually need any new field at all. By the time the write >>>>> returned ki_pos contains the offset after the write, and the res >>>>> argument to ->ki_complete contains the amount of bytes written, which >>>>> allow us to trivially derive the starting position. > > Deriving starting position was not the purpose at all. > But yes, append-offset is not needed, for a different reason. > It was kept for uring specific handling. Completion-result from lower > layer was always coming to uring in ret2 via ki_complete(....,ret2). > And ret2 goes to CQE (and user-space) without any conversion in between. > For polled-completion, there is a short window when we get ret2 but cannot > write into CQE immediately, so thought of storing that in append_offset > (but should not have done, solving was possible without it). > > FWIW, if we move to indirect-offset approach, append_offset gets > eliminated automatically, because there is no need to write to CQE > itself. > >>>> Then let's just do that instead of jumping through hoops either >>>> justifying growing io_rw/io_kiocb or turning kiocb into a global >>>> completion thing. >>> >>> Unfortunately that is a totally separate issue - the in-kernel offset >>> can be trivially calculated. But we still need to figure out a way to >>> pass it on to userspace. The current patchset does that by abusing >>> the flags, which doesn't really work as the flags are way too small. >>> So we somewhere need to have an address to do the put_user to. >> >> Right, we're just trading the 'append_offset' for a 'copy_offset_here' >> pointer, which are stored in the same spot... > > The address needs to be stored somewhere. And there does not seem > other option but to use io_kiocb? That is where it belongs, not sure this was ever questioned. And inside io_rw at that. > The bigger problem with address/indirect-offset is to be able to write > to it during completion as process-context is different. Will that > require entering into task_work_add() world, and may make it costly > affair? It might, if you have IRQ context for the completion. task_work isn't expensive, however. It's not like a thread offload. > Using flags have not been liked here, but given the upheaval involved so > far I have begun to feel - it was keeping things simple. Should it be > reconsidered? It's definitely worth considering, especially since we can use cflags like Pavel suggested upfront and not need any extra storage. But it brings us back to the 32-bit vs 64-bit discussion, and then using blocks instead of bytes. Which isn't exactly super pretty. -- Jens Axboe