Skip to content

Commit df1a259

Browse files
jankaragregkh
authored andcommitted
udf: Do not bother looking for prealloc extents if i_lenExtents matches i_size
commit 6ad53f0 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>
1 parent 63dbbd8 commit df1a259

1 file changed

Lines changed: 2 additions & 1 deletion

File tree

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)