From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.2 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_SANE_1 autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 407C4C5DF62 for ; Tue, 5 Nov 2019 16:31:10 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 205E5217F5 for ; Tue, 5 Nov 2019 16:31:10 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2390158AbfKEQbJ (ORCPT ); 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-fsdevel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-fsdevel@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