Received: by 2002:a25:1506:0:0:0:0:0 with SMTP id 6csp4374973ybv; Tue, 25 Feb 2020 18:56:04 -0800 (PST) X-Google-Smtp-Source: APXvYqy2hIptf/iIHCuzVbl8SuCpHL9Rv+JEUfRgB0mLpmAlIifeZMWtE1zvJuOTeXE84lOjeNqq X-Received: by 2002:a05:6830:147:: with SMTP id j7mr1298149otp.12.1582685764232; Tue, 25 Feb 2020 18:56:04 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1582685764; cv=none; d=google.com; s=arc-20160816; b=GA5dBLUlMhOKZvmT6+Daw5HIdktfylUJZEdNLDaJhYRfsXT/M0zGOegR+47L1Ni4vs 5d6qtsatRCA44TmdzY7/jMvQcVfq8gFv9hric2WGNwFzzmZxlIvYkpDq0PF7qFf0Y6dV peA4ecwYeYYK3log1dumzwvQmaYvbF5w9rvx8+V9ji1p7fnuFmZFG2HTuyM3eAow1L8K kEANfTO14nktR/nz6peqGr9uH/BIAfgH5RK4G4gHlGL6JD/leWM4ZeRjCSVqOAXmr2VL LbtuFYmyGbc49DmhakZq6E94fXi0vlYCp8pCtEyexFaXRseLupzcljJXHk0W8SjpTe+y BkHg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date; bh=i1TV00pMV4oQf1cAQv2H+kbxY+BZ8ugLdpXRszsuVNk=; b=svg3QVGE7bxzSnIrxVuKP98JAlqFWOhFxSWhVl6DClQI015IpleC2+2GYeNR3XfUgb +RkuXG1OMi5PRN1Wq3YPKxaBlgLryxb0q+ksQc1p8Z0NInKs8xy9QYAjh1rE6uJ427eX /mcPLUmUU/9g0S6XTgPjGr2cf+2x0OQX0kpWyNtbB+FNSzCGD/++FedQN6V/GvccXIf3 qQyfxwS96Fo+uiMG23M/aZom4DlHV9lf/SsLuW4WXuNQyLs2uAz0leiZp74C0rjdD6Gc AOMrhY8T785RgASHSMbBwyoH1/JTzuD0hCdLC26idjFbwDxyfSwjhnbNJXgwConwXiIj Nw4A== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-ext4-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-ext4-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id m16si492876otj.7.2020.02.25.18.55.44; Tue, 25 Feb 2020 18:56:04 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-ext4-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-ext4-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-ext4-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729403AbgBZCzh (ORCPT + 99 others); Tue, 25 Feb 2020 21:55:37 -0500 Received: from mx2.suse.de ([195.135.220.15]:53696 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728989AbgBZCzh (ORCPT ); Tue, 25 Feb 2020 21:55:37 -0500 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.220.254]) by mx2.suse.de (Postfix) with ESMTP id D474AAC4A; Wed, 26 Feb 2020 02:55:35 +0000 (UTC) Date: Tue, 25 Feb 2020 20:55:31 -0600 From: Goldwyn Rodrigues To: Christoph Hellwig Cc: Ritesh Harjani , linux-ext4@vger.kernel.org, linux-fsdevel@vger.kernel.org, darrick.wong@oracle.com Subject: Re: [PATCH v2] iomap: return partial I/O count on error in iomap_dio_bio_actor Message-ID: <20200226025531.k7miaxfu2yzt3kh6@fiona> References: <20200220152355.5ticlkptc7kwrifz@fiona> <20200221045110.612705204E@d06av21.portsmouth.uk.ibm.com> <20200225205342.GA12066@infradead.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200225205342.GA12066@infradead.org> User-Agent: NeoMutt/20180716 Sender: linux-ext4-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-ext4@vger.kernel.org On 12:53 25/02, Christoph Hellwig wrote: > On Fri, Feb 21, 2020 at 10:21:04AM +0530, Ritesh Harjani wrote: > > > if (dio->error) { > > > iov_iter_revert(dio->submit.iter, copied); > > > - copied = ret = 0; > > > + ret = 0; > > > goto out; > > > } > > > > But if I am seeing this correctly, even after there was a dio->error > > if you return copied > 0, then the loop in iomap_dio_rw will continue > > for next iteration as well. Until the second time it won't copy > > anything since dio->error is set and from there I guess it may return > > 0 which will break the loop. > > In addition to that copied is also iov_iter_reexpand call. We don't > really need the re-expand in case of errors, and in fact we also > have the iov_iter_revert call before jumping out, so this will > need a little bit more of an audit and properly documented in the > commit log. > > > > > Is this the correct flow? Shouldn't the while loop doing > > iomap_apply in iomap_dio_rw should also break in case of > > dio->error? Or did I miss anything? > > We'd need something there iff we care about a good number of written > in case of the error. Goldwyn, can you explain what you need this > number for in btrfs? Maybe with a pointer to the current code base? btrfs needs to account for the bytes "processed", failed or uptodate. This is currently performed in fs/btrfs/inode.c:__end_write_update_ordered(). For the current development version, how I am using it is in my git branch btrfs-iomap-dio [1]. The related commit besides this patch is: 9aeb2b31d10b ("btrfs: Use ->iomap_end() instead of btrfs_dio_data") [1] https://github.com/goldwynr/linux/tree/btrfs-iomap-dio -- Goldwyn