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 <[EMAIL PROTECTED]>

diff -rupX /home/jack/.kerndiffexclude 
linux-2.6.20-3-udf_buffer_handling/fs/udf/truncate.c 
linux-2.6.20-4-udf_discard_prealloc_cleanup/fs/udf/truncate.c
--- linux-2.6.20-3-udf_buffer_handling/fs/udf/truncate.c        2007-03-06 
15:02:33.000000000 +0100
+++ linux-2.6.20-4-udf_discard_prealloc_cleanup/fs/udf/truncate.c       
2007-03-06 15:03:00.000000000 +0100
@@ -88,8 +88,9 @@ void udf_discard_prealloc(struct 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 *
        }
        UDF_I_LENEXTENTS(inode) = lbcount;
 
+       WARN_ON(lbcount != inode->i_size);
        brelse(epos.bh);
 }
 
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Reply via email to