diff options
author | Jan Kara <jack@suse.cz> | 2007-05-08 03:35:18 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@woody.linux-foundation.org> | 2007-05-08 14:15:21 -0400 |
commit | 948b9b2c967c3bec6136b2dbb9e1c12f62e03efa (patch) | |
tree | 25a2376aef384fb05221e20b3c96f3c490c8195c /fs/udf/truncate.c | |
parent | 3bf25cb40d899eeb5a471f497e56ddfe2c96c019 (diff) |
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 <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>
Diffstat (limited to 'fs/udf/truncate.c')
-rw-r--r-- | fs/udf/truncate.c | 4 |
1 files changed, 3 insertions, 1 deletions
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) | |||
88 | { | 88 | { |
89 | etype = netype; | 89 | etype = netype; |
90 | lbcount += elen; | 90 | lbcount += elen; |
91 | if (lbcount > inode->i_size && lbcount - inode->i_size < inode->i_sb->s_blocksize) | 91 | if (lbcount > inode->i_size && lbcount - elen < inode->i_size) |
92 | { | 92 | { |
93 | WARN_ON(lbcount - inode->i_size >= inode->i_sb->s_blocksize); | ||
93 | nelen = elen - (lbcount - inode->i_size); | 94 | nelen = elen - (lbcount - inode->i_size); |
94 | epos.offset -= adsize; | 95 | epos.offset -= adsize; |
95 | extent_trunc(inode, &epos, eloc, etype, elen, nelen); | 96 | extent_trunc(inode, &epos, eloc, etype, elen, nelen); |
@@ -119,6 +120,7 @@ void udf_discard_prealloc(struct inode * inode) | |||
119 | } | 120 | } |
120 | UDF_I_LENEXTENTS(inode) = lbcount; | 121 | UDF_I_LENEXTENTS(inode) = lbcount; |
121 | 122 | ||
123 | WARN_ON(lbcount != inode->i_size); | ||
122 | brelse(epos.bh); | 124 | brelse(epos.bh); |
123 | } | 125 | } |
124 | 126 | ||