]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/blob - releases/3.6.2/ext4-don-t-copy-non-existent-gdt-blocks-when-resizing.patch
4.9-stable patches
[thirdparty/kernel/stable-queue.git] / releases / 3.6.2 / ext4-don-t-copy-non-existent-gdt-blocks-when-resizing.patch
1 From 6df935ad2fced9033ab52078825fcaf6365f34b7 Mon Sep 17 00:00:00 2001
2 From: Yongqiang Yang <xiaoqiangnk@gmail.com>
3 Date: Wed, 5 Sep 2012 01:25:50 -0400
4 Subject: ext4: don't copy non-existent gdt blocks when resizing
5
6 From: Yongqiang Yang <xiaoqiangnk@gmail.com>
7
8 commit 6df935ad2fced9033ab52078825fcaf6365f34b7 upstream.
9
10 The resize code was copying blocks at the beginning of each block
11 group in order to copy the superblock and block group descriptor table
12 (gdt) blocks. This was, unfortunately, being done even for block
13 groups that did not have super blocks or gdt blocks. This is a
14 complete waste of perfectly good I/O bandwidth, to skip writing those
15 blocks for sparse bg's.
16
17 Signed-off-by: Yongqiang Yang <xiaoqiangnk@gmail.com>
18 Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
19 Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
20
21 ---
22 fs/ext4/resize.c | 4 ++++
23 1 file changed, 4 insertions(+)
24
25 --- a/fs/ext4/resize.c
26 +++ b/fs/ext4/resize.c
27 @@ -456,6 +456,9 @@ static int setup_new_flex_group_blocks(s
28 gdblocks = ext4_bg_num_gdb(sb, group);
29 start = ext4_group_first_block_no(sb, group);
30
31 + if (!ext4_bg_has_super(sb, group))
32 + goto handle_itb;
33 +
34 /* Copy all of the GDT blocks into the backup in this group */
35 for (j = 0, block = start + 1; j < gdblocks; j++, block++) {
36 struct buffer_head *gdb;
37 @@ -498,6 +501,7 @@ static int setup_new_flex_group_blocks(s
38 goto out;
39 }
40
41 +handle_itb:
42 /* Initialize group tables of the grop @group */
43 if (!(bg_flags[i] & EXT4_BG_INODE_ZEROED))
44 goto handle_bb;