Commit 3613d228 authored by Jan Kara's avatar Jan Kara Committed by Theodore Ts'o

ext4: remove buffer_uninit handling

There isn't any need for setting BH_Uninit on buffers anymore.  It was
only used to signal we need to mark io_end as needing extent
conversion in add_bh_to_extent() but now we can mark the io_end
directly when mapping extent.
Reviewed-by: default avatarZheng Liu <wenqing.lz@taobao.com>
Signed-off-by: default avatarJan Kara <jack@suse.cz>
Signed-off-by: default avatar"Theodore Ts'o" <tytso@mit.edu>
parent 4e7ea81d
...@@ -2653,20 +2653,17 @@ extern void ext4_mmp_csum_set(struct super_block *sb, struct mmp_struct *mmp); ...@@ -2653,20 +2653,17 @@ extern void ext4_mmp_csum_set(struct super_block *sb, struct mmp_struct *mmp);
extern int ext4_mmp_csum_verify(struct super_block *sb, extern int ext4_mmp_csum_verify(struct super_block *sb,
struct mmp_struct *mmp); struct mmp_struct *mmp);
/* BH_Uninit flag: blocks are allocated but uninitialized on disk */ /*
* Note that these flags will never ever appear in a buffer_head's state flag.
* See EXT4_MAP_... to see where this is used.
*/
enum ext4_state_bits { enum ext4_state_bits {
BH_Uninit /* blocks are allocated but uninitialized on disk */ BH_Uninit /* blocks are allocated but uninitialized on disk */
= BH_JBDPrivateStart, = BH_JBDPrivateStart,
BH_AllocFromCluster, /* allocated blocks were part of already BH_AllocFromCluster, /* allocated blocks were part of already
* allocated cluster. Note that this flag will * allocated cluster. */
* never, ever appear in a buffer_head's state
* flag. See EXT4_MAP_FROM_CLUSTER to see where
* this is used. */
}; };
BUFFER_FNS(Uninit, uninit)
TAS_BUFFER_FNS(Uninit, uninit)
/* /*
* Add new method to test whether block and inode bitmaps are properly * Add new method to test whether block and inode bitmaps are properly
* initialized. With uninit_bg reading the block from disk is not enough * initialized. With uninit_bg reading the block from disk is not enough
......
...@@ -2047,8 +2047,6 @@ static int mpage_map_and_submit_buffers(struct mpage_da_data *mpd) ...@@ -2047,8 +2047,6 @@ static int mpage_map_and_submit_buffers(struct mpage_da_data *mpd)
clear_buffer_delay(bh); clear_buffer_delay(bh);
bh->b_blocknr = pblock++; bh->b_blocknr = pblock++;
} }
if (mpd->map.m_flags & EXT4_MAP_UNINIT)
set_buffer_uninit(bh);
clear_buffer_unwritten(bh); clear_buffer_unwritten(bh);
} while (++lblk < blocks && } while (++lblk < blocks &&
(bh = bh->b_this_page) != head); (bh = bh->b_this_page) != head);
...@@ -2110,6 +2108,8 @@ static int mpage_map_one_extent(handle_t *handle, struct mpage_da_data *mpd) ...@@ -2110,6 +2108,8 @@ static int mpage_map_one_extent(handle_t *handle, struct mpage_da_data *mpd)
err = ext4_map_blocks(handle, inode, map, get_blocks_flags); err = ext4_map_blocks(handle, inode, map, get_blocks_flags);
if (err < 0) if (err < 0)
return err; return err;
if (map->m_flags & EXT4_MAP_UNINIT)
ext4_set_io_unwritten_flag(inode, mpd->io_submit.io_end);
BUG_ON(map->m_len == 0); BUG_ON(map->m_len == 0);
if (map->m_flags & EXT4_MAP_NEW) { if (map->m_flags & EXT4_MAP_NEW) {
......
...@@ -369,7 +369,6 @@ static int io_submit_add_bh(struct ext4_io_submit *io, ...@@ -369,7 +369,6 @@ static int io_submit_add_bh(struct ext4_io_submit *io,
struct inode *inode, struct inode *inode,
struct buffer_head *bh) struct buffer_head *bh)
{ {
ext4_io_end_t *io_end;
int ret; int ret;
if (io->io_bio && bh->b_blocknr != io->io_next_block) { if (io->io_bio && bh->b_blocknr != io->io_next_block) {
...@@ -384,9 +383,6 @@ static int io_submit_add_bh(struct ext4_io_submit *io, ...@@ -384,9 +383,6 @@ static int io_submit_add_bh(struct ext4_io_submit *io,
ret = bio_add_page(io->io_bio, bh->b_page, bh->b_size, bh_offset(bh)); ret = bio_add_page(io->io_bio, bh->b_page, bh->b_size, bh_offset(bh));
if (ret != bh->b_size) if (ret != bh->b_size)
goto submit_and_retry; goto submit_and_retry;
io_end = io->io_end;
if (test_clear_buffer_uninit(bh))
ext4_set_io_unwritten_flag(inode, io_end);
io->io_next_block++; io->io_next_block++;
return 0; return 0;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment