add patch fix-crash-during-online-resizing
[ext4-patch-queue.git] / cleanup-clean_bdev_aliases-calls
blobd0c391e34f792d8eefb14d78cc7345b952fd47b9
1 ext4: cleanup clean_bdev_aliases() calls
3 From: "zhangyi (F)" <yi.zhang@huawei.com>
5 Now, we have already handle all cases of forgetting buffer in
6 jbd2_journal_forget(), the buffer should not be mapped to blockdevice
7 when reallocating it. So this patch remove all clean_bdev_aliases() and
8 clean_bdev_bh_alias() calls which were invoked by ext4 explicitly.
10 Suggested-by: Jan Kara <jack@suse.cz>
11 Signed-off-by: zhangyi (F) <yi.zhang@huawei.com>
12 Signed-off-by: Theodore Ts'o <tytso@mit.edu>
13 Reviewed-by: Jan Kara <jack@suse.cz>
14 ---
15  fs/ext4/extents.c | 12 +-----------
16  fs/ext4/inode.c   |  7 -------
17  fs/ext4/page-io.c |  4 +---
18  3 files changed, 2 insertions(+), 21 deletions(-)
20 diff --git a/fs/ext4/extents.c b/fs/ext4/extents.c
21 index a054f51..ffb72d8 100644
22 --- a/fs/ext4/extents.c
23 +++ b/fs/ext4/extents.c
24 @@ -4068,18 +4068,8 @@ ext4_ext_handle_unwritten_extents(handle_t *handle, struct inode *inode,
25         } else
26                 allocated = ret;
27         map->m_flags |= EXT4_MAP_NEW;
28 -       /*
29 -        * if we allocated more blocks than requested
30 -        * we need to make sure we unmap the extra block
31 -        * allocated. The actual needed block will get
32 -        * unmapped later when we find the buffer_head marked
33 -        * new.
34 -        */
35 -       if (allocated > map->m_len) {
36 -               clean_bdev_aliases(inode->i_sb->s_bdev, newblock + map->m_len,
37 -                                  allocated - map->m_len);
38 +       if (allocated > map->m_len)
39                 allocated = map->m_len;
40 -       }
41         map->m_len = allocated;
43  map_out:
44 diff --git a/fs/ext4/inode.c b/fs/ext4/inode.c
45 index e7adf87..3068c83 100644
46 --- a/fs/ext4/inode.c
47 +++ b/fs/ext4/inode.c
48 @@ -678,8 +678,6 @@ int ext4_map_blocks(handle_t *handle, struct inode *inode,
49                 if (flags & EXT4_GET_BLOCKS_ZERO &&
50                     map->m_flags & EXT4_MAP_MAPPED &&
51                     map->m_flags & EXT4_MAP_NEW) {
52 -                       clean_bdev_aliases(inode->i_sb->s_bdev, map->m_pblk,
53 -                                          map->m_len);
54                         ret = ext4_issue_zeroout(inode, map->m_lblk,
55                                                  map->m_pblk, map->m_len);
56                         if (ret) {
57 @@ -1194,7 +1192,6 @@ static int ext4_block_write_begin(struct page *page, loff_t pos, unsigned len,
58                         if (err)
59                                 break;
60                         if (buffer_new(bh)) {
61 -                               clean_bdev_bh_alias(bh);
62                                 if (PageUptodate(page)) {
63                                         clear_buffer_new(bh);
64                                         set_buffer_uptodate(bh);
65 @@ -2490,10 +2487,6 @@ static int mpage_map_one_extent(handle_t *handle, struct mpage_da_data *mpd)
66         }
68         BUG_ON(map->m_len == 0);
69 -       if (map->m_flags & EXT4_MAP_NEW) {
70 -               clean_bdev_aliases(inode->i_sb->s_bdev, map->m_pblk,
71 -                                  map->m_len);
72 -       }
73         return 0;
74  }
76 diff --git a/fs/ext4/page-io.c b/fs/ext4/page-io.c
77 index 2aa62d5..1559946 100644
78 --- a/fs/ext4/page-io.c
79 +++ b/fs/ext4/page-io.c
80 @@ -467,10 +467,8 @@ int ext4_bio_write_page(struct ext4_io_submit *io,
81                                 ext4_io_submit(io);
82                         continue;
83                 }
84 -               if (buffer_new(bh)) {
85 +               if (buffer_new(bh))
86                         clear_buffer_new(bh);
87 -                       clean_bdev_bh_alias(bh);
88 -               }
89                 set_buffer_async_write(bh);
90                 nr_to_submit++;
91         } while ((bh = bh->b_this_page) != head);
92 -- 
93 2.7.4