From: Jan Kara Date: Tue, 8 May 2007 07:35:18 +0000 (-0700) Subject: udf: add assertions X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=948b9b2c967c3bec6136b2dbb9e1c12f62e03efa;p=GitHub%2FLineageOS%2Fandroid_kernel_motorola_exynos9610.git udf: add assertions Add a few assertions into udf_discard_prealloc() to check that the file is sane (mostly helps debugging further patches ;). Signed-off-by: Jan Kara Acked-by: Christoph Hellwig Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- diff --git a/fs/udf/truncate.c b/fs/udf/truncate.c index 0449b2216e71..0e328cdc9a45 100644 --- a/fs/udf/truncate.c +++ b/fs/udf/truncate.c @@ -88,8 +88,9 @@ void udf_discard_prealloc(struct inode * inode) { etype = netype; lbcount += elen; - if (lbcount > inode->i_size && lbcount - inode->i_size < inode->i_sb->s_blocksize) + if (lbcount > inode->i_size && lbcount - elen < inode->i_size) { + WARN_ON(lbcount - inode->i_size >= inode->i_sb->s_blocksize); nelen = elen - (lbcount - inode->i_size); epos.offset -= adsize; extent_trunc(inode, &epos, eloc, etype, elen, nelen); @@ -119,6 +120,7 @@ void udf_discard_prealloc(struct inode * inode) } UDF_I_LENEXTENTS(inode) = lbcount; + WARN_ON(lbcount != inode->i_size); brelse(epos.bh); }