Received: by 2002:a05:6500:2018:b0:1fb:9675:f89d with SMTP id t24csp675782lqh; Fri, 31 May 2024 12:51:04 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCUEUdeseCSCEuFVXM4yjXGI5LJ5AIR2dFCIP7d9MInpSvdvZl1eG+VvjapgYJaLodty3WxnVXiQrFQCVun/chYzhglrP3jTBzoYD0SbDg== X-Google-Smtp-Source: AGHT+IFfJdI/E7xmw+LYHR8qJzI5KR/PU+Y3yI0USydiK15U3PrnxIcoWPDL8/ngKoq47TZFtc6r X-Received: by 2002:a17:902:ce0b:b0:1f3:3116:bbba with SMTP id d9443c01a7336-1f6370c3cedmr41977005ad.63.1717185064716; Fri, 31 May 2024 12:51:04 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1717185064; cv=pass; d=google.com; s=arc-20160816; b=KoJxZci+G0Tew2GglptejzX+Ij731x9MJrpvHPgYPzUl09wWKj7nYc1gAZEBKzlFwB xw3WCSK2VBk8hbFA3CwMSF3AIQ0AXhCQhsbDjFyyIsCnWl4Z4mwv+zXxI31eNPLOiPuH YabyUIGt07W7jkcdJHMlyhUTVoBNoSVtc/JlPG+/WlCtcsv7rYv2TwxUXCRfgZXH3LFf v+R9ibYTDZYyaZ4BcHqC53u5+RJ4swLZhZGC+iuwNg0CDFUpKIeaF2GgUImIQMqLFMcx 4aUEfx3Q5K8T0uFh8S4qhwfkNcbV2xmGZYerPDM7+4JdpPRMF6/Kx+3pe+OBri7ew66/ JcIw== 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=ZnYJekxqs+YixkIAFqhWnZz9hWHwrTGHYqUHWnP5PR8=; fh=sPKrtYcvfYrx0SMCKkPItgREgastrob9cURc2UNAf8I=; b=XBperiXNTDB9ZLfXxtCiAc8qhJsNqR6FeFMXDSyhCd4J0zNiQ3mPcDDWDGRQs67ZZ7 ZApy0/9XDyAWsZCpjdI7wUHc7qpksQZGGz5K/wFBKzVX2J6tRe2iF6v28K/McziZXYoH OA4wDg21QxNL0Z9r40xPuCNNhMTRNJ2s8lkIQuX6eZi18E6dfV0BGnku71G2W6/kGduP /WOGUl9W+c5gbsKe2Pl0Y5pCpnkpTBgFdIJuG2LFGyeoYIAORVrrx+YCA0SzoZfgCrLU xp2Z7zZk4TDah/nYAA+2eGduWTbzFhHoyz9QSmUk6ZoY0zSQX+DgElA1AxRoubiaYwtu RNwA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@infradead.org header.s=bombadil.20210309 header.b=F9IakoLu; arc=pass (i=1 dkim=pass dkdomain=infradead.org); spf=pass (google.com: domain of linux-kernel+bounces-196885-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-196885-linux.lists.archive=gmail.com@vger.kernel.org" Return-Path: Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [2604:1380:40f1:3f00::1]) by mx.google.com with ESMTPS id d9443c01a7336-1f6323dec3csi20424005ad.308.2024.05.31.12.51.04 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 31 May 2024 12:51:04 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-196885-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) client-ip=2604:1380:40f1:3f00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@infradead.org header.s=bombadil.20210309 header.b=F9IakoLu; arc=pass (i=1 dkim=pass dkdomain=infradead.org); spf=pass (google.com: domain of linux-kernel+bounces-196885-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-196885-linux.lists.archive=gmail.com@vger.kernel.org" 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 702AEB220BB for ; Fri, 31 May 2024 13:31:52 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 9252A158DB2; Fri, 31 May 2024 13:31:41 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=infradead.org header.i=@infradead.org header.b="F9IakoLu" Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (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 9C22833CF1; Fri, 31 May 2024 13:31:39 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=198.137.202.133 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717162300; cv=none; b=h6zhatydowizK41bYsZQGN5i3wS376LFP0nVXvLNGNe/8yaZPZfrYLBWB8jAuQ5OSgjDRmbPalqoUDi7nlj5zKiSJyrx8CKv9jLYcUbia3YwAK/IoCXlapxUXb7AI0odOJhX1U01fKVKGHST8vZvI1dD4EMAlu+8KR5K+4efRpQ= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717162300; c=relaxed/simple; bh=TkIEk5wzeceT/BFmLNrFp8yBH9ZXT5OYIGMv9WzP9kU=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=htT2fdL2m4XnHW+g07gyl6M9obtODFgm6cieIhhXDQ8offiFYWs85g8C9m/w4WeOdtTD8axK0daSpALU93L+IJjIEeumCbLhKFVd5ApgTez21Yfysn36oG1Gt3X3v8XocymyZBk2l7umQvlZWttOcaL86Dn/DbWqDj2bZ9iDMIA= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=infradead.org; spf=none smtp.mailfrom=bombadil.srs.infradead.org; dkim=pass (2048-bit key) header.d=infradead.org header.i=@infradead.org header.b=F9IakoLu; arc=none smtp.client-ip=198.137.202.133 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=infradead.org Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=bombadil.srs.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20210309; h=In-Reply-To:Content-Type:MIME-Version :References:Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description; bh=ZnYJekxqs+YixkIAFqhWnZz9hWHwrTGHYqUHWnP5PR8=; b=F9IakoLuCEZorXEUpiAIFC9CTn OnQjknl1sgjgBHHW9/ahaYXquglI747gvuJWW/ZfHvmXSAWT0XrzsOvFK4Njs//5kxtCApNarBLxE 5JirlPwAXPmYC7ESlz8PPDMNu7s0zlAK1v39qGhGfrYsyCRwDCjsXW/q31u9K8uwOry5XDoQbsrvx fzdl5mnhnux0J53XUutmnMkDb4gmAPnVavJbhDFs3bKlj0KtndGxP3UBm7BaGXftbNtFH2ibwcVBS WLM9J32lo3mnyvt7VyoIzovD7V0Qk6zib3UV+SlOTW26wjhm6jN5KCCTwX4j2CVjfMhb8yuOaKtFw fDT19pUQ==; Received: from hch by bombadil.infradead.org with local (Exim 4.97.1 #2 (Red Hat Linux)) id 1sD2M4-0000000ALq6-1jvw; Fri, 31 May 2024 13:31:36 +0000 Date: Fri, 31 May 2024 06:31:36 -0700 From: Christoph Hellwig To: Zhang Yi Cc: linux-xfs@vger.kernel.org, linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org, djwong@kernel.org, hch@infradead.org, brauner@kernel.org, david@fromorbit.com, chandanbabu@kernel.org, jack@suse.cz, willy@infradead.org, yi.zhang@huawei.com, chengzhihao1@huawei.com, yukuai3@huawei.com Subject: Re: [RFC PATCH v4 5/8] xfs: refactor the truncating order Message-ID: References: <20240529095206.2568162-1-yi.zhang@huaweicloud.com> <20240529095206.2568162-6-yi.zhang@huaweicloud.com> Precedence: bulk X-Mailing-List: linux-kernel@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: <20240529095206.2568162-6-yi.zhang@huaweicloud.com> X-SRS-Rewrite: SMTP reverse-path rewritten from by bombadil.infradead.org. See http://www.infradead.org/rpr.html > + write_back = newsize > ip->i_disk_size && oldsize != ip->i_disk_size; Maybe need_writeback would be a better name for the variable? Also no need to initialize it to false at declaration time if it is unconditionally set here. > + /* > + * Updating i_size after writing back to make sure the zeroed > + * blocks could been written out, and drop all the page cache > + * range that beyond blocksize aligned new EOF block. > + * > + * We've already locked out new page faults, so now we can > + * safely remove pages from the page cache knowing they won't > + * get refaulted until we drop the XFS_MMAP_EXCL lock after the > + * extent manipulations are complete. > + */ > + i_size_write(inode, newsize); > + truncate_pagecache(inode, roundup_64(newsize, blocksize)); Any reason this open codes truncate_setsize()?