From patchwork Mon Apr 22 01:11:33 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: majianpeng X-Patchwork-Id: 238274 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 154402C0112 for ; Mon, 22 Apr 2013 11:11:51 +1000 (EST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753677Ab3DVBLt (ORCPT ); Sun, 21 Apr 2013 21:11:49 -0400 Received: from mail-da0-f53.google.com ([209.85.210.53]:42368 "EHLO mail-da0-f53.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753510Ab3DVBLs (ORCPT ); Sun, 21 Apr 2013 21:11:48 -0400 Received: by mail-da0-f53.google.com with SMTP id n34so312855dal.26 for ; Sun, 21 Apr 2013 18:11:47 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=x-received:message-id:date:from:user-agent:mime-version:to:cc :subject:content-type:content-transfer-encoding; bh=mb9qUq2+MHmL3FVa8bzAAEZWjiw/K1ue0cXTtKEe6Ow=; b=ilnb107GrIGnoMcIVw4ifUx9qlPJoGJyuIwrBXlibBwE4fpmYct7srtPdS2ec7xEh/ vVHl5pwgyYejr6JB5BrfBYRGe/JoIPr1XrapDugkjS3jDjKycO8IZFd2Hr7uXas2O9AB NHqdpkwXeyQM7u8MJhnDS9PvX7DffhkueZMKxjZErzPuENdExh7udd+8smobutokpP/I QUgVRQ12OhUrFrOOhXhdj+m/atgbGKayN4KBy+BVppScsDrcoDzt5Ff+a5agrmtiOraj bB6ucwcM97riJXx65ocyNFrL7qGZO2E95tn8T4eE1ZWpT+YczKiFvtEpHhbzYr1YO38d EOkw== X-Received: by 10.68.176.133 with SMTP id ci5mr29822352pbc.21.1366593107825; Sun, 21 Apr 2013 18:11:47 -0700 (PDT) Received: from [172.16.193.108] ([218.242.10.181]) by mx.google.com with ESMTPS id mm9sm22703749pbc.43.2013.04.21.18.11.43 (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Sun, 21 Apr 2013 18:11:46 -0700 (PDT) Message-ID: <51748E45.8060806@gmail.com> Date: Mon, 22 Apr 2013 09:11:33 +0800 From: majianpeng User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20130329 Thunderbird/17.0.5 MIME-Version: 1.0 To: Al Viro , akpm@linux-foundation.org, tytso@mit.edu, Jan Kara CC: linux-fsdevel , linux-ext4@vger.kernel.org, linux-kernel Subject: [PATCH V1] fs/buffer.c: Remove unnecessary init operation after, allocating buffer_head. Sender: linux-ext4-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-ext4@vger.kernel.org Because alloc 'struct buffer_head' using kmem_cache_zalloc,so it doesn't need to call 'init_buffer(bh, NULL, NULL)' and other set-zero-operation. Signed-off-by: Jianpeng Ma --- fs/buffer.c | 2 -- fs/jbd/journal.c | 2 -- fs/jbd2/journal.c | 2 -- 3 files changed, 6 deletions(-) diff --git a/fs/buffer.c b/fs/buffer.c index b4dcb34..52b7739 100644 --- a/fs/buffer.c +++ b/fs/buffer.c @@ -865,8 +865,6 @@ try_again: /* Link the buffer to its page */ set_bh_page(bh, page, offset); - - init_buffer(bh, NULL, NULL); } return head; /* diff --git a/fs/jbd/journal.c b/fs/jbd/journal.c index 81cc7ea..865c430 100644 --- a/fs/jbd/journal.c +++ b/fs/jbd/journal.c @@ -310,8 +310,6 @@ int journal_write_metadata_buffer(transaction_t *transaction, new_bh = alloc_buffer_head(GFP_NOFS|__GFP_NOFAIL); /* keep subsequent assertions sane */ - new_bh->b_state = 0; - init_buffer(new_bh, NULL, NULL); atomic_set(&new_bh->b_count, 1); new_jh = journal_add_journal_head(new_bh); /* This sleeps */ diff --git a/fs/jbd2/journal.c b/fs/jbd2/journal.c index ed10991..8b220f1 100644 --- a/fs/jbd2/journal.c +++ b/fs/jbd2/journal.c @@ -367,8 +367,6 @@ retry_alloc: } /* keep subsequent assertions sane */ - new_bh->b_state = 0; - init_buffer(new_bh, NULL, NULL); atomic_set(&new_bh->b_count, 1); new_jh = jbd2_journal_add_journal_head(new_bh); /* This sleeps */