diff options
author | Theodore Ts'o <tytso@mit.edu> | 2009-11-23 07:17:05 -0500 |
---|---|---|
committer | Theodore Ts'o <tytso@mit.edu> | 2009-11-23 07:17:05 -0500 |
commit | e6362609b6c71c5b802026be9cf263bbdd67a50e (patch) | |
tree | be908b6b0566f70d31378bf11b548a0d59ae0218 /fs/ext4/ext4.h | |
parent | 4433871130f36585fde38e7dd817433296648945 (diff) |
ext4: call ext4_forget() from ext4_free_blocks()
Add the facility for ext4_forget() to be called from
ext4_free_blocks(). This simplifies the code in a large number of
places, and centralizes most of the work of calling ext4_forget() into
a single place.
Also fix a bug in the extents migration code; it wasn't calling
ext4_forget() when releasing the indirect blocks during the
conversion. As a result, if the system cashed during or shortly after
the extents migration, and the released indirect blocks get reused as
data blocks, the journal replay would corrupt the data blocks. With
this new patch, fixing this bug was as simple as adding the
EXT4_FREE_BLOCKS_FORGET flags to the call to ext4_free_blocks().
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
Cc: "Aneesh Kumar K.V" <aneesh.kumar@linux.vnet.ibm.com>
Diffstat (limited to 'fs/ext4/ext4.h')
-rw-r--r-- | fs/ext4/ext4.h | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/fs/ext4/ext4.h b/fs/ext4/ext4.h index 210e1b53e91f..4cfc2f0edb3f 100644 --- a/fs/ext4/ext4.h +++ b/fs/ext4/ext4.h | |||
@@ -376,6 +376,12 @@ struct ext4_new_group_data { | |||
376 | EXT4_GET_BLOCKS_DIO_CREATE_EXT) | 376 | EXT4_GET_BLOCKS_DIO_CREATE_EXT) |
377 | 377 | ||
378 | /* | 378 | /* |
379 | * Flags used by ext4_free_blocks | ||
380 | */ | ||
381 | #define EXT4_FREE_BLOCKS_METADATA 0x0001 | ||
382 | #define EXT4_FREE_BLOCKS_FORGET 0x0002 | ||
383 | |||
384 | /* | ||
379 | * ioctl commands | 385 | * ioctl commands |
380 | */ | 386 | */ |
381 | #define EXT4_IOC_GETFLAGS FS_IOC_GETFLAGS | 387 | #define EXT4_IOC_GETFLAGS FS_IOC_GETFLAGS |
@@ -1384,8 +1390,8 @@ extern void ext4_discard_preallocations(struct inode *); | |||
1384 | extern int __init init_ext4_mballoc(void); | 1390 | extern int __init init_ext4_mballoc(void); |
1385 | extern void exit_ext4_mballoc(void); | 1391 | extern void exit_ext4_mballoc(void); |
1386 | extern void ext4_free_blocks(handle_t *handle, struct inode *inode, | 1392 | extern void ext4_free_blocks(handle_t *handle, struct inode *inode, |
1387 | ext4_fsblk_t block, unsigned long count, | 1393 | struct buffer_head *bh, ext4_fsblk_t block, |
1388 | int metadata); | 1394 | unsigned long count, int flags); |
1389 | extern int ext4_mb_add_groupinfo(struct super_block *sb, | 1395 | extern int ext4_mb_add_groupinfo(struct super_block *sb, |
1390 | ext4_group_t i, struct ext4_group_desc *desc); | 1396 | ext4_group_t i, struct ext4_group_desc *desc); |
1391 | extern int ext4_mb_get_buddy_cache_lock(struct super_block *, ext4_group_t); | 1397 | extern int ext4_mb_get_buddy_cache_lock(struct super_block *, ext4_group_t); |