Skip to content

Commit 6ad53f0

Browse files
committed
udf: Do not bother looking for prealloc extents if i_lenExtents matches i_size
If rounded block-rounded i_lenExtents matches block rounded i_size, there are no preallocation extents. Do not bother walking extent linked list. CC: [email protected] Signed-off-by: Jan Kara <[email protected]>
1 parent cfe4c1b commit 6ad53f0

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

fs/udf/truncate.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -127,9 +127,10 @@ void udf_discard_prealloc(struct inode *inode)
127127
uint64_t lbcount = 0;
128128
int8_t etype = -1, netype;
129129
struct udf_inode_info *iinfo = UDF_I(inode);
130+
int bsize = 1 << inode->i_blkbits;
130131

131132
if (iinfo->i_alloc_type == ICBTAG_FLAG_AD_IN_ICB ||
132-
inode->i_size == iinfo->i_lenExtents)
133+
ALIGN(inode->i_size, bsize) == ALIGN(iinfo->i_lenExtents, bsize))
133134
return;
134135

135136
epos.block = iinfo->i_location;

0 commit comments

Comments
 (0)