diff options
author | Lukas Czerner <lczerner@redhat.com> | 2014-04-20 23:44:47 -0400 |
---|---|---|
committer | Theodore Ts'o <tytso@mit.edu> | 2014-04-20 23:44:47 -0400 |
commit | 090f32ee4ef0a59c738963c6b0a6948cc5dee84c (patch) | |
tree | 1607ea017a0ba3d4373dd91a5b0d39c6bd64377f | |
parent | 9ac03675010a69507c0a9d832d6a722e07d35cc6 (diff) |
ext4: get rid of EXT4_MAP_UNINIT flag
Currently EXT4_MAP_UNINIT is used in dioread_nolock case to mark the
cases where we're using dioread_nolock and we're writing into either
unallocated, or unwritten extent, because we need to make sure that
any DIO write into that inode will wait for the extent conversion.
However EXT4_MAP_UNINIT is not only entirely misleading name but also
unnecessary because we can check for EXT4_MAP_UNWRITTEN in the
dioread_nolock case instead.
This commit removes EXT4_MAP_UNINIT flag.
Signed-off-by: Lukas Czerner <lczerner@redhat.com>
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
-rw-r--r-- | fs/ext4/ext4.h | 8 | ||||
-rw-r--r-- | fs/ext4/extents.c | 4 | ||||
-rw-r--r-- | fs/ext4/inode.c | 7 | ||||
-rw-r--r-- | include/trace/events/ext4.h | 1 |
4 files changed, 7 insertions, 13 deletions
diff --git a/fs/ext4/ext4.h b/fs/ext4/ext4.h index 66946aa62127..b681d90b1e87 100644 --- a/fs/ext4/ext4.h +++ b/fs/ext4/ext4.h | |||
@@ -158,7 +158,6 @@ struct ext4_allocation_request { | |||
158 | #define EXT4_MAP_MAPPED (1 << BH_Mapped) | 158 | #define EXT4_MAP_MAPPED (1 << BH_Mapped) |
159 | #define EXT4_MAP_UNWRITTEN (1 << BH_Unwritten) | 159 | #define EXT4_MAP_UNWRITTEN (1 << BH_Unwritten) |
160 | #define EXT4_MAP_BOUNDARY (1 << BH_Boundary) | 160 | #define EXT4_MAP_BOUNDARY (1 << BH_Boundary) |
161 | #define EXT4_MAP_UNINIT (1 << BH_Uninit) | ||
162 | /* Sometimes (in the bigalloc case, from ext4_da_get_block_prep) the caller of | 161 | /* Sometimes (in the bigalloc case, from ext4_da_get_block_prep) the caller of |
163 | * ext4_map_blocks wants to know whether or not the underlying cluster has | 162 | * ext4_map_blocks wants to know whether or not the underlying cluster has |
164 | * already been accounted for. EXT4_MAP_FROM_CLUSTER conveys to the caller that | 163 | * already been accounted for. EXT4_MAP_FROM_CLUSTER conveys to the caller that |
@@ -169,7 +168,7 @@ struct ext4_allocation_request { | |||
169 | #define EXT4_MAP_FROM_CLUSTER (1 << BH_AllocFromCluster) | 168 | #define EXT4_MAP_FROM_CLUSTER (1 << BH_AllocFromCluster) |
170 | #define EXT4_MAP_FLAGS (EXT4_MAP_NEW | EXT4_MAP_MAPPED |\ | 169 | #define EXT4_MAP_FLAGS (EXT4_MAP_NEW | EXT4_MAP_MAPPED |\ |
171 | EXT4_MAP_UNWRITTEN | EXT4_MAP_BOUNDARY |\ | 170 | EXT4_MAP_UNWRITTEN | EXT4_MAP_BOUNDARY |\ |
172 | EXT4_MAP_UNINIT | EXT4_MAP_FROM_CLUSTER) | 171 | EXT4_MAP_FROM_CLUSTER) |
173 | 172 | ||
174 | struct ext4_map_blocks { | 173 | struct ext4_map_blocks { |
175 | ext4_fsblk_t m_pblk; | 174 | ext4_fsblk_t m_pblk; |
@@ -2784,10 +2783,9 @@ extern int ext4_mmp_csum_verify(struct super_block *sb, | |||
2784 | * See EXT4_MAP_... to see where this is used. | 2783 | * See EXT4_MAP_... to see where this is used. |
2785 | */ | 2784 | */ |
2786 | enum ext4_state_bits { | 2785 | enum ext4_state_bits { |
2787 | BH_Uninit /* blocks are allocated but uninitialized on disk */ | 2786 | BH_AllocFromCluster /* allocated blocks were part of already |
2788 | = BH_JBDPrivateStart, | ||
2789 | BH_AllocFromCluster, /* allocated blocks were part of already | ||
2790 | * allocated cluster. */ | 2787 | * allocated cluster. */ |
2788 | = BH_JBDPrivateStart | ||
2791 | }; | 2789 | }; |
2792 | 2790 | ||
2793 | /* | 2791 | /* |
diff --git a/fs/ext4/extents.c b/fs/ext4/extents.c index 01b0c208f625..83ed52538ae4 100644 --- a/fs/ext4/extents.c +++ b/fs/ext4/extents.c | |||
@@ -4033,8 +4033,6 @@ ext4_ext_handle_uninitialized_extents(handle_t *handle, struct inode *inode, | |||
4033 | else | 4033 | else |
4034 | ext4_set_inode_state(inode, EXT4_STATE_DIO_UNWRITTEN); | 4034 | ext4_set_inode_state(inode, EXT4_STATE_DIO_UNWRITTEN); |
4035 | map->m_flags |= EXT4_MAP_UNWRITTEN; | 4035 | map->m_flags |= EXT4_MAP_UNWRITTEN; |
4036 | if (ext4_should_dioread_nolock(inode)) | ||
4037 | map->m_flags |= EXT4_MAP_UNINIT; | ||
4038 | goto out; | 4036 | goto out; |
4039 | } | 4037 | } |
4040 | /* IO end_io complete, convert the filled extent to written */ | 4038 | /* IO end_io complete, convert the filled extent to written */ |
@@ -4479,8 +4477,6 @@ got_allocated_blocks: | |||
4479 | */ | 4477 | */ |
4480 | if ((flags & EXT4_GET_BLOCKS_PRE_IO)) | 4478 | if ((flags & EXT4_GET_BLOCKS_PRE_IO)) |
4481 | set_unwritten = 1; | 4479 | set_unwritten = 1; |
4482 | if (ext4_should_dioread_nolock(inode)) | ||
4483 | map->m_flags |= EXT4_MAP_UNINIT; | ||
4484 | } | 4480 | } |
4485 | 4481 | ||
4486 | err = 0; | 4482 | err = 0; |
diff --git a/fs/ext4/inode.c b/fs/ext4/inode.c index d7b7462a0e13..297465e07d44 100644 --- a/fs/ext4/inode.c +++ b/fs/ext4/inode.c | |||
@@ -2126,7 +2126,7 @@ static int mpage_map_one_extent(handle_t *handle, struct mpage_da_data *mpd) | |||
2126 | struct inode *inode = mpd->inode; | 2126 | struct inode *inode = mpd->inode; |
2127 | struct ext4_map_blocks *map = &mpd->map; | 2127 | struct ext4_map_blocks *map = &mpd->map; |
2128 | int get_blocks_flags; | 2128 | int get_blocks_flags; |
2129 | int err; | 2129 | int err, dioread_nolock; |
2130 | 2130 | ||
2131 | trace_ext4_da_write_pages_extent(inode, map); | 2131 | trace_ext4_da_write_pages_extent(inode, map); |
2132 | /* | 2132 | /* |
@@ -2148,7 +2148,8 @@ static int mpage_map_one_extent(handle_t *handle, struct mpage_da_data *mpd) | |||
2148 | */ | 2148 | */ |
2149 | get_blocks_flags = EXT4_GET_BLOCKS_CREATE | | 2149 | get_blocks_flags = EXT4_GET_BLOCKS_CREATE | |
2150 | EXT4_GET_BLOCKS_METADATA_NOFAIL; | 2150 | EXT4_GET_BLOCKS_METADATA_NOFAIL; |
2151 | if (ext4_should_dioread_nolock(inode)) | 2151 | dioread_nolock = ext4_should_dioread_nolock(inode); |
2152 | if (dioread_nolock) | ||
2152 | get_blocks_flags |= EXT4_GET_BLOCKS_IO_CREATE_EXT; | 2153 | get_blocks_flags |= EXT4_GET_BLOCKS_IO_CREATE_EXT; |
2153 | if (map->m_flags & (1 << BH_Delay)) | 2154 | if (map->m_flags & (1 << BH_Delay)) |
2154 | get_blocks_flags |= EXT4_GET_BLOCKS_DELALLOC_RESERVE; | 2155 | get_blocks_flags |= EXT4_GET_BLOCKS_DELALLOC_RESERVE; |
@@ -2156,7 +2157,7 @@ static int mpage_map_one_extent(handle_t *handle, struct mpage_da_data *mpd) | |||
2156 | err = ext4_map_blocks(handle, inode, map, get_blocks_flags); | 2157 | err = ext4_map_blocks(handle, inode, map, get_blocks_flags); |
2157 | if (err < 0) | 2158 | if (err < 0) |
2158 | return err; | 2159 | return err; |
2159 | if (map->m_flags & EXT4_MAP_UNINIT) { | 2160 | if (dioread_nolock && (map->m_flags & EXT4_MAP_UNWRITTEN)) { |
2160 | if (!mpd->io_submit.io_end->handle && | 2161 | if (!mpd->io_submit.io_end->handle && |
2161 | ext4_handle_valid(handle)) { | 2162 | ext4_handle_valid(handle)) { |
2162 | mpd->io_submit.io_end->handle = handle->h_rsv_handle; | 2163 | mpd->io_submit.io_end->handle = handle->h_rsv_handle; |
diff --git a/include/trace/events/ext4.h b/include/trace/events/ext4.h index 6a1a0245474f..9995d3b588a8 100644 --- a/include/trace/events/ext4.h +++ b/include/trace/events/ext4.h | |||
@@ -51,7 +51,6 @@ struct extent_status; | |||
51 | { EXT4_MAP_MAPPED, "M" }, \ | 51 | { EXT4_MAP_MAPPED, "M" }, \ |
52 | { EXT4_MAP_UNWRITTEN, "U" }, \ | 52 | { EXT4_MAP_UNWRITTEN, "U" }, \ |
53 | { EXT4_MAP_BOUNDARY, "B" }, \ | 53 | { EXT4_MAP_BOUNDARY, "B" }, \ |
54 | { EXT4_MAP_UNINIT, "u" }, \ | ||
55 | { EXT4_MAP_FROM_CLUSTER, "C" }) | 54 | { EXT4_MAP_FROM_CLUSTER, "C" }) |
56 | 55 | ||
57 | #define show_free_flags(flags) __print_flags(flags, "|", \ | 56 | #define show_free_flags(flags) __print_flags(flags, "|", \ |