From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.4 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 5A418C433F5 for ; Fri, 3 Sep 2021 18:48:00 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 3ADB961051 for ; Fri, 3 Sep 2021 18:48:00 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1350846AbhICSs6 (ORCPT ); Fri, 3 Sep 2021 14:48:58 -0400 Received: from mail.kernel.org ([198.145.29.99]:41332 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1350567AbhICSs4 (ORCPT ); Fri, 3 Sep 2021 14:48:56 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 779DE610A1; Fri, 3 Sep 2021 18:47:56 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1630694876; bh=hT4RRpDObCrnqrIR/+8EtNZkR2fPesdsprcdlGFcdQg=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=d7eoWV5Oc+mxNeU6xDgBsGQXlSQp4DrBk03yqy+9FA7qDJ7qtKDz6KS/G9mrZwmv5 3mlCxWPFaj+ELLcLcfZnPYK5VPpr0Y8+n3w8EcuZgo6E5M/ge+iuTSGdKYeK8dUUt4 aIs15/N269kT5ZvU6wgJtijOORJX/rqXc6BPOTLHWkYf2fUtD0Eb1Pj9y+NjM3sl5j 4+36lDXfsFf58nMQ3TBuMJWqXhEOREZPYbz98il2a/Fa4eOLui3gH8amHRcEb5mLnh O8rofMu+3Mw3WI/bsNbuJ5fsZYIvt/efcLvhqR955Ay85aXvZOrIZ+l9Uw6HTMF30O sP2xlMHsEr88A== Date: Fri, 3 Sep 2021 11:47:55 -0700 From: "Darrick J. Wong" To: Linus Torvalds Cc: Andreas Gruenbacher , Alexander Viro , Christoph Hellwig , Jan Kara , Matthew Wilcox , cluster-devel , linux-fsdevel , LKML , ocfs2-devel@oss.oracle.com Subject: Re: [PATCH v7 16/19] iomap: Add done_before argument to iomap_dio_rw Message-ID: <20210903184755.GC9892@magnolia> References: <20210827164926.1726765-1-agruenba@redhat.com> <20210827164926.1726765-17-agruenba@redhat.com> <20210827183018.GJ12664@magnolia> <20210827213239.GH12597@magnolia> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Precedence: bulk List-ID: X-Mailing-List: linux-fsdevel@vger.kernel.org On Fri, Aug 27, 2021 at 03:35:06PM -0700, Linus Torvalds wrote: > On Fri, Aug 27, 2021 at 2:32 PM Darrick J. Wong wrote: > > > > No, because you totally ignored the second question: > > > > If the directio operation succeeds even partially and the PARTIAL flag > > is set, won't that push the iov iter ahead by however many bytes > > completed? > > > > We already finished the IO for the first page, so the second attempt > > should pick up where it left off, i.e. the second page. > > Darrick, I think you're missing the point. > > It's the *return*value* that is the issue, not the iovec. > > The iovec is updated as you say. But the return value from the async > part is - without Andreas' patch - only the async part of it. > > With Andreas' patch, the async part will now return the full return > value, including the part that was done synchronously. > > And the return value is returned from that async part, which somehow > thus needs to know what predated it. Aha, that was the missing piece, thank you. I'd forgotten that iomap_dio_complete_work calls iocb->ki_complete with the return value of iomap_dio_complete, which means that the iomap_dio has to know if there was a previous transfer that stopped short so that the caller could do more work and resubmit. > Could that pre-existing part perhaps be saved somewhere else? Very > possibly. That 'struct iomap_dio' addition is kind of ugly. So maybe > what Andreas did could be done differently. There's probably a more elegant way for the ->ki_complete functions to figure out how much got transferred, but that's sufficiently ugly and invasive so as not to be suitable for a bug fix. > But I think you guys are arguing past each other. Yes, definitely. --D > > Linus