Received: by 2002:a05:7412:bbc7:b0:fc:a2b0:25d7 with SMTP id kh7csp1529699rdb; Sat, 3 Feb 2024 09:57:45 -0800 (PST) X-Google-Smtp-Source: AGHT+IES9n0pz5x5ihVsOwpGweGm32zXDMKjniRS6s7FMyP4sW6R2EoC0z8zA6xVjmAiTHJqrraR X-Received: by 2002:a05:6a20:a123:b0:19e:7744:1ab1 with SMTP id q35-20020a056a20a12300b0019e77441ab1mr77589pzk.31.1706983065062; Sat, 03 Feb 2024 09:57:45 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1706983065; cv=pass; d=google.com; s=arc-20160816; b=CRC+WqWm6akP/67ID2JChWAzDsHvt9aaO0Ol1mYrd/xpx5aYBjQT5P6Sr600nl6gUF FYykvct5WyPpovom13OYlFlsKFmN6zME8TuCHiq7t7Er7a6wzZ2pOEkVhqSqN/iUmYzk b3K5HZtRGpEzYZo0rkYqIDLGoXBb2MH+El3mTkOfFy6xsV49tgqwg/7eAcmQCIX0OWV6 GPxkVdhNiqJsZdmCPbVzgjLwyd/HyHnLwrjpcgdHV06lda9c/iBpfmbjCv7V6Pm3liUC 5bnA/MMSxI7NM8pdHr9pPI27wlD6s5gIRzTpYqHZZu6GHiZHSv1B0b6u/VFDBpNqydRW GYJg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=in-reply-to:content-disposition:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:message-id:subject:cc :to:from:date:dkim-signature; bh=l4Qu1q6RKuEeOxA7OnxAR5gXRKkLwV3d96mBPvSYLxs=; fh=lGhyty3AI9AeBsfSZIwjh9HK+SElglRB4ndJFUYEGTg=; b=oqzbQy1+c82Nn0maWmGpUElZT4mud4S2gPgDFcm1OJ/SD7SraX9DuRLn2JdXTHk1cN b+cNV7iPMQld7jFxRI5qSezCN4JvadfV4P5Jqc2ZqUff5+dxkPPlEEI4xEMzhwV//iqV 7+o8SOwTbCffbGAoqbt+2eFDHsItAzGUrSszuJxw2dYmt3bCn+ZMn/FLy1RcU/rLZW1R Qi5jFCvMHSroJk4L2czoz42Kb75uCd9YaCxaMB3cWccg/qbjININ/nb/YmYUG7CycmSX GvMXdXjgvcz1+B8fGnpbkRfSLZAMRhkyMHiaUYAP/iPyh/OYU7kQ1MoDBQq5DRlzWrXL GR9Q==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@mit.edu header.s=outgoing header.b="KCVs/tCY"; arc=pass (i=1 spf=pass spfdomain=mit.edu dkim=pass dkdomain=mit.edu dmarc=pass fromdomain=mit.edu); spf=pass (google.com: domain of linux-ext4+bounces-1073-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-ext4+bounces-1073-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=mit.edu X-Forwarded-Encrypted: i=1; AJvYcCVCSsCtt0lHEQMfnwVKQX27E9RoGKyPEUpPKV0j0sDvzmizaynqyIEURl5AtkPUAbKZezSE+rrsfTVGLKNC+7VAnFNyTKuNMlgBVowK/Q== Return-Path: Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [147.75.48.161]) by mx.google.com with ESMTPS id 79-20020a630252000000b005d8c22846d1si3547130pgc.173.2024.02.03.09.57.44 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 03 Feb 2024 09:57:45 -0800 (PST) Received-SPF: pass (google.com: domain of linux-ext4+bounces-1073-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) client-ip=147.75.48.161; Authentication-Results: mx.google.com; dkim=pass header.i=@mit.edu header.s=outgoing header.b="KCVs/tCY"; arc=pass (i=1 spf=pass spfdomain=mit.edu dkim=pass dkdomain=mit.edu dmarc=pass fromdomain=mit.edu); spf=pass (google.com: domain of linux-ext4+bounces-1073-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-ext4+bounces-1073-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=mit.edu Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sy.mirrors.kernel.org (Postfix) with ESMTPS id 9E1A3B2386A for ; Sat, 3 Feb 2024 17:57:40 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 1DF515FBB8; Sat, 3 Feb 2024 17:57:28 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=mit.edu header.i=@mit.edu header.b="KCVs/tCY" X-Original-To: linux-ext4@vger.kernel.org Received: from outgoing.mit.edu (outgoing-auth-1.mit.edu [18.9.28.11]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 1CBC45FB99 for ; Sat, 3 Feb 2024 17:57:25 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=18.9.28.11 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706983047; cv=none; b=V4Doix9X/xb2s6JrimX+YZZTYcSVUIw3bgUqLfVysuZo5bxcWwMehXDOar/Y3Ak1IXiWjNWwIU2sPkXZZmxgf8fYz0trzLI3EpguoOXav/Z/4p/1dopxBZlnwl/stksH1jX73fHec9DPPViEsP48Y80IsaDUmGQXQrVZVjYuwew= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706983047; c=relaxed/simple; bh=Yj5aDDXTM+qpJNjCB3RU5HxCJC5EPb3NxOhYz32dNII=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=dNJTTgQ4t0g2ZfTQoUweXMk+F+LB4peDbXcvHbTITT5VYeFY0paWRdHA1Zds7PHuIac/eSQ0D7SJCAdkfks+s18i/GfPx5PNxftrzdwPAl2c2vTcGNDSOpVmb3ePM2fNsR6KzcxLLW0e5Z5qOy7RNCvXpp8xk8TWTSz7msyxW9o= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=mit.edu; spf=pass smtp.mailfrom=mit.edu; dkim=pass (2048-bit key) header.d=mit.edu header.i=@mit.edu header.b=KCVs/tCY; arc=none smtp.client-ip=18.9.28.11 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=mit.edu Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=mit.edu Received: from cwcc.thunk.org (pool-173-48-82-236.bstnma.fios.verizon.net [173.48.82.236]) (authenticated bits=0) (User authenticated as tytso@ATHENA.MIT.EDU) by outgoing.mit.edu (8.14.7/8.12.4) with ESMTP id 413HueK6016816 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Sat, 3 Feb 2024 12:56:41 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=mit.edu; s=outgoing; t=1706983003; bh=l4Qu1q6RKuEeOxA7OnxAR5gXRKkLwV3d96mBPvSYLxs=; h=Date:From:Subject:Message-ID:MIME-Version:Content-Type; b=KCVs/tCYcG6FASwSKeCTJN/GaIweqiatqM26tedyHRNWr5Nm9ZsMPGptGJVxCHr6y 7nDV5tQBtR44r1e3VUwyHuQB6DYTXp5Qn49NpINbg2AJLeNdzz6G7+woFfRsZs+Gjq GDWmNAko6C4hatS0ECCdVPOXhrl8ajdZ+RChykF3ccqMZiO2/wCkYGwM5Mu39KkSaT CIuZmq2cWaoZ+wBMBv/xW3dOMH5YppG14JbOeOqJLRAFVYPmvCLLxBm9z3y4eWn7Rm DBepFE7ZnAUR6Vn4c3mIOYTlsudCwhT5Bz/EaF0WRUUT5gPjzbiKoHi4GqPRlCUleO XBiUTtmml9rvw== Received: by cwcc.thunk.org (Postfix, from userid 15806) id 0349C15C02FC; Sat, 3 Feb 2024 12:56:40 -0500 (EST) Date: Sat, 3 Feb 2024 12:56:39 -0500 From: "Theodore Ts'o" To: Zhang Yi Cc: linux-ext4@vger.kernel.org, linux-fsdevel@vger.kernel.org, linux-mm@kvack.org, linux-kernel@vger.kernel.org, adilger.kernel@dilger.ca, jack@suse.cz, ritesh.list@gmail.com, hch@infradead.org, djwong@kernel.org, willy@infradead.org, zokeefe@google.com, yi.zhang@huawei.com, chengzhihao1@huawei.com, yukuai3@huawei.com, wangkefeng.wang@huawei.com Subject: Re: [PATCH v3 03/26] ext4: correct the hole length returned by ext4_map_blocks() Message-ID: <20240203175639.GF36616@mit.edu> References: <20240127015825.1608160-1-yi.zhang@huaweicloud.com> <20240127015825.1608160-4-yi.zhang@huaweicloud.com> Precedence: bulk X-Mailing-List: linux-ext4@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20240127015825.1608160-4-yi.zhang@huaweicloud.com> On Sat, Jan 27, 2024 at 09:58:02AM +0800, Zhang Yi wrote: > From: Zhang Yi > > In ext4_map_blocks(), if we can't find a range of mapping in the > extents cache, we are calling ext4_ext_map_blocks() to search the real > path and ext4_ext_determine_hole() to determine the hole range. But if > the querying range was partially or completely overlaped by a delalloc > extent, we can't find it in the real extent path, so the returned hole > length could be incorrect. > > Fortunately, ext4_ext_put_gap_in_cache() have already handle delalloc > extent, but it searches start from the expanded hole_start, doesn't > start from the querying range, so the delalloc extent found could not be > the one that overlaped the querying range, plus, it also didn't adjust > the hole length. Let's just remove ext4_ext_put_gap_in_cache(), handle > delalloc and insert adjusted hole extent in ext4_ext_determine_hole(). > > Signed-off-by: Zhang Yi > Suggested-by: Jan Kara > Reviewed-by: Jan Kara Thanks, applied. - Ted