From: Yongqiang Yang Subject: [PATCH V6 RESEND 10/15] ext4: pass verify_reserved_gdb() the number of group decriptors Date: Fri, 30 Dec 2011 19:00:07 +0800 Message-ID: <1325242812-27005-11-git-send-email-xiaoqiangnk@gmail.com> References: <1325242812-27005-1-git-send-email-xiaoqiangnk@gmail.com> Cc: linux-ext4@vger.kernel.org, Yongqiang Yang To: tytso@mit.edu Return-path: Received: from mail-iy0-f174.google.com ([209.85.210.174]:41000 "EHLO mail-iy0-f174.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751599Ab1L3Olz (ORCPT ); Fri, 30 Dec 2011 09:41:55 -0500 Received: by mail-iy0-f174.google.com with SMTP id h11so25397943iae.19 for ; Fri, 30 Dec 2011 06:41:55 -0800 (PST) In-Reply-To: <1325242812-27005-1-git-send-email-xiaoqiangnk@gmail.com> Sender: linux-ext4-owner@vger.kernel.org List-ID: From: Yongqiang Yang The 64bit resizer adds a flex group each time, so verify_reserved_gdb can not use s_groups_count directly, it should use the number of group decriptors before the added group. Signed-off-by: Yongqiang Yang Signed-off-by: "Theodore Ts'o" --- fs/ext4/resize.c | 7 ++++--- 1 files changed, 4 insertions(+), 3 deletions(-) diff --git a/fs/ext4/resize.c b/fs/ext4/resize.c index bcc236f..f094373 100644 --- a/fs/ext4/resize.c +++ b/fs/ext4/resize.c @@ -656,10 +656,10 @@ static unsigned ext4_list_backups(struct super_block *sb, unsigned *three, * groups in current filesystem that have BACKUPS, or -ve error code. */ static int verify_reserved_gdb(struct super_block *sb, + ext4_group_t end, struct buffer_head *primary) { const ext4_fsblk_t blk = primary->b_blocknr; - const ext4_group_t end = EXT4_SB(sb)->s_groups_count; unsigned three = 1; unsigned five = 5; unsigned seven = 7; @@ -734,7 +734,7 @@ static int add_new_gdb(handle_t *handle, struct inode *inode, if (!gdb_bh) return -EIO; - gdbackups = verify_reserved_gdb(sb, gdb_bh); + gdbackups = verify_reserved_gdb(sb, group, gdb_bh); if (gdbackups < 0) { err = gdbackups; goto exit_bh; @@ -897,7 +897,8 @@ static int reserve_backup_gdb(handle_t *handle, struct inode *inode, err = -EIO; goto exit_bh; } - if ((gdbackups = verify_reserved_gdb(sb, primary[res])) < 0) { + gdbackups = verify_reserved_gdb(sb, group, primary[res]); + if (gdbackups < 0) { brelse(primary[res]); err = gdbackups; goto exit_bh; -- 1.7.5.1