diff options
author | Zheng Liu <wenqing.lz@taobao.com> | 2013-02-18 00:28:04 -0500 |
---|---|---|
committer | Theodore Ts'o <tytso@mit.edu> | 2013-02-18 00:28:04 -0500 |
commit | a25a4e1a5d5dc0f97dddbca44e695c532d8228c1 (patch) | |
tree | 4c2c484e8f0fe68835f859ff85c66b1a3a6a5497 /fs/ext4 | |
parent | be401363ac5ec652c706263a59b0bd0acc3612e8 (diff) |
ext4: let ext4_ext_map_blocks return EXT4_MAP_UNWRITTEN flag
This commit lets ext4_ext_map_blocks return EXT4_MAP_UNWRITTEN flag
because in later commit ext4_map_blocks needs to use this flag to
determine the extent status.
Signed-off-by: Zheng Liu <wenqing.lz@taobao.com>
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
Reviewed-by: Jan Kara <jack@suse.cz>
Diffstat (limited to 'fs/ext4')
-rw-r--r-- | fs/ext4/extents.c | 6 | ||||
-rw-r--r-- | fs/ext4/inode.c | 12 |
2 files changed, 8 insertions, 10 deletions
diff --git a/fs/ext4/extents.c b/fs/ext4/extents.c index 895c19595ecf..cae8ae3c1746 100644 --- a/fs/ext4/extents.c +++ b/fs/ext4/extents.c | |||
@@ -3659,6 +3659,7 @@ ext4_ext_handle_uninitialized_extents(handle_t *handle, struct inode *inode, | |||
3659 | ext4_set_io_unwritten_flag(inode, io); | 3659 | ext4_set_io_unwritten_flag(inode, io); |
3660 | else | 3660 | else |
3661 | ext4_set_inode_state(inode, EXT4_STATE_DIO_UNWRITTEN); | 3661 | ext4_set_inode_state(inode, EXT4_STATE_DIO_UNWRITTEN); |
3662 | map->m_flags |= EXT4_MAP_UNWRITTEN; | ||
3662 | if (ext4_should_dioread_nolock(inode)) | 3663 | if (ext4_should_dioread_nolock(inode)) |
3663 | map->m_flags |= EXT4_MAP_UNINIT; | 3664 | map->m_flags |= EXT4_MAP_UNINIT; |
3664 | goto out; | 3665 | goto out; |
@@ -3680,8 +3681,10 @@ ext4_ext_handle_uninitialized_extents(handle_t *handle, struct inode *inode, | |||
3680 | * repeat fallocate creation request | 3681 | * repeat fallocate creation request |
3681 | * we already have an unwritten extent | 3682 | * we already have an unwritten extent |
3682 | */ | 3683 | */ |
3683 | if (flags & EXT4_GET_BLOCKS_UNINIT_EXT) | 3684 | if (flags & EXT4_GET_BLOCKS_UNINIT_EXT) { |
3685 | map->m_flags |= EXT4_MAP_UNWRITTEN; | ||
3684 | goto map_out; | 3686 | goto map_out; |
3687 | } | ||
3685 | 3688 | ||
3686 | /* buffered READ or buffered write_begin() lookup */ | 3689 | /* buffered READ or buffered write_begin() lookup */ |
3687 | if ((flags & EXT4_GET_BLOCKS_CREATE) == 0) { | 3690 | if ((flags & EXT4_GET_BLOCKS_CREATE) == 0) { |
@@ -4111,6 +4114,7 @@ got_allocated_blocks: | |||
4111 | /* Mark uninitialized */ | 4114 | /* Mark uninitialized */ |
4112 | if (flags & EXT4_GET_BLOCKS_UNINIT_EXT){ | 4115 | if (flags & EXT4_GET_BLOCKS_UNINIT_EXT){ |
4113 | ext4_ext_mark_uninitialized(&newex); | 4116 | ext4_ext_mark_uninitialized(&newex); |
4117 | map->m_flags |= EXT4_MAP_UNWRITTEN; | ||
4114 | /* | 4118 | /* |
4115 | * io_end structure was created for every IO write to an | 4119 | * io_end structure was created for every IO write to an |
4116 | * uninitialized extent. To avoid unnecessary conversion, | 4120 | * uninitialized extent. To avoid unnecessary conversion, |
diff --git a/fs/ext4/inode.c b/fs/ext4/inode.c index e0e1cb0863f4..084b8212cf95 100644 --- a/fs/ext4/inode.c +++ b/fs/ext4/inode.c | |||
@@ -559,16 +559,10 @@ int ext4_map_blocks(handle_t *handle, struct inode *inode, | |||
559 | return retval; | 559 | return retval; |
560 | 560 | ||
561 | /* | 561 | /* |
562 | * When we call get_blocks without the create flag, the | 562 | * Here we clear m_flags because after allocating an new extent, |
563 | * BH_Unwritten flag could have gotten set if the blocks | 563 | * it will be set again. |
564 | * requested were part of a uninitialized extent. We need to | ||
565 | * clear this flag now that we are committed to convert all or | ||
566 | * part of the uninitialized extent to be an initialized | ||
567 | * extent. This is because we need to avoid the combination | ||
568 | * of BH_Unwritten and BH_Mapped flags being simultaneously | ||
569 | * set on the buffer_head. | ||
570 | */ | 564 | */ |
571 | map->m_flags &= ~EXT4_MAP_UNWRITTEN; | 565 | map->m_flags &= ~EXT4_MAP_FLAGS; |
572 | 566 | ||
573 | /* | 567 | /* |
574 | * New blocks allocate and/or writing to uninitialized extent | 568 | * New blocks allocate and/or writing to uninitialized extent |