From patchwork Fri Feb 8 08:43:59 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Zheng Liu X-Patchwork-Id: 219059 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 B758C2C0080 for ; Fri, 8 Feb 2013 19:30:04 +1100 (EST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1946055Ab3BHIaD (ORCPT ); Fri, 8 Feb 2013 03:30:03 -0500 Received: from mail-da0-f49.google.com ([209.85.210.49]:35768 "EHLO mail-da0-f49.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1759842Ab3BHIaC (ORCPT ); Fri, 8 Feb 2013 03:30:02 -0500 Received: by mail-da0-f49.google.com with SMTP id t11so1675485daj.36 for ; Fri, 08 Feb 2013 00:30:01 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=x-received:from:to:cc:subject:date:message-id:x-mailer:in-reply-to :references; bh=fsQEVBihoz8/4Hk6Na+75+XthRoUauFROodr4RgVw+g=; b=p3FcsF94KL6nqlzYpkIlnlxvfmeWx1C8Q74OKdlQ8ToEQVUIyXkFbddLB3tymjk0jQ VF7lmPk5S4qkXu8G61UJp84FQA0Go62+pjEy8CLXm3AXRGU5y6NY16wiZ5PQrV60TLlm 2/KCHOW8t4tUMwD9tvBdPd/ODVkdsFicfvxx5DNteOVrA4BZi14ojT0bYDxbp9ki4tzt Pg4U4vXF0r6q1XPYlR+O8ixg2+iFPCNIaaM+HZ6RViZ/mVpAPUmktfEj0LIw77kB6f1s TAnWwJwWRJAG68M8jiY1fqVcFAYqdbzk5LmITARd3uCYPIwedAkys/mBlj4Ma+wapoMW DjFw== X-Received: by 10.66.80.68 with SMTP id p4mr14961477pax.35.1360312201790; Fri, 08 Feb 2013 00:30:01 -0800 (PST) Received: from lz-desktop.taobao.ali.com ([182.92.247.2]) by mx.google.com with ESMTPS id y9sm52593791paw.1.2013.02.08.00.29.57 (version=TLSv1 cipher=RC4-SHA bits=128/128); Fri, 08 Feb 2013 00:30:01 -0800 (PST) From: Zheng Liu To: linux-ext4@vger.kernel.org Cc: Zheng Liu , "Theodore Ts'o" , Jan kara Subject: [PATCH 03/10 v5] ext4: let ext4_ext_map_blocks return EXT4_MAP_UNWRITTEN flag Date: Fri, 8 Feb 2013 16:43:59 +0800 Message-Id: <1360313046-9876-4-git-send-email-wenqing.lz@taobao.com> X-Mailer: git-send-email 1.7.12.rc2.18.g61b472e In-Reply-To: <1360313046-9876-1-git-send-email-wenqing.lz@taobao.com> References: <1360313046-9876-1-git-send-email-wenqing.lz@taobao.com> Sender: linux-ext4-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-ext4@vger.kernel.org From: Zheng Liu This commit lets ext4_ext_map_blocks return EXT4_MAP_UNWRITTEN flag because in later commit ext4_map_blocks needs to use this flag to determine the extent status. Signed-off-by: Zheng Liu Cc: "Theodore Ts'o" Cc: Jan kara Reviewed-by: Jan Kara --- fs/ext4/extents.c | 6 +++++- fs/ext4/inode.c | 12 +++--------- 2 files changed, 8 insertions(+), 10 deletions(-) diff --git a/fs/ext4/extents.c b/fs/ext4/extents.c index f7bf616..d92947f 100644 --- a/fs/ext4/extents.c +++ b/fs/ext4/extents.c @@ -3657,6 +3657,7 @@ ext4_ext_handle_uninitialized_extents(handle_t *handle, struct inode *inode, ext4_set_io_unwritten_flag(inode, io); else ext4_set_inode_state(inode, EXT4_STATE_DIO_UNWRITTEN); + map->m_flags |= EXT4_MAP_UNWRITTEN; if (ext4_should_dioread_nolock(inode)) map->m_flags |= EXT4_MAP_UNINIT; goto out; @@ -3678,8 +3679,10 @@ ext4_ext_handle_uninitialized_extents(handle_t *handle, struct inode *inode, * repeat fallocate creation request * we already have an unwritten extent */ - if (flags & EXT4_GET_BLOCKS_UNINIT_EXT) + if (flags & EXT4_GET_BLOCKS_UNINIT_EXT) { + map->m_flags |= EXT4_MAP_UNWRITTEN; goto map_out; + } /* buffered READ or buffered write_begin() lookup */ if ((flags & EXT4_GET_BLOCKS_CREATE) == 0) { @@ -4109,6 +4112,7 @@ got_allocated_blocks: /* Mark uninitialized */ if (flags & EXT4_GET_BLOCKS_UNINIT_EXT){ ext4_ext_mark_uninitialized(&newex); + map->m_flags |= EXT4_MAP_UNWRITTEN; /* * io_end structure was created for every IO write to an * uninitialized extent. To avoid unnecessary conversion, diff --git a/fs/ext4/inode.c b/fs/ext4/inode.c index 7fb00d8..c7e9665 100644 --- a/fs/ext4/inode.c +++ b/fs/ext4/inode.c @@ -560,16 +560,10 @@ int ext4_map_blocks(handle_t *handle, struct inode *inode, return retval; /* - * When we call get_blocks without the create flag, the - * BH_Unwritten flag could have gotten set if the blocks - * requested were part of a uninitialized extent. We need to - * clear this flag now that we are committed to convert all or - * part of the uninitialized extent to be an initialized - * extent. This is because we need to avoid the combination - * of BH_Unwritten and BH_Mapped flags being simultaneously - * set on the buffer_head. + * Here we clear m_flags because after allocating an new extent, + * it will be set again. */ - map->m_flags &= ~EXT4_MAP_UNWRITTEN; + map->m_flags &= ~EXT4_MAP_FLAGS; /* * New blocks allocate and/or writing to uninitialized extent