From patchwork Mon Oct 5 15:48:22 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andy Leiserson X-Patchwork-Id: 526385 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 4FC8514029C for ; Tue, 6 Oct 2015 02:50:02 +1100 (AEDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751634AbbJEPsq (ORCPT ); Mon, 5 Oct 2015 11:48:46 -0400 Received: from mail-pa0-f47.google.com ([209.85.220.47]:35161 "EHLO mail-pa0-f47.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751600AbbJEPsp (ORCPT ); Mon, 5 Oct 2015 11:48:45 -0400 Received: by pacfv12 with SMTP id fv12so184053228pac.2 for ; Mon, 05 Oct 2015 08:48:45 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=TOD6rxlyenGNlO2MusorQmxk6lkWYPs3RDnhyTsOkAc=; b=PlQE0yEHt9T3BTV/S76yl8ddkeNPW0CjFTf+w8mrzXrZRaMGBZXdVGbY4gB68b0NjB pId5w+zoVRgxLPiG4pO7s3DEznpdXy9Swelnb26n1iDe58WOqMO/01GXfj1J1mbSnf0J eVryF9YwMY53A9aFyJIKeTbB2PdC6bbHhaUJv2Lb/2RQ36VSs/nu5htHvAOvQrxdj+TP p+rA0mGhVtX1ICdMg6784/J+rJi0JX0rnX3o+Bzbg6zULTSBFeEQlUHE6uR1ACz+3eqg +CLRWTmN00xFj9KmZAi9cLOkqsYQVs9bTYmhJGn7L/8DI+PaiB51FBGq7KuyPhDXszLO RE1Q== X-Gm-Message-State: ALoCoQkELHJz0OJWC9Y1wwPy5CbgAWoocsjWLi+aYEQMpGb0DKRCMPMqnFAAnEns1PEnlsKixKRN X-Received: by 10.69.31.171 with SMTP id kn11mr30769059pbd.112.1444060124952; Mon, 05 Oct 2015 08:48:44 -0700 (PDT) Received: from feldspar.22ary.net ([199.87.87.107]) by smtp.gmail.com with ESMTPSA id qd5sm28343410pbc.73.2015.10.05.08.48.43 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 05 Oct 2015 08:48:43 -0700 (PDT) From: Andy Leiserson To: linux-ext4@vger.kernel.org Cc: Andy Leiserson Subject: [PATCH] fix calculation of meta_bg descriptor backups Date: Mon, 5 Oct 2015 08:48:22 -0700 Message-Id: <1444060102-8296-1-git-send-email-andy@leiserson.org> X-Mailer: git-send-email 2.5.3 Sender: linux-ext4-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-ext4@vger.kernel.org "group" is the group where the backup will be placed, and is initialized to zero in the declaration. This meant that backups for meta_bg descriptors were erroneously written to group 1 and group (desc_per_block-1). Signed-off-by: Andy Leiserson --- fs/ext4/resize.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/fs/ext4/resize.c b/fs/ext4/resize.c index cf0c472..c7c53fd 100644 --- a/fs/ext4/resize.c +++ b/fs/ext4/resize.c @@ -1040,7 +1040,7 @@ exit_free: * do not copy the full number of backups at this time. The resize * which changed s_groups_count will backup again. */ -static void update_backups(struct super_block *sb, int blk_off, char *data, +static void update_backups(struct super_block *sb, sector_t blk_off, char *data, int size, int meta_bg) { struct ext4_sb_info *sbi = EXT4_SB(sb); @@ -1065,7 +1065,7 @@ static void update_backups(struct super_block *sb, int blk_off, char *data, group = ext4_list_backups(sb, &three, &five, &seven); last = sbi->s_groups_count; } else { - group = ext4_meta_bg_first_group(sb, group) + 1; + group = ext4_get_group_number(sb, blk_off) + 1; last = (ext4_group_t)(group + EXT4_DESC_PER_BLOCK(sb) - 2); }