Received: by 2002:a25:31c3:0:0:0:0:0 with SMTP id x186csp1251864ybx; Tue, 5 Nov 2019 12:58:12 -0800 (PST) X-Google-Smtp-Source: APXvYqw5+3dWUulq1iv/5AZEnhWoXAyTzvECBjEkbwyIDE2CTaV0wzmb/jziImyKgeJtBSpmmgtv X-Received: by 2002:a17:907:20b4:: with SMTP id pw20mr23582764ejb.83.1572987492155; Tue, 05 Nov 2019 12:58:12 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1572987492; cv=none; d=google.com; s=arc-20160816; b=HYZ0NuMMAlDAXgOG4IBQhFWezO3lNdYH3jnIx8ZKHyC31QNrVZQ2PMlT6w2UBbXg+3 rhglamSXy7qN0uK3QeMVrSXWv1wTBV3PMSKfTaZbTjMV5L8usJal5N2a9pvzt38YeRIO A7OLhcjQiDcqGlv2wpTrmlLaOFNEj6q+1onIYo3wHuXZZ52NtvprLHVAOJp8fPa/Qhfi pkDYfBdZi8tuDI6pNp8JKEB9FS2WJsV5NQJqwNV8D/nz8jUgJiXFPbZTPshgI6mUI9/1 8qnJ5f0LIGp5s0IQNShcLMIVx/O4KceQ/Jw3bv+4kvGT4wEzPrxhljdMMXTJ3ONmwcKP SdDw== 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:dkim-signature; bh=ldGXgXo+SDJcu05JI5sP7Qx9Oq7c4XpgCQT7FyWcujU=; b=AtELjv417LWPpmrO8Ls9/TdzRjTrcVEg00WzBoVpIw1vnKgVz/efBs3Vi+2/uKG+U5 ycezKPKkk2TnbvArOeKKOupKo417ug7kRKDJzZsZYQW+8eg1FZUKZ5k29MEb5mhKi4ni F4Gq7vjaTnar7zepKDNHfIt+aU2q1Z0cGh8+3nT3Y5a72E5nPQbY3BtzOEuZJD3P5xMZ xrSePTghIQw0EwJf/V+IHbq0ghoO/VQ8qPXTorFnlMiz0MjO9Q3RHmHgFvtTqC1mcfwl OO5H4mxz6PKyH/EmU0LyYVFZvOWsHYEMimFzRKFNCLgxD7kch3Q0uBWrFsjJ4fiyWp57 8IyA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@mbobrowski-org.20150623.gappssmtp.com header.s=20150623 header.b=gHiIFbFc; 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 26si15178959ejx.60.2019.11.05.12.57.47; Tue, 05 Nov 2019 12:58:12 -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=pass header.i=@mbobrowski-org.20150623.gappssmtp.com header.s=20150623 header.b=gHiIFbFc; 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 S1728515AbfKEU5X (ORCPT + 99 others); Tue, 5 Nov 2019 15:57:23 -0500 Received: from mail-pg1-f196.google.com ([209.85.215.196]:40763 "EHLO mail-pg1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729888AbfKEU5X (ORCPT ); Tue, 5 Nov 2019 15:57:23 -0500 Received: by mail-pg1-f196.google.com with SMTP id 15so15315620pgt.7 for ; Tue, 05 Nov 2019 12:57:21 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=mbobrowski-org.20150623.gappssmtp.com; s=20150623; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=ldGXgXo+SDJcu05JI5sP7Qx9Oq7c4XpgCQT7FyWcujU=; b=gHiIFbFcG1vYdm3LeRDPMt7Y4tNkBMDPYHtXOmAxUNCYSu0hFXWYUwTs8OKze3e3Fg lgGrQadPjBlnzheU7mrduN8WzUNA/5EKDZSsKM8Ub23Gs5qtl1CjaaJMrldSNV0egQC1 IbdijKI26mRr5TgpPXqc9WhLl7/0/n3xjpChRrHtbp3Gj7d2gFbZy2O4ppWnHCGxPfe2 dx8DFB+9sEeH7Kn5CyQmzps4mLv8Vp5/7f/uXZseVRJbOCOwnW2y+jpmwFhNhNGfTv8Y Ycv+tg3lrotJYfwqvFF2yybRziV9qiK1nLSAwi0/Hl11239VOyc5+2HWHslH4LSee50Q G0Hg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=ldGXgXo+SDJcu05JI5sP7Qx9Oq7c4XpgCQT7FyWcujU=; b=PvnKPvAfa8fsspNplgT+6/HxPu2oDa08MeXa2sXq0ueIPUBtPxWlFQVFpy7Xk1nYpj otxpHHJ1cWaaqOtXVA4KvPOwgAifOaz4yWE9ubRxIParY8xxp5QbdS9Mn4FCRCmtD2jF g2x4agV2XU4ergQtgKWUho2mfFdcLb3LtlrTAVocsVU+VOIcn3hLEiTWw4OtaTfwD25r s9pUtzfqqDjznxbqn5UHKhRYz56jDoVXy8IOk9ywAC08BoWasFQKIYLA1+44y0KobpRi pSQk1jPbzmQ5Bhe94+I/09WDn/WwIZWR7XDMXgBIXa6SweUYuoES+qyM6fUsE9XtgQUi QlmQ== X-Gm-Message-State: APjAAAUM7o6YY6+2CWGVT68JaJDI5K5ltR06xAqFChOZt5H0SZy/hfcT GuRNgyMhsuMoNtxTz2OreWQ2 X-Received: by 2002:a17:90a:f0cf:: with SMTP id fa15mr1318583pjb.51.1572987440647; Tue, 05 Nov 2019 12:57:20 -0800 (PST) Received: from bobrowski ([110.232.114.101]) by smtp.gmail.com with ESMTPSA id z11sm26264279pfg.117.2019.11.05.12.57.17 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 05 Nov 2019 12:57:19 -0800 (PST) Date: Wed, 6 Nov 2019 07:57:13 +1100 From: Matthew Bobrowski To: "Theodore Y. Ts'o" Cc: jack@suse.cz, adilger.kernel@dilger.ca, linux-ext4@vger.kernel.org, linux-fsdevel@vger.kernel.org, riteshh@linux.ibm.com Subject: Re: [PATCH v7 11/11] ext4: introduce direct I/O write using iomap infrastructure Message-ID: <20191105205712.GB1739@bobrowski> References: <20191105162855.GK28764@mit.edu> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20191105162855.GK28764@mit.edu> 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, Nov 05, 2019 at 11:28:55AM -0500, Theodore Y. Ts'o wrote: > On Tue, Nov 05, 2019 at 11:02:39PM +1100, Matthew Bobrowski wrote: > > + ret = iomap_dio_rw(iocb, from, &ext4_iomap_ops, &ext4_dio_write_ops, > > + is_sync_kiocb(iocb) || unaligned_aio || extend); > > + > > + if (extend) > > + ret = ext4_handle_inode_extension(inode, offset, ret, count); > > + > > Can we do a slight optimization here like this? > > ret = iomap_dio_rw(iocb, from, &ext4_iomap_ops, &ext4_dio_write_ops, > is_sync_kiocb(iocb) || unaligned_aio || extend); > > if (extend && ret != -EBIOCQUEUED) > ret = ext4_handle_inode_extension(inode, offset, ret, count); > > > If iomap_dio_rw() returns -EBIOCQUEUED, there's no need to do any of > the ext4_handle_inode_extension --- in particular, there's no need to > call ext4_truncate_failed_write(), which has a bunch of extra > overhead, including taking and releasing i_data_sem. Hm, but for extension, unaligned asynchronous IO, or synchronous IO cases, 'wait_for_completion' within iomap_dio_rw() is set to true and as a result we'd never expect to receive -EIOCBQUEUED from iomap_dio_rw()? So, with that said, would the above change be necessary seeing as though we'd never expect ret == -EIOCBQUEUED when extend == true? Maybe I'm missing something? /M