From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (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 60EA16FB4 for ; Mon, 19 Dec 2022 19:27:54 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id C9239C433EF; Mon, 19 Dec 2022 19:27:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1671478074; bh=T6ogtEA/k+38oJHMiRWvj7T+7+jE5E9D0h7SCn0qiRo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=tgUYgwFB/fnxWS0gxkEn4aPeXLprJIrrrQQ0+mYfM+aXYfrgHBA3QEmloIjDlzA0S rK19DaCii3/zBQsdH+o0XZ2pZl27NJZNLNgmn4KLAeDf4TKyA2/ie1ayen8jCsi9jJ ahKjA2XSjKePF2t4fxF4zLF82bY5AKxTSbHF4qks= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Jan Kara Subject: [PATCH 5.10 03/18] udf: Do not bother looking for prealloc extents if i_lenExtents matches i_size Date: Mon, 19 Dec 2022 20:24:56 +0100 Message-Id: <20221219182940.807292721@linuxfoundation.org> X-Mailer: git-send-email 2.39.0 In-Reply-To: <20221219182940.701087296@linuxfoundation.org> References: <20221219182940.701087296@linuxfoundation.org> User-Agent: quilt/0.67 Precedence: bulk X-Mailing-List: patches@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit From: Jan Kara commit 6ad53f0f71c52871202a7bf096feb2c59db33fc5 upstream. If rounded block-rounded i_lenExtents matches block rounded i_size, there are no preallocation extents. Do not bother walking extent linked list. CC: stable@vger.kernel.org Signed-off-by: Jan Kara Signed-off-by: Greg Kroah-Hartman --- fs/udf/truncate.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) --- a/fs/udf/truncate.c +++ b/fs/udf/truncate.c @@ -127,9 +127,10 @@ void udf_discard_prealloc(struct inode * uint64_t lbcount = 0; int8_t etype = -1, netype; struct udf_inode_info *iinfo = UDF_I(inode); + int bsize = 1 << inode->i_blkbits; if (iinfo->i_alloc_type == ICBTAG_FLAG_AD_IN_ICB || - inode->i_size == iinfo->i_lenExtents) + ALIGN(inode->i_size, bsize) == ALIGN(iinfo->i_lenExtents, bsize)) return; epos.block = iinfo->i_location;