From: Zheng Liu Subject: Re: [PATCH v3 3/6] ext4: cache extent hole in extent status tree for ext4_da_map_blocks() Date: Thu, 4 Sep 2014 21:04:48 +0800 Message-ID: <20140904130448.GB13193@gmail.com> References: <1407382553-24256-1-git-send-email-wenqing.lz@taobao.com> <1407382553-24256-4-git-send-email-wenqing.lz@taobao.com> <20140902024350.GS8974@thunk.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Cc: linux-ext4@vger.kernel.org, Andreas Dilger , Jan Kara , Zheng Liu To: Theodore Ts'o Return-path: Received: from mail-pd0-f170.google.com ([209.85.192.170]:44839 "EHLO mail-pd0-f170.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754222AbaIDMzW (ORCPT ); Thu, 4 Sep 2014 08:55:22 -0400 Received: by mail-pd0-f170.google.com with SMTP id r10so13495940pdi.15 for ; Thu, 04 Sep 2014 05:55:20 -0700 (PDT) Content-Disposition: inline In-Reply-To: <20140902024350.GS8974@thunk.org> Sender: linux-ext4-owner@vger.kernel.org List-ID: On Mon, Sep 01, 2014 at 10:43:50PM -0400, Theodore Ts'o wrote: > On Thu, Aug 07, 2014 at 11:35:50AM +0800, Zheng Liu wrote: > > From: Zheng Liu > > > > Currently extent status tree doesn't cache extent hole when a write > > looks up in extent tree to make sure whether a block has been allocated > > or not. In this case, we don't put extent hole in extent cache because > > later this extent might be removed and a new delayed extent might be > > added back. But it will cause a defect when we do a lot of writes. > > If we don't put extent hole in extent cache, the following writes also > > need to access extent tree to look at whether or not a block has been > > allocated. It brings a cache miss. This commit fixes this defect. > > Meanwhile, if an inode has no any extent, this extent hole also will > > be cached. > > Hi Zheng, > > I thought the reason why we have the EXT4_GET_BLOCKS_NO_PUT_HOLE flag > is because in ext4_da_map_blocks(), if there is a hole, we will be > immediately following it up with a call to ext4_es_insert_extent() to > fill in the hole with the EXTENT_STATUS_DELAYED flag. The only time > we don't is if we run into an ENOSPC error. > > Am I missing something? Yes, you are right. The purpose is used to do the work like you said above. As the commit log described this flag brings a huge number of cache misses when an empty file is written. So it might be worth putting a hole in the cache when delalloc is enabled. Regards, - Zheng