Received: by 2002:a25:1506:0:0:0:0:0 with SMTP id 6csp1892281ybv; Fri, 21 Feb 2020 05:15:22 -0800 (PST) X-Google-Smtp-Source: APXvYqz6AIy64wbKbbwbLpxIq4KB/A3Ke5z5XFnnpNoxe1OrPWGIUl9Ce0FXYjEB/OyWMw+wHPbr X-Received: by 2002:a9d:116:: with SMTP id 22mr5174656otu.149.1582290922429; Fri, 21 Feb 2020 05:15:22 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1582290922; cv=none; d=google.com; s=arc-20160816; b=ToBxkBa+dmwuJq7TWOhzt49WOqOY1tMWWYw0N78/0dfd2Hp3iR1zE6aTOYivpY7mHS AW2Ao8CA1mctMA+a3Mjhlp+0AnPkzBJiQHVjIZOveKeBuIii8g9gmFTHBdOuh1MYNvCI Cl9Y3ityZyKsbjdEBKhQga2b9znWf9KM6DESbiL5wWtypVnTvVshMl/pqlYhbDojQDLu YkR3E17ioO4scw0kkiz2Qvuy6e+T5NEX0CZTudgMyCKHjeY2CTcWwGxFWOplSfSp+dRv US/bWM3HTiaSkY0/mG4OdoSmo3+J7jn76+MPvbHGp7BUqr6JRO+/De0why7G0z9Nhr4L eSgg== 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:reply-to:message-id :subject:cc:to:from:date; bh=h2okf7SSspBRljNQLyhx4IWod9rNwEyAMd4dNzNr0J0=; b=vzhXWWr4l5RINNJvNrIswHZ4ejnEfv0OIjmUGlKxLvKQTa+ajqNF4dnYVI+RYIVk2M LZ4SDuaavKhqXnWNNAfdf63RFH/fNqh066vI55HtU0V34+Ya1u9zinOB7lERtyUeZdZg DB7rzPo0ETGFMVNPSeoP/J6e1TTbhYKfyWbCEew5IKdkSN3VNmEEGeHXQgq3VfJdWv4b thiBmnPrr3SfT0fi/xjCal8H/S5+3o/hsZ6Mf42Vk07uEVxD36gVjwTdMOnnqy7fkblK Ks0OSPsMLFHt/JRyVteqgsOkaAVKhikxPtRpMK70JC2EEc0RhthOyRjmguL9T7Dxn/Fb wTqw== 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 n1si711280oic.225.2020.02.21.05.15.00; Fri, 21 Feb 2020 05:15:22 -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 S1727053AbgBUNOt (ORCPT + 99 others); Fri, 21 Feb 2020 08:14:49 -0500 Received: from mx2.suse.de ([195.135.220.15]:48580 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727039AbgBUNOt (ORCPT ); Fri, 21 Feb 2020 08:14:49 -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 E4372AF4D; Fri, 21 Feb 2020 13:14:47 +0000 (UTC) Received: by ds.suse.cz (Postfix, from userid 10065) id 46E03DA70E; Fri, 21 Feb 2020 14:14:30 +0100 (CET) Date: Fri, 21 Feb 2020 14:14:29 +0100 From: David Sterba To: Goldwyn Rodrigues Cc: linux-ext4@vger.kernel.org, linux-fsdevel@vger.kernel.org, hch@infradead.org, darrick.wong@oracle.com Subject: Re: [PATCH v2] iomap: return partial I/O count on error in iomap_dio_bio_actor Message-ID: <20200221131429.GF2902@twin.jikos.cz> Reply-To: dsterba@suse.cz References: <20200220152355.5ticlkptc7kwrifz@fiona> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200220152355.5ticlkptc7kwrifz@fiona> User-Agent: Mutt/1.5.23.1-rc1 (2014-03-12) Sender: linux-ext4-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-ext4@vger.kernel.org On Thu, Feb 20, 2020 at 09:23:55AM -0600, Goldwyn Rodrigues wrote: > In case of a block device error, written parameter in iomap_end() > is zero as opposed to the amount of submitted I/O. > Filesystems such as btrfs need to account for the I/O in ordered > extents, even if it resulted in an error. Having (incomplete) > submitted bytes in written gives the filesystem the amount of data > which has been submitted before the error occurred, and the > filesystem code can choose how to use it. > > The final returned error for iomap_dio_rw() is set by > iomap_dio_complete(). > > Partial writes in direct I/O are considered an error. So, > ->iomap_end() using written == 0 as error must be changed > to written < length. In this case, ext4 is the only user. > > Signed-off-by: Goldwyn Rodrigues > diff --git a/fs/iomap/direct-io.c b/fs/iomap/direct-io.c > index 41c1e7c20a1f..01865db1bd09 100644 > --- a/fs/iomap/direct-io.c > +++ b/fs/iomap/direct-io.c > @@ -264,7 +264,7 @@ iomap_dio_bio_actor(struct inode *inode, loff_t pos, loff_t length, > size_t n; > if (dio->error) { > iov_iter_revert(dio->submit.iter, copied); > - copied = ret = 0; > + ret = 0; > goto out; > } This part fixes problems I saw with the dio-iomap btrfs conversion patchset, thanks.