summaryrefslogtreecommitdiffstats
path: root/fs
diff options
context:
space:
mode:
authorJan Kara <jack@suse.cz>2022-12-07 17:34:33 +0100
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2023-01-18 11:30:00 +0100
commit824ecacac49a8748ed7af713f44167281ade1f12 (patch)
tree19082bcc9929df2cb7fa4e38f7b15c37e943fd54 /fs
parent72f651c96c8aadf087fd782d551bf7db648a8c2e (diff)
downloadlinux-stable-824ecacac49a8748ed7af713f44167281ade1f12.tar.gz
linux-stable-824ecacac49a8748ed7af713f44167281ade1f12.tar.bz2
linux-stable-824ecacac49a8748ed7af713f44167281ade1f12.zip
udf: Do not bother looking for prealloc extents if i_lenExtents matches i_size
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 <jack@suse.cz> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'fs')
-rw-r--r--fs/udf/truncate.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/fs/udf/truncate.c b/fs/udf/truncate.c
index a84a4fb896cc..b0c71edc83f7 100644
--- a/fs/udf/truncate.c
+++ b/fs/udf/truncate.c
@@ -127,9 +127,10 @@ void udf_discard_prealloc(struct inode *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;