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=-3.8 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS, UNPARSEABLE_RELAY autolearn=no 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 839A1C12002 for ; Fri, 16 Jul 2021 13:56:33 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 657DB613F5 for ; Fri, 16 Jul 2021 13:56:33 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240257AbhGPN7Z (ORCPT ); Fri, 16 Jul 2021 09:59:25 -0400 Received: from out30-42.freemail.mail.aliyun.com ([115.124.30.42]:36583 "EHLO out30-42.freemail.mail.aliyun.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232895AbhGPN7Y (ORCPT ); Fri, 16 Jul 2021 09:59:24 -0400 X-Alimail-AntiSpam: AC=PASS;BC=-1|-1;BR=01201311R171e4;CH=green;DM=||false|;DS=||;FP=0|-1|-1|-1|0|-1|-1|-1;HT=e01e04426;MF=hsiangkao@linux.alibaba.com;NM=1;PH=DS;RN=10;SR=0;TI=SMTPD_---0UfzOB3Y_1626443784; Received: from B-P7TQMD6M-0146.local(mailfrom:hsiangkao@linux.alibaba.com fp:SMTPD_---0UfzOB3Y_1626443784) by smtp.aliyun-inc.com(127.0.0.1); Fri, 16 Jul 2021 21:56:25 +0800 Date: Fri, 16 Jul 2021 21:56:23 +0800 From: Gao Xiang To: Matthew Wilcox Cc: linux-erofs@lists.ozlabs.org, linux-fsdevel@vger.kernel.org, LKML , "Darrick J. Wong" , Christoph Hellwig , Chao Yu , Liu Bo , Joseph Qi , Liu Jiang Subject: Re: [PATCH 1/2] iomap: support tail packing inline read Message-ID: Mail-Followup-To: Matthew Wilcox , linux-erofs@lists.ozlabs.org, linux-fsdevel@vger.kernel.org, LKML , "Darrick J. Wong" , Christoph Hellwig , 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 Hi Matthew, On Fri, Jul 16, 2021 at 02:02:29PM +0100, Matthew Wilcox wrote: > On Fri, Jul 16, 2021 at 01:07:23PM +0800, Gao Xiang wrote: > > This tries to add tail packing inline read to iomap. Different from > > the previous approach, it only marks the block range uptodate in the > > page it covers. > > Why? This path is called under two circumstances: readahead and readpage. > In both cases, we're trying to bring the entire page uptodate. The inline > extent is always the tail of the file, so we may as well zero the part of > the page past the end of file and mark the entire page uptodate instead > and leaving the end of the page !uptodate. > > I see the case where, eg, we have the first 2048 bytes of the file > out-of-inode and then 20 bytes in the inode. So we'll create the iop > for the head of the file, but then we may as well finish the entire > PAGE_SIZE chunk as part of this iteration rather than update 2048-3071 > as being uptodate and leave the 3072-4095 block for a future iteration. Thanks for your comments. Hmm... If I understand the words above correctly, what I'd like to do is to cover the inline extents (blocks) only reported by iomap_begin() rather than handling other (maybe) logical-not-strictly-relevant areas such as post-EOF (even pages will be finally entirely uptodated), I think such zeroed area should be handled by from the point of view of the extent itself if (iomap_block_needs_zeroing(inode, iomap, pos)) { zero_user(page, poff, plen); iomap_set_range_uptodate(page, poff, plen); goto done; } The benefits I can think out are 1) it makes the logic understand easier and no special cases just for tail-packing handling 2) it can be then used for any inline extent cases (I mean e.g. in the middle of the file) rather than just tail-packing inline blocks although currently there is a BUG_ON to prevent this but it's easier to extend even further. 3) it can be used as a part for later partial page uptodate logic in order to match the legacy buffer_head logic (I remember something if my memory is not broken about this...) 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=-3.8 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS, UNPARSEABLE_RELAY autolearn=no 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 07549C12002 for ; Fri, 16 Jul 2021 13:56:54 +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 16EBB613F5 for ; Fri, 16 Jul 2021 13:56:53 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 16EBB613F5 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=linux-erofs-bounces+linux-erofs=archiver.kernel.org@lists.ozlabs.org Received: from boromir.ozlabs.org (localhost [IPv6:::1]) by lists.ozlabs.org (Postfix) with ESMTP id 4GRCTb5W1vz303q for ; Fri, 16 Jul 2021 23:56:51 +1000 (AEST) Authentication-Results: lists.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=linux.alibaba.com (client-ip=115.124.30.57; helo=out30-57.freemail.mail.aliyun.com; envelope-from=hsiangkao@linux.alibaba.com; receiver=) Received: from out30-57.freemail.mail.aliyun.com (out30-57.freemail.mail.aliyun.com [115.124.30.57]) (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 4GRCTW0Smgz2yNT for ; Fri, 16 Jul 2021 23:56:45 +1000 (AEST) X-Alimail-AntiSpam: AC=PASS; BC=-1|-1; BR=01201311R171e4; CH=green; DM=||false|; DS=||; FP=0|-1|-1|-1|0|-1|-1|-1; HT=e01e04426; MF=hsiangkao@linux.alibaba.com; NM=1; PH=DS; RN=10; SR=0; TI=SMTPD_---0UfzOB3Y_1626443784; Received: from B-P7TQMD6M-0146.local(mailfrom:hsiangkao@linux.alibaba.com fp:SMTPD_---0UfzOB3Y_1626443784) by smtp.aliyun-inc.com(127.0.0.1); Fri, 16 Jul 2021 21:56:25 +0800 Date: Fri, 16 Jul 2021 21:56:23 +0800 From: Gao Xiang To: Matthew Wilcox Subject: Re: [PATCH 1/2] iomap: support tail packing inline read Message-ID: Mail-Followup-To: Matthew Wilcox , linux-erofs@lists.ozlabs.org, linux-fsdevel@vger.kernel.org, LKML , "Darrick J. Wong" , Christoph Hellwig , 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: 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" , LKML , Christoph Hellwig , Joseph Qi , Liu Bo , linux-fsdevel@vger.kernel.org, Liu Jiang , linux-erofs@lists.ozlabs.org Errors-To: linux-erofs-bounces+linux-erofs=archiver.kernel.org@lists.ozlabs.org Sender: "Linux-erofs" Hi Matthew, On Fri, Jul 16, 2021 at 02:02:29PM +0100, Matthew Wilcox wrote: > On Fri, Jul 16, 2021 at 01:07:23PM +0800, Gao Xiang wrote: > > This tries to add tail packing inline read to iomap. Different from > > the previous approach, it only marks the block range uptodate in the > > page it covers. > > Why? This path is called under two circumstances: readahead and readpage. > In both cases, we're trying to bring the entire page uptodate. The inline > extent is always the tail of the file, so we may as well zero the part of > the page past the end of file and mark the entire page uptodate instead > and leaving the end of the page !uptodate. > > I see the case where, eg, we have the first 2048 bytes of the file > out-of-inode and then 20 bytes in the inode. So we'll create the iop > for the head of the file, but then we may as well finish the entire > PAGE_SIZE chunk as part of this iteration rather than update 2048-3071 > as being uptodate and leave the 3072-4095 block for a future iteration. Thanks for your comments. Hmm... If I understand the words above correctly, what I'd like to do is to cover the inline extents (blocks) only reported by iomap_begin() rather than handling other (maybe) logical-not-strictly-relevant areas such as post-EOF (even pages will be finally entirely uptodated), I think such zeroed area should be handled by from the point of view of the extent itself if (iomap_block_needs_zeroing(inode, iomap, pos)) { zero_user(page, poff, plen); iomap_set_range_uptodate(page, poff, plen); goto done; } The benefits I can think out are 1) it makes the logic understand easier and no special cases just for tail-packing handling 2) it can be then used for any inline extent cases (I mean e.g. in the middle of the file) rather than just tail-packing inline blocks although currently there is a BUG_ON to prevent this but it's easier to extend even further. 3) it can be used as a part for later partial page uptodate logic in order to match the legacy buffer_head logic (I remember something if my memory is not broken about this...) Thanks, Gao Xiang