Received: by 2002:a05:6a10:1287:0:0:0:0 with SMTP id d7csp3599756pxv; Mon, 19 Jul 2021 04:26:05 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzhyyZ5fNegcxMe+M3rKAEii8x37rzqmaCP+BLg2HGv4GcjIuXZVK+WPRX1J/Ib4Z16EAQV X-Received: by 2002:a17:907:170c:: with SMTP id le12mr27622440ejc.288.1626693964959; Mon, 19 Jul 2021 04:26:04 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1626693964; cv=none; d=google.com; s=arc-20160816; b=EQh/Oq7Fmw4lutwxH4aSjP3md+5bJubXTxw9UvwCW13PeqwJW/mkn07ry8m3r4BdtX jMdJe2Llmurz7cKrsY6vrhd27sVWXEhT4Pv7/qO8EoYShsaYwJ5yjZWWycfeBfeuefSF rYUb9akNl+hSMugNekEo6q3HDHAOqEJgkAsixlGMetdztC2Lh/gk5Fz1gUrZ0WXg7Odw 5bvM4vhjHMteEqYdjsV8DmMuAZyDP1lndOwsGjZ10ieb9PeTgBhAiAaAW6WgFxL+40wf Mn0Psu52+UGO8KCNFzukdyYU7+GufLfdEXElcQAz0/wY5hJ205E9sG14aRblGlM6TPc4 oHDQ== 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:message-id:subject:to:from:date:dkim-signature; bh=XRraZAxjHWHOmKDHLSEsZ8UjvPxlwYc6y4fq7IIgfIQ=; b=FB3Y1dHNGCKe2Cg1zcDxNIzfEHA0UU/TTPcKC9e2Psx25tBz2dR8yOLOPduiLWbiyw uKhgA2L/pR3GmJZx/oKci/2apwMb4F1M/fw2pBPcR6Hr+sBkSeRkciWza9oHFiv5eMpJ ksGH2jR7vMGcT8+LE/q0bYssX0pGt88HnyMEbaCFuz0DPqxtO/MbHFKVV8wr55Q8KYx6 EvPqK/woFwYU6KJevJhLnbLmZeUtxwOjd/gZyZ3Rke2kGJ2HYgYFlLTjqQaANwa+Kza2 dEUMAVyPz9njQ+ewxPqDpEvxF5Ql9P6YeyLNDgnyr9jMU5eB8+2700fwXAwO4IKP4AOh C8qg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@infradead.org header.s=casper.20170209 header.b=h1qdBi0F; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id cn9si20370107edb.505.2021.07.19.04.25.42; Mon, 19 Jul 2021 04:26:04 -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; dkim=pass header.i=@infradead.org header.s=casper.20170209 header.b=h1qdBi0F; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236427AbhGSKli (ORCPT + 99 others); Mon, 19 Jul 2021 06:41:38 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34306 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236590AbhGSKkd (ORCPT ); Mon, 19 Jul 2021 06:40:33 -0400 Received: from casper.infradead.org (casper.infradead.org [IPv6:2001:8b0:10b:1236::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 78133C061574; Mon, 19 Jul 2021 03:30:48 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=In-Reply-To:Content-Type:MIME-Version: References:Message-ID:Subject:To:From:Date:Sender:Reply-To:Cc: Content-Transfer-Encoding:Content-ID:Content-Description; bh=XRraZAxjHWHOmKDHLSEsZ8UjvPxlwYc6y4fq7IIgfIQ=; b=h1qdBi0FWIlit/z9Kr+XrqBsI2 8zGpF3RiZW81r65EUD8AOdCS5gMjNpuAwM5GfsuJnGIBIdlO6ajbmKyu0YlZhjoGpxIWvovLGulb0 +ngRKmWAGi5Q4LL5rkDiAgHGqvtNsCI+o4aUgF7Lom+mJNC5Uco8q6X0cyT9KBR+/lLHZbg0/B1D2 ZlxsXcHG+QEqLhO/LnIVys+tZHfQWPJDZJO4stCWDkyvftKpCdBWHr4dvnn6kdep4sZfZxcpiMbpU 7G80OcHXKGajF53erZ23RAJfv2Dcmm66BZxo/dlPrZCBNvnj+tORfSn7/vRYFcGMO+C70MH7S3AqU SLckoFZw==; Received: from hch by casper.infradead.org with local (Exim 4.94.2 #2 (Red Hat Linux)) id 1m5RFT-006nL5-Qf; Mon, 19 Jul 2021 11:15:56 +0000 Date: Mon, 19 Jul 2021 12:15:47 +0100 From: Christoph Hellwig To: Andreas Gr??nbacher , Christoph Hellwig , Matthew Wilcox , linux-erofs@lists.ozlabs.org, Linux FS-devel Mailing List , LKML , "Darrick J. Wong" , Chao Yu , Liu Bo , Joseph Qi , Liu Jiang Subject: Re: [PATCH 1/2] iomap: support tail packing inline read Message-ID: References: <20210716050724.225041-1-hsiangkao@linux.alibaba.com> <20210716050724.225041-2-hsiangkao@linux.alibaba.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-SRS-Rewrite: SMTP reverse-path rewritten from by casper.infradead.org. See http://www.infradead.org/rpr.html Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sat, Jul 17, 2021 at 09:38:18PM +0800, Gao Xiang wrote: > >From 62f367245492e389711bcebbf7da5adae586299f Mon Sep 17 00:00:00 2001 > From: Christoph Hellwig > Date: Fri, 16 Jul 2021 10:52:48 +0200 > Subject: [PATCH] iomap: support tail packing inline read I'd still credit this to you as you did all the hard work. > + /* 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 */ > + if (size > PAGE_SIZE - poff) > + size = PAGE_SIZE - poff; This should probably use min or min_t. > > 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); > + flush_dcache_page(page); The flush_dcache_page addition should be a separate patch. > > if (dio->flags & IOMAP_DIO_WRITE) { > loff_t size = inode->i_size; > @@ -394,7 +395,8 @@ iomap_dio_inline_actor(struct inode *inode, loff_t pos, loff_t length, > mark_inode_dirty(inode); > } > } else { > - copied = copy_to_iter(iomap->inline_data + pos, length, iter); > + copied = copy_to_iter(iomap->inline_data + pos - iomap->offset, > + length, iter); We also need to take the offset into account for the write side. I guess it would be nice to have a local variable for the inline address to not duplicate that calculation multiple times.