Skip to content

Commit

Permalink
udf: add assertions
Browse files Browse the repository at this point in the history
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 <jack@suse.cz>
Acked-by: Christoph Hellwig <hch@infradead.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
  • Loading branch information
Jan Kara authored and Linus Torvalds committed May 8, 2007
1 parent 3bf25cb commit 948b9b2
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion fs/udf/truncate.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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);
}

Expand Down

0 comments on commit 948b9b2

Please sign in to comment.