From: Aneesh Kumar K.V Date: Sat, 11 Oct 2008 00:13:31 +0000 (-0400) Subject: ext4: Don't reuse released data blocks until transaction commits X-Git-Tag: v2.6.28-rc1~257^2~11 X-Git-Url: http://pilppa.com/gitweb/?a=commitdiff_plain;h=a1aebc1e2da9a7bee4ff8cce510b08f469d1929e;p=linux-2.6-omap-h63xx.git ext4: Don't reuse released data blocks until transaction commits We need to make sure we don't reuse the data blocks released during the transaction untill the transaction commits. We force this mode only for ordered and journalled mode. Writeback mode already don't provided data consistency. Signed-off-by: Aneesh Kumar K.V Signed-off-by: Theodore Ts'o --- diff --git a/fs/ext4/balloc.c b/fs/ext4/balloc.c index bd2ece22882..b9821be709b 100644 --- a/fs/ext4/balloc.c +++ b/fs/ext4/balloc.c @@ -568,8 +568,16 @@ void ext4_free_blocks(handle_t *handle, struct inode *inode, /* this isn't the right place to decide whether block is metadata * inode.c/extents.c knows better, but for safety ... */ - if (S_ISDIR(inode->i_mode) || S_ISLNK(inode->i_mode) || - ext4_should_journal_data(inode)) + if (S_ISDIR(inode->i_mode) || S_ISLNK(inode->i_mode)) + metadata = 1; + + /* We need to make sure we don't reuse + * block released untill the transaction commit. + * writeback mode have weak data consistency so + * don't force data as metadata when freeing block + * for writeback mode. + */ + if (metadata == 0 && !ext4_should_writeback_data(inode)) metadata = 1; sb = inode->i_sb;