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=-8.7 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS,UNPARSEABLE_RELAY,URIBL_BLOCKED autolearn=unavailable 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 0FA01C4320A for ; Mon, 26 Jul 2021 13:12:52 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id DD8A160F37 for ; Mon, 26 Jul 2021 13:12:51 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233533AbhGZMcV (ORCPT ); Mon, 26 Jul 2021 08:32:21 -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 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=-8.7 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS,UNPARSEABLE_RELAY,URIBL_BLOCKED autolearn=unavailable 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 EFEB1C4338F for ; Mon, 26 Jul 2021 13:18:32 +0000 (UTC) Received: from lists.ozlabs.org (lists.ozlabs.org [112.213.38.117]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 4ECD56056C for ; Mon, 26 Jul 2021 13:18:32 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 4ECD56056C Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=linux.alibaba.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=lists.ozlabs.org Received: from boromir.ozlabs.org (localhost [IPv6:::1]) by lists.ozlabs.org (Postfix) with ESMTP id 4GYL8l0Fdtz307g for ; Mon, 26 Jul 2021 23:18:31 +1000 (AEST) Authentication-Results: lists.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=linux.alibaba.com (client-ip=115.124.30.130; helo=out30-130.freemail.mail.aliyun.com; envelope-from=hsiangkao@linux.alibaba.com; receiver=) Received: from out30-130.freemail.mail.aliyun.com (out30-130.freemail.mail.aliyun.com [115.124.30.130]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 4GYL8d0pDkz3069 for ; Mon, 26 Jul 2021 23:18:22 +1000 (AEST) 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 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: X-BeenThere: linux-erofs@lists.ozlabs.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Development of Linux EROFS file system List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: "Darrick J . Wong" , Andreas Gruenbacher , LKML , Matthew Wilcox , linux-fsdevel , linux-erofs@lists.ozlabs.org, Christoph Hellwig Errors-To: linux-erofs-bounces+linux-erofs=archiver.kernel.org@lists.ozlabs.org Sender: "Linux-erofs" 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