add patch pass-inode-pointer-instead-of-file-pointer-to-punch-hole
[ext4-patch-queue.git] / remove-unneeded-code-in-ext4_new_inode
blob6df1288597d7207cfb58afd04b0b38deb15469cc
1 ext4: remove block bitmap initialization in ext4_new_inode()
3 We are initializing the block bitmap in ext4_new_inode(), and as far
4 as I can tell, there's no reason to do it.  So remove it to simplify
5 things.
7 Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
8 ---
9  fs/ext4/ialloc.c |   37 -------------------------------------
10  1 files changed, 0 insertions(+), 37 deletions(-)
12 diff --git a/fs/ext4/ialloc.c b/fs/ext4/ialloc.c
13 index 2fd3b0e..6e88327 100644
14 --- a/fs/ext4/ialloc.c
15 +++ b/fs/ext4/ialloc.c
16 @@ -815,7 +815,6 @@ struct inode *ext4_new_inode(handle_t *handle, struct inode *dir, int mode,
17         int ret2, err = 0;
18         struct inode *ret;
19         ext4_group_t i;
20 -       int free = 0;
21         static int once = 1;
22         ext4_group_t flex_group;
24 @@ -936,42 +935,6 @@ repeat_in_this_group:
25         goto out;
27  got:
28 -       /* We may have to initialize the block bitmap if it isn't already */
29 -       if (EXT4_HAS_RO_COMPAT_FEATURE(sb, EXT4_FEATURE_RO_COMPAT_GDT_CSUM) &&
30 -           gdp->bg_flags & cpu_to_le16(EXT4_BG_BLOCK_UNINIT)) {
31 -               struct buffer_head *block_bitmap_bh;
33 -               block_bitmap_bh = ext4_read_block_bitmap(sb, group);
34 -               BUFFER_TRACE(block_bitmap_bh, "get block bitmap access");
35 -               err = ext4_journal_get_write_access(handle, block_bitmap_bh);
36 -               if (err) {
37 -                       brelse(block_bitmap_bh);
38 -                       goto fail;
39 -               }
41 -               free = 0;
42 -               ext4_lock_group(sb, group);
43 -               /* recheck and clear flag under lock if we still need to */
44 -               if (gdp->bg_flags & cpu_to_le16(EXT4_BG_BLOCK_UNINIT)) {
45 -                       free = ext4_free_blocks_after_init(sb, group, gdp);
46 -                       gdp->bg_flags &= cpu_to_le16(~EXT4_BG_BLOCK_UNINIT);
47 -                       ext4_free_blks_set(sb, gdp, free);
48 -                       gdp->bg_checksum = ext4_group_desc_csum(sbi, group,
49 -                                                               gdp);
50 -               }
51 -               ext4_unlock_group(sb, group);
53 -               /* Don't need to dirty bitmap block if we didn't change it */
54 -               if (free) {
55 -                       BUFFER_TRACE(block_bitmap_bh, "dirty block bitmap");
56 -                       err = ext4_handle_dirty_metadata(handle,
57 -                                                       NULL, block_bitmap_bh);
58 -               }
60 -               brelse(block_bitmap_bh);
61 -               if (err)
62 -                       goto fail;
63 -       }
64         BUFFER_TRACE(group_desc_bh, "call ext4_handle_dirty_metadata");
65         err = ext4_handle_dirty_metadata(handle, NULL, group_desc_bh);
66         if (err)