From patchwork Sun Sep 2 04:51:21 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Theodore Ts'o X-Patchwork-Id: 181169 Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id A97792C0093 for ; Sun, 2 Sep 2012 17:36:37 +1000 (EST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755154Ab2IBHge (ORCPT ); Sun, 2 Sep 2012 03:36:34 -0400 Received: from li9-11.members.linode.com ([67.18.176.11]:48371 "EHLO imap.thunk.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752170Ab2IBHgd (ORCPT ); Sun, 2 Sep 2012 03:36:33 -0400 Received: from root (helo=closure.thunk.org) by imap.thunk.org with local-esmtp (Exim 4.72) (envelope-from ) id 1T84jM-0003tl-NC; Sun, 02 Sep 2012 07:36:28 +0000 Received: by closure.thunk.org (Postfix, from userid 15806) id 523212422DA; Sun, 2 Sep 2012 00:51:25 -0400 (EDT) From: Theodore Ts'o To: Ext4 Developers List Cc: xiaoqiangnk@gmail.com, "Theodore Ts'o" , stable@vger.kernel.org Subject: [PATCH 1/5] ext4: when resizing, do not copy gdt blocks for groups that do not have them Date: Sun, 2 Sep 2012 00:51:21 -0400 Message-Id: <1346561485-6413-2-git-send-email-tytso@mit.edu> X-Mailer: git-send-email 1.7.12.rc0.22.gcdd159b In-Reply-To: <1346561485-6413-1-git-send-email-tytso@mit.edu> References: <1346561485-6413-1-git-send-email-tytso@mit.edu> X-SA-Exim-Connect-IP: X-SA-Exim-Mail-From: tytso@thunk.org X-SA-Exim-Scanned: No (on imap.thunk.org); SAEximRunCond expanded to false Sender: linux-ext4-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-ext4@vger.kernel.org From: Yongqiang Yang The resize code was copying blocks at the beginning of each block group in order to copy the superblock and block group descriptor table (gdt) blocks. This was, unfortunately, being done even for block groups that did not have super blocks or gdt blocks. This is a complete waste of perfectly good I/O bandwidth, to skip writing those blocks for sparse bg's. Signed-off-by: Yongqiang Yang Signed-off-by: "Theodore Ts'o" Cc: stable@vger.kernel.org --- fs/ext4/resize.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/fs/ext4/resize.c b/fs/ext4/resize.c index 41f6ef6..724e250 100644 --- a/fs/ext4/resize.c +++ b/fs/ext4/resize.c @@ -451,6 +451,9 @@ static int setup_new_flex_group_blocks(struct super_block *sb, gdblocks = ext4_bg_num_gdb(sb, group); start = ext4_group_first_block_no(sb, group); + if (!ext4_bg_has_super(sb, group)) + goto handle_itb; + /* Copy all of the GDT blocks into the backup in this group */ for (j = 0, block = start + 1; j < gdblocks; j++, block++) { struct buffer_head *gdb; @@ -493,6 +496,7 @@ static int setup_new_flex_group_blocks(struct super_block *sb, goto out; } +handle_itb: /* Initialize group tables of the grop @group */ if (!(bg_flags[i] & EXT4_BG_INODE_ZEROED)) goto handle_bb;