Received: by 2002:a05:6a10:1287:0:0:0:0 with SMTP id d7csp3530768pxv; Mon, 26 Jul 2021 06:15:35 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyVAIC65aT7rmZR3kZGg+Dc5eLLWKmM1bzi6iMxVqxMnag9V9vKjLLCTPjQjyEUwCK9ZuVk X-Received: by 2002:a6b:5115:: with SMTP id f21mr15031973iob.161.1627305335102; Mon, 26 Jul 2021 06:15:35 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1627305335; cv=none; d=google.com; s=arc-20160816; b=jbC2gbso+KK7VVVVPwtcKtWh/z+T2rY+Kx8vNI3xQLMPi18nTKtMy6X4bdkCBaLL6Y 5uCoZMaGP2gaLIyk4RTSBwb5xJucj24cCahwgRYCoZuLCBL3T2uY7MBU1qwDRzbLBLA5 TiKVMqX4wvYcEOK0pMlHLQugpfoKjgZkYNTEo+Ilx0J5py77N8z+h01KU/qH3HLjEtTd MUjAH+XWqAv9Gwnbw0voh7fCknx8Khr/5eJEAsMi2PbHT+vEyOqv9mwTgvZxzK27V0l+ QMmiy9mfT/f06yXHzYiq5rkn03hz7yXmjCQJiq6tmuwkgzgjBBPRp8rPUHMIv//2JsPm pJ9w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:mail-followup-to:message-id:subject:cc:to:from:date; bh=6Fj60NNCh96SB7cmbRExuq4fk1u65krFIWvFl/SyoI4=; b=RKkSRHqSBPoDIyY3NapB33t9CDneBRncWkMhMYvWrXY96hnV+WaugT9ZcsNXmYmH5w 2LGburItbwor3YjXQ7Q5hzQPyqtyWd0UTwYHiMwl6cAdRNAU5SGj8P/yYIq6dilqILTX xR9yr59DZP30whxIgM4XMxdZagXLNkOq0EgvWeqfOOEHD4OoKyHjdz26Gr2E2ZIDF4lo vsTGVsbusOvaGaKhZ1QoinhC98npzGuPMjsjSryDMESNkgpPkg4/Ud+5CLKMqzebRdFb AM83AGTJs790s3Z2eqFyYYyeO3vTO4ZplWNYjSCzp2Mvigr/6ZfqH5eVPEqau3FwDK5R wonw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=alibaba.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id n12si44024893ilq.134.2021.07.26.06.15.23; Mon, 26 Jul 2021 06:15:35 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=alibaba.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231874AbhGZMcU (ORCPT + 99 others); Mon, 26 Jul 2021 08:32:20 -0400 Received: from out30-132.freemail.mail.aliyun.com ([115.124.30.132]:54948 "EHLO out30-132.freemail.mail.aliyun.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233206AbhGZMcT (ORCPT ); Mon, 26 Jul 2021 08:32:19 -0400 X-Alimail-AntiSpam: AC=PASS;BC=-1|-1;BR=01201311R711e4;CH=green;DM=||false|;DS=||;FP=0|-1|-1|-1|0|-1|-1|-1;HT=e01e01424;MF=hsiangkao@linux.alibaba.com;NM=1;PH=DS;RN=9;SR=0;TI=SMTPD_---0Uh2wVP4_1627305165; Received: from B-P7TQMD6M-0146.local(mailfrom:hsiangkao@linux.alibaba.com fp:SMTPD_---0Uh2wVP4_1627305165) by smtp.aliyun-inc.com(127.0.0.1); Mon, 26 Jul 2021 21:12:46 +0800 Date: Mon, 26 Jul 2021 21:12:44 +0800 From: Gao Xiang To: Andreas Gruenbacher Cc: Matthew Wilcox , Christoph Hellwig , "Darrick J . Wong" , Huang Jianan , linux-erofs@lists.ozlabs.org, linux-fsdevel , LKML , Andreas Gruenbacher Subject: Re: [PATCH v7] iomap: make inline data support more flexible Message-ID: Mail-Followup-To: Andreas Gruenbacher , Matthew Wilcox , Christoph Hellwig , "Darrick J . Wong" , Huang Jianan , linux-erofs@lists.ozlabs.org, linux-fsdevel , LKML , Andreas Gruenbacher References: <20210723174131.180813-1-hsiangkao@linux.alibaba.com> <20210725221639.426565-1-agruenba@redhat.com> <20210726110611.459173-1-agruenba@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Jul 26, 2021 at 03:03:14PM +0200, Andreas Gruenbacher wrote: > On Mon, Jul 26, 2021 at 2:33 PM Matthew Wilcox wrote: > > On Mon, Jul 26, 2021 at 01:06:11PM +0200, Andreas Gruenbacher wrote: > > > @@ -671,11 +683,11 @@ static size_t iomap_write_end_inline(struct inode *inode, struct page *page, > > > void *addr; > > > > > > WARN_ON_ONCE(!PageUptodate(page)); > > > - BUG_ON(pos + copied > PAGE_SIZE - offset_in_page(iomap->inline_data)); > > > + BUG_ON(!iomap_inline_data_size_valid(iomap)); > > > > > > flush_dcache_page(page); > > > addr = kmap_atomic(page); > > > - memcpy(iomap->inline_data + pos, addr + pos, copied); > > > + memcpy(iomap_inline_data(iomap, pos), addr + pos, copied); > > > kunmap_atomic(addr); > > > > > > mark_inode_dirty(inode); > > > > Only tangentially related ... why do we memcpy the data into the tail > > at write_end() time instead of at writepage() time? I see there's a > > workaround for that in gfs2's page_mkwrite(): > > > > if (gfs2_is_stuffed(ip)) { > > err = gfs2_unstuff_dinode(ip); > > > > (an mmap store cannot change the size of the file, so this would be > > unnecessary) > > Not sure if an additional __set_page_dirty_nobuffers is needed in that > case, but doing the writeback at writepage time should work just as > well. It's just that gfs2 did it at write time historically. The > un-inlining in gfs2_page_mkwrite() could probably also be removed. > > I can give this a try, but I'll unfortunately be AFK for the next > couple of days. I tend to leave it as another new story and can be resolved with another patch to improve it (or I will stuck in this, I need to do my own development stuff instead of spinning with this iomap patch since I can see this already work well for gfs2 and erofs), I will update the patch Andreas posted with Christoph's comments. Thanks, Gao Xiang