Received: by 2002:a25:31c3:0:0:0:0:0 with SMTP id x186csp986549ybx; Tue, 5 Nov 2019 08:31:45 -0800 (PST) X-Google-Smtp-Source: APXvYqx3VtEwK4Yi8TPP+ofdKDKYJLaPo+ytc/gTrUKHGi6yJoL1X2t5Fv3y+ok9Rf3+z7JbDlO0 X-Received: by 2002:a05:6402:158d:: with SMTP id c13mr20558896edv.62.1572971505488; Tue, 05 Nov 2019 08:31:45 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1572971505; cv=none; d=google.com; s=arc-20160816; b=qNykPopygffT/WmHjGrWAF9akfuK6+uPCoBQnH4a2UJ3nM+2qaLFDnIcE77r20e3OU wwfvD9pivVN8+2n99K11k+HASaiJ1ZDIKEq7hiawKq3xI+DVRYpm2eUgirmtksPMi1rN sX4wNlPE3LwhnwSFALNQz87fZALiuBHgMFNSE4exb3eq8zmP9Eg7kXBdfivqJ6MUeJqn RtHX6alKE633amhvH2QiqqKHiHQfP9NDkXQbAop9Ht1pe2k1dYsQ2iX/JJE94v5dn6Vm 7PNPH6XV34FjINGVFsSz2DGA0s0Akca7CA9C+sBc7g9hJf9gdPcmanfj411xhzR/O/ZY E8tQ== 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=EeLd1O4vj3OGyQXp6w2hfqRa+iC23RV2G+Tk7sAc3Lw=; b=K5LqcbKlq2BcP6K7UP7cteKRzSkKn48XRivTWsPXa9lsuCNTcEdg6lT5aI9AcQRaYT l7R5bVIskFmETFVqYQPPpbu9GDqX+bhVIyle+/zgSN1PJTBer35CrY0ipRb9cgcoo6cI S/tSnMwC8QYj93qiM0Ed4zMqHyBzQ7582j1sWhKlrpiLih8dr4NIU34K4u4gkEXHf+wi OnMzSK6hSkm8XKDnAWlc4WIZeCFWOFgN4R/uLc1Dw9fV/bXJ0meR2EG0pmUZXvouiYaO MyTeOLr9+TZ3I1fLWurWNctW4llzz7JnOakRaWiMsoTetJ7nSqVQoaALmhBWEWZQfFki u82Q== 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 f25si12138476ejw.85.2019.11.05.08.31.15; Tue, 05 Nov 2019 08:31:45 -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; 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 S2390123AbfKEQbJ (ORCPT + 99 others); Tue, 5 Nov 2019 11:31:09 -0500 Received: from outgoing-auth-1.mit.edu ([18.9.28.11]:48257 "EHLO outgoing.mit.edu" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S2390106AbfKEQbI (ORCPT ); Tue, 5 Nov 2019 11:31:08 -0500 Received: from callcc.thunk.org (ip-12-2-52-196.nyc.us.northamericancoax.com [196.52.2.12]) (authenticated bits=0) (User authenticated as tytso@ATHENA.MIT.EDU) by outgoing.mit.edu (8.14.7/8.12.4) with ESMTP id xA5GSvB6019764 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 5 Nov 2019 11:28:58 -0500 Received: by callcc.thunk.org (Postfix, from userid 15806) id 26537420311; Tue, 5 Nov 2019 11:28:55 -0500 (EST) Date: Tue, 5 Nov 2019 11:28:55 -0500 From: "Theodore Y. Ts'o" To: Matthew Bobrowski 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: <20191105162855.GK28764@mit.edu> References: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.12.2 (2019-09-21) 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: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. - Ted