Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp10019382ybl; Thu, 26 Dec 2019 09:18:06 -0800 (PST) X-Google-Smtp-Source: APXvYqzeQP2UZEry7p6Pvi08/3fZj79sZnU3XI/mgMsoteKK6PWs4S83nvMcWcm+qqpu+9GKWZ1/ X-Received: by 2002:a05:6830:13d9:: with SMTP id e25mr50036080otq.134.1577380686832; Thu, 26 Dec 2019 09:18:06 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1577380686; cv=none; d=google.com; s=arc-20160816; b=zbkivsd61p5ZPF2/3gqSZq14r/n0msjxqDFBOdp1moVajvC39mQN6d+k90hwjhASBP 6SHtYYy2nhTpoarIIjW8eJRN9g2oJ50FDlielExgRE+inL67KBDv21uO1YU9feCSUeIg fzdYVeJc/17Rmxh2JYYf6kGlLRyu082U6HioF86JOmfFRA/bmycTu4X9hyPMBZTfMwDs SJr2E4a7Nr7i/G/PeYOnyraHqPvWHRrGUz89NqSV2MabMfC0DnbLy5HoLBYNAu2qXQo5 paM6Vb50OoHyYnQuGohVg3bSZeDJVT5Hb5f2Dp/wY7q4iox0fsB8Ur8OM0AASTr3az+c ROPA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date; bh=KC550oRPgi368FS09+pLjF6rir6rvXBCGFrxudQqivM=; b=SoB9fD8O9jJqn0evoE9P98S3t67tCGnXvnsqN5Wt3BU7LWWduQZ7MNX1mbGrGf4oYZ n7lq3qDBiWOelFTrq2gq2rKAvJUzyd3USwP24DPKgTvvF10OWBQUN/Q1NucrYiNUTpMp XR7xHNaGNArGO+HP7mlAj8AnnkcxFK2j7Ei4BxTFTAofsmN2qXK/Ynmtzsk91GA6RL2H 4tRVDdW7LqwrVdCoLDlHc+pgBBnqjDQzMlfPdK2E5Oi9ZKyhrgA9Guql+ohJV9u0B79y 7eDMsNfVsoAexSei1g0Z+ZYGVLNA1GoBeJUUqlP9df84vmzvBGXGOMmC/R1tyPDYoSMe wxDA== 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 c19si13580042otn.7.2019.12.26.09.17.47; Thu, 26 Dec 2019 09:18:06 -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 S1726511AbfLZRRq (ORCPT + 99 others); Thu, 26 Dec 2019 12:17:46 -0500 Received: from outgoing-auth-1.mit.edu ([18.9.28.11]:57774 "EHLO outgoing.mit.edu" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726480AbfLZRRq (ORCPT ); Thu, 26 Dec 2019 12:17:46 -0500 Received: from callcc.thunk.org (96-72-102-169-static.hfc.comcastbusiness.net [96.72.102.169] (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 xBQHHWX5016268 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 26 Dec 2019 12:17:33 -0500 Received: by callcc.thunk.org (Postfix, from userid 15806) id B3B6E420485; Thu, 26 Dec 2019 12:17:31 -0500 (EST) Date: Thu, 26 Dec 2019 12:17:31 -0500 From: "Theodore Y. Ts'o" To: Jan Kara Cc: Ritesh Harjani , linux-ext4@vger.kernel.org, Dan Williams , "Berrocal, Eduardo" Subject: Re: [PATCH] ext4: Optimize ext4 DIO overwrites Message-ID: <20191226171731.GE3158@mit.edu> References: <20191218174433.19380-1-jack@suse.cz> <20191219135329.529E3A404D@d06av23.portsmouth.uk.ibm.com> <20191219192823.GA5389@quack2.suse.cz> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20191219192823.GA5389@quack2.suse.cz> Sender: linux-ext4-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-ext4@vger.kernel.org On Thu, Dec 19, 2019 at 08:28:23PM +0100, Jan Kara wrote: > > However depending on which patch lands first one may need a > > re-basing. Will conflict with this- > > https://marc.info/?l=linux-ext4&m=157613016931238&w=2 > > Yes, but the conflict is minor and trivial to resolve. > Is this the correct resolution? --- a/fs/ext4/file.c +++ b/fs/ext4/file.c @@ -447,6 +447,7 @@ static ssize_t ext4_dio_write_iter(struct kiocb *iocb, struct iov_iter *from) struct inode *inode = file_inode(iocb->ki_filp); loff_t offset = iocb->ki_pos; size_t count = iov_iter_count(from); + const struct iomap_ops *iomap_ops = &ext4_iomap_ops; bool extend = false, unaligned_io = false; bool ilock_shared = true; @@ -526,7 +527,9 @@ static ssize_t ext4_dio_write_iter(struct kiocb *iocb, struct iov_iter *from) ext4_journal_stop(handle); } - ret = iomap_dio_rw(iocb, from, &ext4_iomap_ops, &ext4_dio_write_ops, + if (ilock_shared) + iomap_ops = &ext4_iomap_overwrite_ops; + ret = iomap_dio_rw(iocb, from, iomap_ops, &ext4_dio_write_ops, is_sync_kiocb(iocb) || unaligned_io || extend); if (extend) - Ted