Received: by 2002:a25:d7c1:0:0:0:0:0 with SMTP id o184csp5357322ybg; Tue, 22 Oct 2019 01:52:46 -0700 (PDT) X-Google-Smtp-Source: APXvYqyjuUeCSmPlgWmAIRE4Lcr3E4M7Tdg+3jJV7uz3v/uu++nIoQnio1tZ8nkf7unigyEewvQi X-Received: by 2002:a17:906:3e41:: with SMTP id t1mr26658845eji.103.1571734366839; Tue, 22 Oct 2019 01:52:46 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1571734366; cv=none; d=google.com; s=arc-20160816; b=Zum3WUMup7drB8O7orZmfuKyIoBrzPbGmSwQL0SIRfUYd/ZhcZ+zjjrIB5xULN32CU IOjy5XI+s/fX47YcAQu+sO7jTgLNRX3fKMNfmuSc4ZXtqpJ0uShdptfK6+sxOT8G3lr2 YvGty3blNFwn9nJW9yeneycpTrIW9l4N3aQbYhVo7Mbqxo+FcvBSapTwBdo0vZLXYk+t vzH9bvlDdgrvy0C51rY4E2FA/jcMjbDHLKwl6p8Xm5hJVJ8bSox4HRSZjNI1H7Kkaiu1 4CGi+IL7wSsVBOCZHHXylYyJbVhgT4KXhHm+F+XzFAicni3F9Jje+qTOlHkcfzV4NCBD mnRA== 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=njOq4cbo6FRpsAPpcSSXFBhXxMP70FXOLMeLLpqSIuE=; b=Z0brpWuPTph0LkUT3N2KwXZfzZxj7CADOMhnwTag1akHWtdqiPj9bof9RbXrpz9H+o p7yazJgNfHjwH8gXfkQiopQgCdy8JpLRp9JjfmWSmaAd0TNUZp7IytTE/qlsz2A3oj0x 1Rn9RIZszzJCFIV3R4Ab0CwKtNb5ms06wXN91U9IhB/LLQmiPHXq1qCB3TlWoNzIsS2f K+DEJQfXNSGWNkZZH+lTPlPFNk2eykErejXsLfz5HavUUFpCJ4DWUnjzgwfHkJ+7go5P X+pFJc3YYLDsERCv/IUOHZkRlLXy+noGEhM/qyBP9XdvewXJm1J1luEUs0dG555FCeGt 86DQ== 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 u6si11250116eds.173.2019.10.22.01.52.22; Tue, 22 Oct 2019 01:52:46 -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 S2387575AbfJVIuZ (ORCPT + 99 others); Tue, 22 Oct 2019 04:50:25 -0400 Received: from mx2.suse.de ([195.135.220.15]:56962 "EHLO mx1.suse.de" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S2387479AbfJVIuZ (ORCPT ); Tue, 22 Oct 2019 04:50:25 -0400 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.220.254]) by mx1.suse.de (Postfix) with ESMTP id C5273B5BF; Tue, 22 Oct 2019 08:50:23 +0000 (UTC) Received: by quack2.suse.cz (Postfix, from userid 1000) id 107F61E4AA2; Tue, 22 Oct 2019 09:55:48 +0200 (CEST) Date: Tue, 22 Oct 2019 09:55:48 +0200 From: Jan Kara To: Matthew Bobrowski Cc: Jan Kara , tytso@mit.edu, adilger.kernel@dilger.ca, linux-ext4@vger.kernel.org, linux-fsdevel@vger.kernel.org, hch@infradead.org, david@fromorbit.com, darrick.wong@oracle.com Subject: Re: [PATCH v5 12/12] ext4: introduce direct I/O write using iomap infrastructure Message-ID: <20191022075548.GB2436@quack2.suse.cz> References: <20191021161848.GI25184@quack2.suse.cz> <20191022030235.GG5092@athena.bobrowski.net> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20191022030235.GG5092@athena.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 Tue 22-10-19 14:02:35, Matthew Bobrowski wrote: > On Mon, Oct 21, 2019 at 06:18:48PM +0200, Jan Kara wrote: > > > + if (extend) { > > > + ret = ext4_handle_inode_extension(inode, ret, offset, count); > > > + > > > + /* > > > + * We may have failed to remove the inode from the orphan list > > > + * in the case that the i_disksize got update due to delalloc > > > + * writeback while the direct I/O was running. We need to make > > > + * sure we remove it from the orphan list as if we've > > > + * prematurely popped it onto the list. > > > + */ > > > + if (!list_empty(&EXT4_I(inode)->i_orphan)) { > > > + handle = ext4_journal_start(inode, EXT4_HT_INODE, 2); > > > + if (IS_ERR(handle)) { > > > + ret = PTR_ERR(handle); > > > + if (inode->i_nlink) > > > + ext4_orphan_del(NULL, inode); > > > + goto out; > > > + } > > > + > > > + if (inode->i_nlink) > > > > This check can be joined with the list_empty() check above to save us from > > unnecessarily starting a transaction. > > Yes, easy done. > > > Also I was wondering whether it would not make more sense have this > > orphan handling bit also in > > ext4_handle_inode_extension(). ext4_dax_write_iter() doesn't > > strictly need it (as for DAX i_disksize cannot currently change > > while ext4_dax_write_iter() is running) but it would look more > > robust to me for the future users and it certainly doesn't hurt > > ext4_dax_write_iter() case. > > I was thinking the same, but to be honest I wasn't entirely sure how > it would pan out for the DAX code path. However, seeing as though you > don't forsee there being any problems, then I can't really think of a > reason not to roll this up into ext4_handle_inode_extension(). > > So, in ext4_handle_inode_extension() for the initial check against > i_disksize, rather than returning 'written' and then having > ext4_dio_write_iter() perform the cleanup, we could simply jump to a > chunk of code in ext4_handle_inode_extension() and deal with it there, > or quite literally just cleanup if that branch is taken there and then > seeing as though it's not really needed in any other case? What do you > think? Yeah, the last option makes the most sense to me. Honza -- Jan Kara SUSE Labs, CR