Received: by 2002:a25:8b12:0:0:0:0:0 with SMTP id i18csp938869ybl; Wed, 28 Aug 2019 07:28:14 -0700 (PDT) X-Google-Smtp-Source: APXvYqwt9lVR0oQV/SMqGVFq+qj/XTTZs+uW1pOHUzkncic6n6qoXHuqf81Wcm4tfIbpcP5gOhlf X-Received: by 2002:a65:65c5:: with SMTP id y5mr3650581pgv.342.1567002494102; Wed, 28 Aug 2019 07:28:14 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1567002494; cv=none; d=google.com; s=arc-20160816; b=mvkPYFVkXaT5ZYeBS1wd7YsaIh5sXPIfCBcvYHVxEVS0Kz7gXcZ0niEQoo/jOFSc9w iFb0R5jWKl/0APK5YcI8IpxzgUDp7kqhNdr6xBNQZNlLoEVmnKX8qKx44Qx6W7Ab2xxo +Lkbkycslim3dKr7QQSp/qs1QRZoZ1tWItV1i7XahDvECxI7B4GuqbBlzhqD9l4D0Nil 6Rr1u56gMtjX/QqqiXMKXfu2po7si/e+hE6Xmnn5Cy8Sfo7EpDvaNfHF0sUDrwyvHag8 mN49zuviCPB9UDB2skLkPCrj05gV5y9RX/F82bXg60JnU5NjFe9NzE18eTHVVWCaO0Dy eMig== 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=uiMDg2mKHXRQ/mxxQeQmuclntTrSGkSzZt5+MjoGrjY=; b=TJEmeNtlSpmlX6N70E3FYmYAu1Tm874fOT05cvP9VN3FCbU/w9+N+kdlmHBj5DiOtH 7Y3gMtHZNfrUJpzXlV1EUUC/ZVke509DpmasTNpRHRovhOh1NsNR9xIopmzUXu7XvU5L NEYvgLzwPW0DoKBHc1Xzzy3gmXVJjpRmrQA3jtL6Hvnzvrad9PbD/zXzbchgwdjgtF13 h0lzOlTXQ2Sb6Eo8KlqfLERsUvjqzYsiBTRTPwLCHxKeC9Ne5+uQ/jXP42kIvOItquYn t63MkAOcy9lrsX8Ac/S+7l+p6D8xpEGsYTRdJdlb1V0LGxwHV94E55DhUaBNuTVjjkW+ C05g== 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 186si2745622pfd.44.2019.08.28.07.27.53; Wed, 28 Aug 2019 07:28:14 -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; 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 S1726603AbfH1O1w (ORCPT + 99 others); Wed, 28 Aug 2019 10:27:52 -0400 Received: from outgoing-auth-1.mit.edu ([18.9.28.11]:48329 "EHLO outgoing.mit.edu" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726415AbfH1O1w (ORCPT ); Wed, 28 Aug 2019 10:27:52 -0400 Received: from callcc.thunk.org (guestnat-104-133-0-111.corp.google.com [104.133.0.111] (may be forged)) (authenticated bits=0) (User authenticated as tytso@ATHENA.MIT.EDU) by outgoing.mit.edu (8.14.7/8.12.4) with ESMTP id x7SERT6U008937 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 28 Aug 2019 10:27:30 -0400 Received: by callcc.thunk.org (Postfix, from userid 15806) id 4AA8F42049E; Wed, 28 Aug 2019 10:27:29 -0400 (EDT) Date: Wed, 28 Aug 2019 10:27:29 -0400 From: "Theodore Y. Ts'o" To: Matthew Bobrowski Cc: Christoph Hellwig , "Darrick J. Wong" , Ritesh Harjani , jack@suse.cz, adilger.kernel@dilger.ca, linux-ext4@vger.kernel.org, linux-fsdevel@vger.kernel.org, aneesh.kumar@linux.ibm.com Subject: Re: [PATCH 0/5] ext4: direct IO via iomap infrastructure Message-ID: <20190828142729.GB24857@mit.edu> References: <20190813111004.GA12682@poseidon.bobrowski.net> <20190813122723.AE6264C040@d06av22.portsmouth.uk.ibm.com> <20190821131405.GC24417@poseidon.bobrowski.net> <20190822120015.GA3330@poseidon.bobrowski.net> <20190822141126.70A94A407B@d06av23.portsmouth.uk.ibm.com> <20190824031830.GB2174@poseidon.bobrowski.net> <20190824035554.GA1037502@magnolia> <20190824230427.GA32012@infradead.org> <20190827095221.GA1568@poseidon.bobrowski.net> <20190828120509.GC22165@poseidon.bobrowski.net> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20190828120509.GC22165@poseidon.bobrowski.net> User-Agent: Mutt/1.10.1 (2018-07-13) Sender: linux-ext4-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-ext4@vger.kernel.org On Wed, Aug 28, 2019 at 10:05:11PM +1000, Matthew Bobrowski wrote: > > What is not clear to me at this point though is whether it is still > > necessary to explicitly track unwritten extents via in-core inode > > attributes i.e. ->i_unwritten and ->i_state_flags under the new direct > > IO code path implementation, which makes use of the iomap > > infrastructure. Or, whether we can get away with simply not using > > these in-core inode attributes and rely just on checks against the > > extent record directly, as breifly mentioned by Darrick. I would think > > that this type of check would be enough, however the checks around > > whether the inode is currently undergoing direct IO were implemented > > at some point, so there must be a reason for having them > > (a9b8241594add)? The original reason why we created the DIO_STATE_UNWRITTEN flag was a fast path, where the common case is writing blocks to an existing location in a file where the blocks are already allocated, and marked as written. So consulting the on-disk extent tree to determine whether unwritten extents need to be converted and/or split is certainly doable. However, it's expensive for the common case. So having a hint whether we need to schedule a workqueue to possibly convert an unwritten region is helpful. If we can just free the bio and exit the I/O completion handler without having to take shared locks to examine the on-disk extent tree, so much the better. > Maybe it's a silly question, although I'm wanting to clarify my > understanding around why it is that when we either try prepend or > append to an existing extent, we don't permit merging of extents if If I recall correctly, the reason for this check was mainly the concern that we would end up merging an extent that we would then have to split later on (when the direct I/O completed). To be honest, i'm not 100% sure what would happen if we removed that restriction; it might be that things would work just fine (just slower in some workloads), or whether there is some hidden dependency that would explode. I suspect we'd have to try the experiment to be sure. - Ted