From patchwork Wed Aug 26 05:23:16 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Aneesh Kumar K.V" X-Patchwork-Id: 32106 Return-Path: X-Original-To: patchwork-incoming@bilbo.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from ozlabs.org (ozlabs.org [203.10.76.45]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client CN "mx.ozlabs.org", Issuer "CA Cert Signing Authority" (verified OK)) by bilbo.ozlabs.org (Postfix) with ESMTPS id 070ABB6F34 for ; Wed, 26 Aug 2009 15:23:25 +1000 (EST) Received: by ozlabs.org (Postfix) id EC858DDDB6; Wed, 26 Aug 2009 15:23:24 +1000 (EST) Delivered-To: patchwork-incoming@ozlabs.org Received: from vger.kernel.org (vger.kernel.org [209.132.176.167]) by ozlabs.org (Postfix) with ESMTP id 7D4A5DDD01 for ; Wed, 26 Aug 2009 15:23:24 +1000 (EST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753245AbZHZFXU (ORCPT ); Wed, 26 Aug 2009 01:23:20 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1753273AbZHZFXU (ORCPT ); Wed, 26 Aug 2009 01:23:20 -0400 Received: from e23smtp05.au.ibm.com ([202.81.31.147]:40312 "EHLO e23smtp05.au.ibm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753245AbZHZFXT (ORCPT ); Wed, 26 Aug 2009 01:23:19 -0400 Received: from d23relay01.au.ibm.com (d23relay01.au.ibm.com [202.81.31.243]) by e23smtp05.au.ibm.com (8.14.3/8.13.1) with ESMTP id n7Q5Kn43028817 for ; Wed, 26 Aug 2009 15:20:49 +1000 Received: from d23av03.au.ibm.com (d23av03.au.ibm.com [9.190.234.97]) by d23relay01.au.ibm.com (8.13.8/8.13.8/NCO v10.0) with ESMTP id n7Q5NKdG180644 for ; Wed, 26 Aug 2009 15:23:20 +1000 Received: from d23av03.au.ibm.com (loopback [127.0.0.1]) by d23av03.au.ibm.com (8.12.11.20060308/8.13.3) with ESMTP id n7Q5NKmW029409 for ; Wed, 26 Aug 2009 15:23:20 +1000 Received: from localhost.localdomain ([9.124.35.37]) by d23av03.au.ibm.com (8.12.11.20060308/8.12.11) with ESMTP id n7Q5NIEi029351; Wed, 26 Aug 2009 15:23:18 +1000 From: "Aneesh Kumar K.V" To: cmm@us.ibm.com, tytso@mit.edu, sandeen@redhat.com Cc: linux-ext4@vger.kernel.org, "Aneesh Kumar K.V" Subject: [PATCH -V2] ext4: Drop mapped buffer_head check during page_mkwrite Date: Wed, 26 Aug 2009 10:53:16 +0530 Message-Id: <1251264196-31382-1-git-send-email-aneesh.kumar@linux.vnet.ibm.com> X-Mailer: git-send-email 1.6.4.1.196.g31f0b Sender: linux-ext4-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-ext4@vger.kernel.org Inorder to check whether the buffer_heads are mapped we need to hold page lock. Otherwise a reclaim can cleanup the attached buffer_heads. Instead of taking page lock and check whether buffer_heads are mapped we let the write_begin/write_end callback does the equivalent. It does have a performance impact in that we are doing more work if we the buffer_heads are already mapped. Signed-off-by: Aneesh Kumar K.V --- fs/ext4/inode.c | 11 ----------- 1 files changed, 0 insertions(+), 11 deletions(-) diff --git a/fs/ext4/inode.c b/fs/ext4/inode.c index f9c642b..ad99286 100644 --- a/fs/ext4/inode.c +++ b/fs/ext4/inode.c @@ -5245,11 +5245,6 @@ int ext4_change_inode_journal_flag(struct inode *inode, int val) return err; } -static int ext4_bh_unmapped(handle_t *handle, struct buffer_head *bh) -{ - return !buffer_mapped(bh); -} - int ext4_page_mkwrite(struct vm_area_struct *vma, struct vm_fault *vmf) { struct page *page = vmf->page; @@ -5281,12 +5276,6 @@ int ext4_page_mkwrite(struct vm_area_struct *vma, struct vm_fault *vmf) else len = PAGE_CACHE_SIZE; - if (page_has_buffers(page)) { - /* return if we have all the buffers mapped */ - if (!walk_page_buffers(NULL, page_buffers(page), 0, len, NULL, - ext4_bh_unmapped)) - goto out_unlock; - } /* * OK, we need to fill the hole... Do write_begin write_end * to do block allocation/reservation.We are not holding