From patchwork Fri Jan 13 21:30:47 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: 135996 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 75D7BB6EFF for ; Sat, 14 Jan 2012 08:31:07 +1100 (EST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1759245Ab2AMVbC (ORCPT ); Fri, 13 Jan 2012 16:31:02 -0500 Received: from li9-11.members.linode.com ([67.18.176.11]:42562 "EHLO test.thunk.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1759230Ab2AMVbB (ORCPT ); Fri, 13 Jan 2012 16:31:01 -0500 Received: from root (helo=tytso-glaptop.cam.corp.google.com) by test.thunk.org with local-esmtp (Exim 4.69) (envelope-from ) id 1Rloi2-0002XB-VV; Fri, 13 Jan 2012 21:30:51 +0000 Received: from tytso by tytso-glaptop.cam.corp.google.com with local (Exim 4.71) (envelope-from ) id 1Rloi1-0000Rm-9G; Fri, 13 Jan 2012 16:30:49 -0500 From: Theodore Ts'o To: Ext4 Developers List Cc: Theodore Ts'o Subject: [PATCH 1/3] ext4: remove block bitmap initialization in ext4_new_inode() Date: Fri, 13 Jan 2012 16:30:47 -0500 Message-Id: <1326490249-1685-2-git-send-email-tytso@mit.edu> X-Mailer: git-send-email 1.7.8.11.gefc1f.dirty In-Reply-To: <1326490249-1685-1-git-send-email-tytso@mit.edu> References: <1326490249-1685-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 test.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 We don't need to initialize the block bitmap when we allocate a new inode. This is old code from the very early days that is just confusing things, and also has the problem of modifying the block group descriptor without obeying the ext4_journal_get_write_access() / ext4_handle_dirty_metadata() modification protocols. Signed-off-by: "Theodore Ts'o" --- fs/ext4/ialloc.c | 31 ------------------------------- 1 files changed, 0 insertions(+), 31 deletions(-) diff --git a/fs/ext4/ialloc.c b/fs/ext4/ialloc.c index 72fc989..a4ce10f 100644 --- a/fs/ext4/ialloc.c +++ b/fs/ext4/ialloc.c @@ -807,37 +807,6 @@ repeat_in_this_group: goto out; got: - /* We may have to initialize the block bitmap if it isn't already */ - if (EXT4_HAS_RO_COMPAT_FEATURE(sb, EXT4_FEATURE_RO_COMPAT_GDT_CSUM) && - gdp->bg_flags & cpu_to_le16(EXT4_BG_BLOCK_UNINIT)) { - struct buffer_head *block_bitmap_bh; - - block_bitmap_bh = ext4_read_block_bitmap(sb, group); - BUFFER_TRACE(block_bitmap_bh, "get block bitmap access"); - err = ext4_journal_get_write_access(handle, block_bitmap_bh); - if (err) { - brelse(block_bitmap_bh); - goto fail; - } - - BUFFER_TRACE(block_bitmap_bh, "dirty block bitmap"); - err = ext4_handle_dirty_metadata(handle, NULL, block_bitmap_bh); - brelse(block_bitmap_bh); - - /* recheck and clear flag under lock if we still need to */ - ext4_lock_group(sb, group); - if (gdp->bg_flags & cpu_to_le16(EXT4_BG_BLOCK_UNINIT)) { - gdp->bg_flags &= cpu_to_le16(~EXT4_BG_BLOCK_UNINIT); - ext4_free_group_clusters_set(sb, gdp, - ext4_free_clusters_after_init(sb, group, gdp)); - gdp->bg_checksum = ext4_group_desc_csum(sbi, group, - gdp); - } - ext4_unlock_group(sb, group); - - if (err) - goto fail; - } BUFFER_TRACE(group_desc_bh, "call ext4_handle_dirty_metadata"); err = ext4_handle_dirty_metadata(handle, NULL, group_desc_bh); if (err)