Received: by 2002:a05:6a10:1287:0:0:0:0 with SMTP id d7csp3689531pxv; Mon, 19 Jul 2021 06:32:42 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxln5vmg2pRJ8eRwYL4+Xn30tdd1EpVCLRQGqvJTszhf+DmcUIDIgUqV5NmnFDkgSEizfOz X-Received: by 2002:a05:6402:1057:: with SMTP id e23mr34942216edu.352.1626701562739; Mon, 19 Jul 2021 06:32:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1626701562; cv=none; d=google.com; s=arc-20160816; b=el4Hr88dHVNyYFlNyWC0H5hCXRKnOtD12516oKCMhEW/0hhdnLKBTkgvfBfNWv3V7Y 4B4FPYQro53WQVWm/1nhDUfuG8LSIuGpNu3M5+hUNA/3sdG1oXIDABwWD/1xo381GJRR 5DIPVTjoS+Ur/bDKFY1RAjatdE7vSzMGy3ZTcFAP578VDmIgxjnCJBuudJlosokRZUHK RUNA0KgxsJL48Bx+qKHNCe11Rt9TY7QT41C82N3HKUWCPxsUC3WHCCzHcwg7GOKTwF1v vtq8AenR85X7hbk9EyqEhhxAgohRmkmAsbIi/5IG0qLRH22GM4OYcgI6mnWXy2gYVoiJ QmSg== 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=oPS7lsYA2cL1korH/NHdZQjOFoblFH6oooP2W759XzU=; b=NCzyMynUzOG02aboKpF8Z5ani3WK262OHvzI63Jit8Lhy9JfI7MBqyN12RUwzwwXLQ h/ondvKsKlc+Yhxdtcsb7SYet0qKNoe2cikrW+vRikaN+3EGTkK95SfuUCpx9bVvNKrD Y5EgQv9oT6ViCGMiXZbpJIUZ8lqPpKhZcLAWyiF7wiOmt/x9oClDh98OZoI1mRh8KT6b rVFLRQnFTt6YSMrn5dHT3/weBtPm+dsHOLziMM5fPiUOcdZLNsGZpFFfjNSdwjwgbiNs HIB8uimG38HGEtuPBv4ZphqSHX3+iFYJ5y/0k/o3FrVFahmgG3iKtqUFrAqc2NtecHxN anPw== 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 mp5si14370986ejc.473.2021.07.19.06.32.19; Mon, 19 Jul 2021 06:32:42 -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 S238347AbhGSMun (ORCPT + 99 others); Mon, 19 Jul 2021 08:50:43 -0400 Received: from out30-130.freemail.mail.aliyun.com ([115.124.30.130]:58608 "EHLO out30-130.freemail.mail.aliyun.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237861AbhGSMum (ORCPT ); Mon, 19 Jul 2021 08:50:42 -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=e01e01424;MF=hsiangkao@linux.alibaba.com;NM=1;PH=DS;RN=11;SR=0;TI=SMTPD_---0UgGlGc3_1626701476; Received: from B-P7TQMD6M-0146.local(mailfrom:hsiangkao@linux.alibaba.com fp:SMTPD_---0UgGlGc3_1626701476) by smtp.aliyun-inc.com(127.0.0.1); Mon, 19 Jul 2021 21:31:17 +0800 Date: Mon, 19 Jul 2021 21:31:15 +0800 From: Gao Xiang To: Christoph Hellwig Cc: Andreas Gr??nbacher , 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: Mail-Followup-To: Christoph Hellwig , Andreas Gr??nbacher , Matthew Wilcox , linux-erofs@lists.ozlabs.org, Linux FS-devel Mailing List , LKML , "Darrick J. Wong" , Chao Yu , Liu Bo , Joseph Qi , Liu Jiang References: <20210716050724.225041-1-hsiangkao@linux.alibaba.com> <20210716050724.225041-2-hsiangkao@linux.alibaba.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 19, 2021 at 12:15:47PM +0100, Christoph Hellwig wrote: > 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. Ok. > > > + /* 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. Okay, will update. > > > > > 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. I wondered what is the target order of recent iomap patches, since this is a quite small change, so I'd like to just rebase on for-next for now . So ok, I won't touch this in this patchset and I think flush_dcache_page() does no harm to x86(_64) and arm(64) at least if I remember correctly. > > > > > 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. ok. Will update. Thanks, Gao Xiang