Skip to content

Commit

Permalink
udf: Do not bother looking for prealloc extents if i_lenExtents match…
Browse files Browse the repository at this point in the history
…es 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: stable@vger.kernel.org
Signed-off-by: Jan Kara <jack@suse.cz>
  • Loading branch information
jankara committed Dec 9, 2022
1 parent cfe4c1b commit 6ad53f0
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion fs/udf/truncate.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit 6ad53f0

Please sign in to comment.