Received: by 2002:a05:6a10:1287:0:0:0:0 with SMTP id d7csp4506574pxv; Tue, 20 Jul 2021 05:29:07 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzP117gxz2FGk0vce2Di1YzsOkXuyRj4d0BBBepgAR5Ae5n0/hBPBa1ueTzxyLsSvFytvHk X-Received: by 2002:a6b:7b44:: with SMTP id m4mr22475373iop.72.1626784147535; Tue, 20 Jul 2021 05:29:07 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1626784147; cv=none; d=google.com; s=arc-20160816; b=XSTo763GZtVRhzXF3/t3AxnHPm/j2KZCI/ZImOXnljgD3pC3X0FMCGMylfaZ2w7lks +x7ahKuMzfMF9XOk0Y+ZRFas653kDWS+inFc7SSy1q/xOuCLF9HEEoS5k6ruCynngLMw LNNeT+EgLjoU5aI73srddxhY3Koc6eqay9+4aV1Vhlfu/Tm6xpSHBAewDcHkKq01GK3+ 8w3S34cTW8OZXLJxC/ee9M64hQ5c43luNFE/zeAgqUCHfHQkYXOs4Ki+k74bBk5WLVza BhW10yr2ducRTDTaGo6MJi7RvxvexI1p6foY21jYobHI6+dUEm/L4WKsHhax4AAPSImM G/Bw== 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-transfer-encoding :content-disposition:mime-version:references:mail-followup-to :message-id:subject:cc:to:from:date; bh=ZqOKXbB7chv8fXSZYnSCwgnMiWpk/e5n/Nh7N9XWO80=; b=NIiB1p1JCK7wMQLgsKq/SEgsBn4H7FIXMRlzJfh2mrU9QGmiUp6sm9R8wl5TfiJma1 5NwTmS6c598vCX6VjscwKO0eXCLENv/bVtu0wHzM1GLzVk8WFgaH0u4uGz3HJG8hYM0M XS07DdAkBj5QYt6WXqOXbisGGRbQgnzrd8c0Y1pKWVW0Nqm8cGKEQYtQhSHDkiPNSihR /oEgyjHq+K/ego8W5TYmXnCZOHG4Q6mb0ob6eNKxDs0r64vLfzhIlCNkYua70KyI/qFS pPgU+a20B+FTTSfyNKeaTOjW3x9Kz5Ml9x9kF4Wti0tqqNruzsH5/pCnQPSuVW0IXNda 4Pjw== 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 t15si22104558ilg.47.2021.07.20.05.28.55; Tue, 20 Jul 2021 05:29:07 -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 S237927AbhGTLoK (ORCPT + 99 others); Tue, 20 Jul 2021 07:44:10 -0400 Received: from out30-54.freemail.mail.aliyun.com ([115.124.30.54]:43779 "EHLO out30-54.freemail.mail.aliyun.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237691AbhGTLnZ (ORCPT ); Tue, 20 Jul 2021 07:43:25 -0400 X-Alimail-AntiSpam: AC=PASS;BC=-1|-1;BR=01201311R141e4;CH=green;DM=||false|;DS=||;FP=0|-1|-1|-1|0|-1|-1|-1;HT=e01e04400;MF=hsiangkao@linux.alibaba.com;NM=1;PH=DS;RN=7;SR=0;TI=SMTPD_---0UgQyUIj_1626783838; Received: from B-P7TQMD6M-0146.local(mailfrom:hsiangkao@linux.alibaba.com fp:SMTPD_---0UgQyUIj_1626783838) by smtp.aliyun-inc.com(127.0.0.1); Tue, 20 Jul 2021 20:23:59 +0800 Date: Tue, 20 Jul 2021 20:23:57 +0800 From: Gao Xiang To: Andreas =?utf-8?Q?Gr=C3=BCnbacher?= Cc: linux-erofs@lists.ozlabs.org, Linux FS-devel Mailing List , LKML , Christoph Hellwig , "Darrick J . Wong" , Matthew Wilcox Subject: Re: [PATCH v3] iomap: support tail packing inline read Message-ID: Mail-Followup-To: Andreas =?utf-8?Q?Gr=C3=BCnbacher?= , linux-erofs@lists.ozlabs.org, Linux FS-devel Mailing List , LKML , Christoph Hellwig , "Darrick J . Wong" , Matthew Wilcox References: <20210719144747.189634-1-hsiangkao@linux.alibaba.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Jul 20, 2021 at 01:34:58PM +0200, Andreas Grünbacher wrote: > Am Mo., 19. Juli 2021 um 16:48 Uhr schrieb Gao Xiang > : > > This tries to add tail packing inline read to iomap, which can support > > several inline tail blocks. Similar to the previous approach, it cleans > > post-EOF in one iteration. > > > > The write path remains untouched since EROFS cannot be used for testing. > > It'd be better to be implemented if upcoming real users care rather than > > leave untested dead code around. > > > > Cc: Christoph Hellwig > > Cc: Darrick J. Wong > > Cc: Matthew Wilcox > > Cc: Andreas Gruenbacher > > Signed-off-by: Gao Xiang > > --- > > v2: https://lore.kernel.org/r/YPLdSja%2F4FBsjss%2F@B-P7TQMD6M-0146.local/ > > changes since v2: > > - update suggestion from Christoph: > > https://lore.kernel.org/r/YPVe41YqpfGLNsBS@infradead.org/ > > > > Hi Andreas, > > would you mind test on the gfs2 side? Thanks in advance! > > > > Thanks, > > Gao Xiang > > > > fs/iomap/buffered-io.c | 50 ++++++++++++++++++++++++++---------------- > > fs/iomap/direct-io.c | 11 ++++++---- > > 2 files changed, 38 insertions(+), 23 deletions(-) > > > > diff --git a/fs/iomap/buffered-io.c b/fs/iomap/buffered-io.c > > index 87ccb3438bec..cac8a88660d8 100644 > > --- a/fs/iomap/buffered-io.c > > +++ b/fs/iomap/buffered-io.c > > @@ -207,23 +207,22 @@ struct iomap_readpage_ctx { > > > > static void > > iomap_read_inline_data(struct inode *inode, struct page *page, > > - struct iomap *iomap) > > + struct iomap *iomap, loff_t pos) > > { > > - size_t size = i_size_read(inode); > > + unsigned int size, poff = offset_in_page(pos); > > void *addr; > > > > - if (PageUptodate(page)) > > - return; > > - > > - BUG_ON(page_has_private(page)); > > - BUG_ON(page->index); > > - BUG_ON(size > PAGE_SIZE - offset_in_page(iomap->inline_data)); > > + /* inline source data must be inside a single page */ > > + BUG_ON(iomap->length > PAGE_SIZE - offset_in_page(iomap->inline_data)); > > + /* handle tail-packing blocks cross the current page into the next */ > > + size = min_t(unsigned int, iomap->length + pos - iomap->offset, > > + PAGE_SIZE - poff); > > > > addr = kmap_atomic(page); > > - memcpy(addr, iomap->inline_data, size); > > - memset(addr + size, 0, PAGE_SIZE - size); > > + memcpy(addr + poff, iomap->inline_data - iomap->offset + pos, size); > > + memset(addr + poff + size, 0, PAGE_SIZE - poff - size); > > kunmap_atomic(addr); > > - SetPageUptodate(page); > > + iomap_set_range_uptodate(page, poff, PAGE_SIZE - poff); > > } > > > > static inline bool iomap_block_needs_zeroing(struct inode *inode, > > @@ -246,18 +245,19 @@ iomap_readpage_actor(struct inode *inode, loff_t pos, loff_t length, void *data, > > unsigned poff, plen; > > sector_t sector; > > > > - if (iomap->type == IOMAP_INLINE) { > > - WARN_ON_ONCE(pos); > > - iomap_read_inline_data(inode, page, iomap); > > - return PAGE_SIZE; > > - } > > - > > - /* zero post-eof blocks as the page may be mapped */ > > iop = iomap_page_create(inode, page); > > We can skip creating the iop when reading the entire page. As I said before, I think it can be in a separated patch like https://lore.kernel.org/r/YPMkKfegS+9KzEhK@casper.infradead.org/ and Christoph said it should be careful: https://lore.kernel.org/r/YPVfxn6%2FoCPBZpKu@infradead.org/ Thanks, Gao Xiang