Received: by 2002:a25:6193:0:0:0:0:0 with SMTP id v141csp754762ybb; Fri, 20 Mar 2020 07:35:17 -0700 (PDT) X-Google-Smtp-Source: ADFU+vuazXn+TbCda3+usUVTB/1nvJshiurqSwQ6qKcUhFWnTf/FQJH7b/Ewoiu0n3xH6+fEEJ7C X-Received: by 2002:a9d:5e06:: with SMTP id d6mr7179683oti.311.1584714917236; Fri, 20 Mar 2020 07:35:17 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1584714917; cv=none; d=google.com; s=arc-20160816; b=pqlMIl/5fNBODxUgAAkae9Z92wYQVRl/9Q3Kwhb7e6PSWh0/aq0YpXl2/aq9QBsJk8 WwDXM2U4RcgLFWdOAn+HhoirX4qfJoEKq+CPqV22iYysSL2y5vX8kUc96Z1pzCM1UuEN 8bUv/lj3XqZ4/3wmLKGs3e+5A8xlreKdGWZBPn41+uAF5zzBoHfg93+AMChIn1lhS4EY PytoIw5O7DOVQI1h/yWoLk5b6Wgu75uRKz3DWyl0LjAURACbd0uvpJ38a+vmugMFnJLA rRiuNwDOW0uzSFowWMaK6mdK/mWH8wpQ7XDjfAWhTVI3CVmExR+2P1aiUyFOKXKb8jHn WOhg== 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=LASMtyJcflOe2DO3cMPw3KuweMH8ZRP8HrjCuN3ZWuw=; b=sGDc7jlo8I6Q4X9UWG1ff++L9H5eOaGMOfm6o6R2XC3lUZADQU5D8S7kTlX2SUaJzK uF+WIy7aJxrV7a2xFgD12cnT2T+ECs81tsgpGGFUotm1zSOVCmlMFvoqioOzXqaEYjJl ZX0UXfbXXiqYa7hMMD/LR7eBIcangxCC2FR+OlKgXLiATjuXdLcCtnkqTUZqCAPbVQIc y0N9UHt3L8PNEcsv9uzBD9Dn32etSWnKgXROFbAylXWJzeSz7RrFdQJaaON3mGVjx2Ek W0Z0rlMi8gQAkKYIe6mc/JiFuG5M3vhPIxuLb+0AYKoUHx9ghbwckwrvhX0dzohdl7in lMyQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@infradead.org header.s=bombadil.20170209 header.b=VhUVee2g; 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 p12si3200670otq.62.2020.03.20.07.35.04; Fri, 20 Mar 2020 07:35:17 -0700 (PDT) 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=VhUVee2g; 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 S1726896AbgCTOfC (ORCPT + 99 others); Fri, 20 Mar 2020 10:35:02 -0400 Received: from bombadil.infradead.org ([198.137.202.133]:36824 "EHLO bombadil.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726816AbgCTOfB (ORCPT ); Fri, 20 Mar 2020 10:35:01 -0400 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=LASMtyJcflOe2DO3cMPw3KuweMH8ZRP8HrjCuN3ZWuw=; b=VhUVee2gbMU0XK1vhhZ6TcLOmc sraKGYo+YoBXNwcurStnG0TgfV6N3p0YhFOZRrWy1SZDDqYsRkj/SJgCwF/460LuladY5ZiH4saWL iQ4O7KqQ41MoNhnTKuDc6Lw7FATmy+teB6laEaMzOvxzncKUBUmPZkv/Qc3wDDGbpvNSUzwkhsb9d t87WoEcIsU5ZqMyUvEp2YFL1kyrZ2Kvk3ec30ZUzOFzhXkUmtL9iPnFK4SzqmsH5F/tXWFSjW135w X/Qr2l+kf/HbbjpDjWKYRIeWRtCMDz7oJPZzsw+hhuhW7gPUCnlO/dX9CZPRf5Mo3Rm7NLuawm7/k ArIxTO8w==; Received: from hch by bombadil.infradead.org with local (Exim 4.92.3 #3 (Red Hat Linux)) id 1jFIjk-0006Jc-O9; Fri, 20 Mar 2020 14:35:00 +0000 Date: Fri, 20 Mar 2020 07:35:00 -0700 From: Christoph Hellwig To: Josef Bacik Cc: Christoph Hellwig , Goldwyn Rodrigues , linux-fsdevel@vger.kernel.org, riteshh@linux.ibm.com, linux-ext4@vger.kernel.org, darrick.wong@oracle.com, willy@infradead.org, linux-btrfs@vger.kernel.org Subject: Re: [PATCH v2] iomap: return partial I/O count on error in iomap_dio_bio_actor Message-ID: <20200320143500.GA16143@infradead.org> References: <20200319150805.uaggnfue5xgaougx@fiona> <20200320140538.GA27895@infradead.org> <02209ec3-62b4-595f-b84e-2cd8838ac41b@toxicpanda.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <02209ec3-62b4-595f-b84e-2cd8838ac41b@toxicpanda.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, Mar 20, 2020 at 10:23:43AM -0400, Josef Bacik wrote: > I'm not sure what you're looking at specifically wrt error handling, but I > can explain __endio_write_update_ordered. > > Btrfs has ordered extents to keep track of an extent that currently has IO > being done on it. Generally that IO takes multiple bio's, so we keep track > of the outstanding size of the IO being done, and each bio completes and > thus removes its size from the pending size. If any one of those bios has > an error we need to make sure we discard the whole ordered extent, as part > of it won't be valid. Just a cursory look at the current code I assume > that's what's confusing you, we call this when we have an error in the > O_DIRECT code. This is just so we get the proper cleanup for the ordered > extent. People will wait on the ordered extent to be completed, so if we've > started an ordered extent and aren't able to complete the range we need to > do __endio_write_update_ordered() so that the ordered extent is finished and > we wakeup any waiters. > > Does this help? If I need to I can context switch into whatever you're > looking at, but I'm going to avoid looking and hope I can just shout useful > information in your direction ;). Thanks, Yes, this helps a lot. This is about the patches from Goldwyn to convert btrfs to use the iomap direct I/O code. And in that series he currently calls __endio_write_update_ordered from the ->iomap_end method, which for direct I/O is called after all bios are submitted to complete ordered extents for a range after an I/O error, that is one that no I/O has been submitted to, and the accounting for that is a little complicated..