1 ext4: get rid of EXT4_MAP_UNINIT flag
3 From: Lukas Czerner <lczerner@redhat.com>
5 Currently EXT4_MAP_UNINIT is used in dioread_nolock case to mark the
6 cases where we're using dioread_nolock and we're writing into either
7 unallocated, or unwritten extent, because we need to make sure that
8 any DIO write into that inode will wait for the extent conversion.
10 However EXT4_MAP_UNINIT is not only entirely misleading name but also
11 unnecessary because we can check for EXT4_MAP_UNWRITTEN in the
12 dioread_nolock case instead.
14 This commit removes EXT4_MAP_UNINIT flag.
16 Signed-off-by: Lukas Czerner <lczerner@redhat.com>
17 Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
19 fs/ext4/ext4.h | 8 +++-----
20 fs/ext4/extents.c | 4 ----
21 fs/ext4/inode.c | 7 ++++---
22 include/trace/events/ext4.h | 1 -
23 4 files changed, 7 insertions(+), 13 deletions(-)
25 diff --git a/fs/ext4/ext4.h b/fs/ext4/ext4.h
26 index f1c65dc..b731538 100644
29 @@ -158,7 +158,6 @@ struct ext4_allocation_request {
30 #define EXT4_MAP_MAPPED (1 << BH_Mapped)
31 #define EXT4_MAP_UNWRITTEN (1 << BH_Unwritten)
32 #define EXT4_MAP_BOUNDARY (1 << BH_Boundary)
33 -#define EXT4_MAP_UNINIT (1 << BH_Uninit)
34 /* Sometimes (in the bigalloc case, from ext4_da_get_block_prep) the caller of
35 * ext4_map_blocks wants to know whether or not the underlying cluster has
36 * already been accounted for. EXT4_MAP_FROM_CLUSTER conveys to the caller that
37 @@ -169,7 +168,7 @@ struct ext4_allocation_request {
38 #define EXT4_MAP_FROM_CLUSTER (1 << BH_AllocFromCluster)
39 #define EXT4_MAP_FLAGS (EXT4_MAP_NEW | EXT4_MAP_MAPPED |\
40 EXT4_MAP_UNWRITTEN | EXT4_MAP_BOUNDARY |\
41 - EXT4_MAP_UNINIT | EXT4_MAP_FROM_CLUSTER)
42 + EXT4_MAP_FROM_CLUSTER)
44 struct ext4_map_blocks {
46 @@ -2801,10 +2800,9 @@ extern int ext4_mmp_csum_verify(struct super_block *sb,
47 * See EXT4_MAP_... to see where this is used.
49 enum ext4_state_bits {
50 - BH_Uninit /* blocks are allocated but uninitialized on disk */
51 - = BH_JBDPrivateStart,
52 - BH_AllocFromCluster, /* allocated blocks were part of already
53 + BH_AllocFromCluster /* allocated blocks were part of already
54 * allocated cluster. */
55 + = BH_JBDPrivateStart
59 diff --git a/fs/ext4/extents.c b/fs/ext4/extents.c
60 index 82df3ce..299eb72 100644
61 --- a/fs/ext4/extents.c
62 +++ b/fs/ext4/extents.c
63 @@ -4022,8 +4022,6 @@ ext4_ext_handle_uninitialized_extents(handle_t *handle, struct inode *inode,
65 ext4_set_inode_state(inode, EXT4_STATE_DIO_UNWRITTEN);
66 map->m_flags |= EXT4_MAP_UNWRITTEN;
67 - if (ext4_should_dioread_nolock(inode))
68 - map->m_flags |= EXT4_MAP_UNINIT;
71 /* IO end_io complete, convert the filled extent to written */
72 @@ -4468,8 +4466,6 @@ got_allocated_blocks:
74 if ((flags & EXT4_GET_BLOCKS_PRE_IO))
76 - if (ext4_should_dioread_nolock(inode))
77 - map->m_flags |= EXT4_MAP_UNINIT;
81 diff --git a/fs/ext4/inode.c b/fs/ext4/inode.c
82 index 5b0d2c7..0432c07 100644
85 @@ -2122,7 +2122,7 @@ static int mpage_map_one_extent(handle_t *handle, struct mpage_da_data *mpd)
86 struct inode *inode = mpd->inode;
87 struct ext4_map_blocks *map = &mpd->map;
90 + int err, dioread_nolock;
92 trace_ext4_da_write_pages_extent(inode, map);
94 @@ -2144,7 +2144,8 @@ static int mpage_map_one_extent(handle_t *handle, struct mpage_da_data *mpd)
96 get_blocks_flags = EXT4_GET_BLOCKS_CREATE |
97 EXT4_GET_BLOCKS_METADATA_NOFAIL;
98 - if (ext4_should_dioread_nolock(inode))
99 + dioread_nolock = ext4_should_dioread_nolock(inode);
100 + if (dioread_nolock)
101 get_blocks_flags |= EXT4_GET_BLOCKS_IO_CREATE_EXT;
102 if (map->m_flags & (1 << BH_Delay))
103 get_blocks_flags |= EXT4_GET_BLOCKS_DELALLOC_RESERVE;
104 @@ -2152,7 +2153,7 @@ static int mpage_map_one_extent(handle_t *handle, struct mpage_da_data *mpd)
105 err = ext4_map_blocks(handle, inode, map, get_blocks_flags);
108 - if (map->m_flags & EXT4_MAP_UNINIT) {
109 + if (dioread_nolock && (map->m_flags & EXT4_MAP_UNWRITTEN)) {
110 if (!mpd->io_submit.io_end->handle &&
111 ext4_handle_valid(handle)) {
112 mpd->io_submit.io_end->handle = handle->h_rsv_handle;
113 diff --git a/include/trace/events/ext4.h b/include/trace/events/ext4.h
114 index 010ea89..be1c889 100644
115 --- a/include/trace/events/ext4.h
116 +++ b/include/trace/events/ext4.h
117 @@ -60,7 +60,6 @@ struct extent_status;
118 { EXT4_MAP_MAPPED, "M" }, \
119 { EXT4_MAP_UNWRITTEN, "U" }, \
120 { EXT4_MAP_BOUNDARY, "B" }, \
121 - { EXT4_MAP_UNINIT, "u" }, \
122 { EXT4_MAP_FROM_CLUSTER, "C" })
124 #define show_free_flags(flags) __print_flags(flags, "|", \
129 To unsubscribe from this list: send the line "unsubscribe linux-ext4" in
130 the body of a message to majordomo@vger.kernel.org
131 More majordomo info at http://vger.kernel.org/majordomo-info.html