]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
ocfs2: Fix calculation of i_blocks during truncate
authorMark Fasheh <mark.fasheh@oracle.com>
Fri, 31 Aug 2007 17:23:41 +0000 (10:23 -0700)
committerMark Fasheh <mark.fasheh@oracle.com>
Tue, 11 Sep 2007 18:39:46 +0000 (11:39 -0700)
We were setting i_blocks too early - before truncating any allocation.
Correct things to set i_blocks after the allocation change.

Signed-off-by: Mark Fasheh <mark.fasheh@oracle.com>
fs/ocfs2/alloc.c
fs/ocfs2/file.c

index 4f517665c9a0e4b187985a7c7d745c8ae4ddcc91..778a850b4634755c897c9708b2e2062e995e589b 100644 (file)
@@ -5602,6 +5602,7 @@ static int ocfs2_do_truncate(struct ocfs2_super *osb,
                                      clusters_to_del;
        spin_unlock(&OCFS2_I(inode)->ip_lock);
        le32_add_cpu(&fe->i_clusters, -clusters_to_del);
+       inode->i_blocks = ocfs2_inode_sector_count(inode);
 
        status = ocfs2_trim_tree(inode, path, handle, tc,
                                 clusters_to_del, &delete_blk);
index 4ffa715be09cff4f8243418016c0e0a08e2da40c..7e34e66159c690cb13beb43abaebe58b8f285333 100644 (file)
@@ -314,7 +314,6 @@ static int ocfs2_orphan_for_truncate(struct ocfs2_super *osb,
        }
 
        i_size_write(inode, new_i_size);
-       inode->i_blocks = ocfs2_align_bytes_to_sectors(new_i_size);
        inode->i_ctime = inode->i_mtime = CURRENT_TIME;
 
        di = (struct ocfs2_dinode *) fe_bh->b_data;