Received: by 2002:a25:1506:0:0:0:0:0 with SMTP id 6csp4084970ybv; Tue, 25 Feb 2020 12:54:49 -0800 (PST) X-Google-Smtp-Source: APXvYqx2/J7olXBqLZirbeCjjV8ZqKtBz7+rapzmNZ5wrHicnDEdcZ2HD4t1/9VeCdo3lynAqDub X-Received: by 2002:a9d:6a85:: with SMTP id l5mr368273otq.231.1582664089410; Tue, 25 Feb 2020 12:54:49 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1582664089; cv=none; d=google.com; s=arc-20160816; b=eB6OP5M8J66WcJ4mdxNcp7XBZrkqSW9QRub7gRSf2xMZk9E+Winh5gkxS0tX4mRxUI ILy26aX22axkghO20uwLidOpxPEf0EBFK70R7YZnKTTqH81m+LymoS0BDGZDakWUQSHa NUxkZgjGUaFwmvQYFAvdNfCOIHMS6tNDEGCy2EQu1hPk5cqhPr2BjTaHpEPtkeso5CR6 5ktOwgCF26UtPloguN6MDF9OA7QzzY+zWm33PwFCKGl5BhUsEhyrupJOqwq8ctOCQnWl qCzRaBDT1PqVkql/30DEhrZZJWw0xoYq+O/AwggcjCXhObAH1Wa/MCFx8HtaafTSxxFY WWXQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :dkim-signature; bh=0nIut/TecVaZsuHVmLbUyjVdlBhfWH56z72PpkYyH98=; b=xb8E8aj2VwC272HQ3eVuRPEhtV3WYzp5/GvPv95fujcusOtL2uUEUAFMY6UZBreyYc KUIzMNtewALdYpI1TqxJ3kSVA6fhzhfVopdNuFDgtD6PJrsCNUHO+4v5VH2+jCMjlpfp f0hSjdgGphuSXvt8sn6uF1ByzLYAKgadYQJ3mUvdJyO3tBj0M0w7cRYFt+bM9xkoJtcg Hc8rNCJ3wsjU3lJL9TcvMPQYO+KXsoYgLTsbCDz6orSacCxJ5CpGkow54VpWsBIELwTa CxJlHdljnoAq/21Rd0CaBO4VbjjRFnTJDo0mKjQgy/Xv3Qx+b/ryCOAe6mCalqw+iTwk OpqA== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@infradead.org header.s=bombadil.20170209 header.b=HBvYBNsD; 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 a194si182225oib.227.2020.02.25.12.54.31; Tue, 25 Feb 2020 12:54:49 -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; dkim=fail header.i=@infradead.org header.s=bombadil.20170209 header.b=HBvYBNsD; 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 S1729681AbgBYUxo (ORCPT + 99 others); Tue, 25 Feb 2020 15:53:44 -0500 Received: from bombadil.infradead.org ([198.137.202.133]:58204 "EHLO bombadil.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728714AbgBYUxo (ORCPT ); Tue, 25 Feb 2020 15:53:44 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20170209; h=In-Reply-To:Content-Type:MIME-Version :References:Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description; bh=0nIut/TecVaZsuHVmLbUyjVdlBhfWH56z72PpkYyH98=; b=HBvYBNsDTr9+FUVJVQUVxq/OqU Ud9jyuqW9J/D1v90ZliQbd4Lk0nN6wXxl8Po84ngJ9W7ilUdcLllAZ33NNbNlcERx6u5ASsJGvOUA htzO4FNw04/6DfNGG4TOS3R7YB+q0LVQdwAuOuFWNYjDSGNY7JQ9NIgJndphNL8kTzETxiv3eNDIw qsPpY8L9zwRsWMHntYbjMf/l3PL8+IyqV0zK4kdFshac192EdwZCRSAGxPB7ht0qodrrWy2C/MIM/ d6XkpjeA94drQYvJgNB+P7XskG1WldKAjE1E+6zXbBNXRvjGY2RIya/WAgnsIV2clYvvZIrSmrwiv V55Qsz8w==; Received: from hch by bombadil.infradead.org with local (Exim 4.92.3 #3 (Red Hat Linux)) id 1j6hD4-0004he-P4; Tue, 25 Feb 2020 20:53:42 +0000 Date: Tue, 25 Feb 2020 12:53:42 -0800 From: Christoph Hellwig To: Ritesh Harjani Cc: Goldwyn Rodrigues , 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: <20200225205342.GA12066@infradead.org> References: <20200220152355.5ticlkptc7kwrifz@fiona> <20200221045110.612705204E@d06av21.portsmouth.uk.ibm.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200221045110.612705204E@d06av21.portsmouth.uk.ibm.com> X-SRS-Rewrite: SMTP reverse-path rewritten from by bombadil.infradead.org. See http://www.infradead.org/rpr.html Sender: linux-ext4-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-ext4@vger.kernel.org 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?