From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.3 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_SANE_1 autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 7A186C3A59F for ; Tue, 27 Aug 2019 02:38:54 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 576DF206E0 for ; Tue, 27 Aug 2019 02:38:54 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728799AbfH0Cix (ORCPT ); Mon, 26 Aug 2019 22:38:53 -0400 Received: from outgoing-auth-1.mit.edu ([18.9.28.11]:58009 "EHLO outgoing.mit.edu" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1727887AbfH0Cix (ORCPT ); Mon, 26 Aug 2019 22:38:53 -0400 Received: from callcc.thunk.org (guestnat-104-133-0-111.corp.google.com [104.133.0.111] (may be forged)) (authenticated bits=0) (User authenticated as tytso@ATHENA.MIT.EDU) by outgoing.mit.edu (8.14.7/8.12.4) with ESMTP id x7R2cmxC013004 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 26 Aug 2019 22:38:49 -0400 Received: by callcc.thunk.org (Postfix, from userid 15806) id A86FA42049E; Mon, 26 Aug 2019 22:38:48 -0400 (EDT) Date: Mon, 26 Aug 2019 22:38:48 -0400 From: "Theodore Y. Ts'o" To: harshad shirwadkar Cc: Andreas Dilger , Ext4 Developers List Subject: Re: [PATCH] ext4: attempt to shrink directory on dentry removal Message-ID: <20190827023848.GH28066@mit.edu> References: <20190821182740.97127-1-harshadshirwadkar@gmail.com> <7303B125-6C0E-41C2-A71E-4AF8C9776468@dilger.ca> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.10.1 (2018-07-13) Sender: linux-ext4-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-ext4@vger.kernel.org On Mon, Aug 26, 2019 at 02:46:01PM -0700, harshad shirwadkar wrote: > By this method we end up reading up to 2 extra blocks (one previous > and one next) that are not going to be merged. That's the trade-off we > have to make in order to avoid any changes to on-disk structure (If we > modify the on-disk structure and store the fullness in the dx block, > we would read only the blocks that need to be merged). We can also adjust the merging strategy depending on whether the previous and/or next blocks are in memory. If they are in memory, that we might try merging if the block is < 50% full. If they are not in memory, it might not be worth doing the read until the block is empty, or maybe, say, 10% full. > Since merging approach also requires a way to free up directory > blocks, I think we could first get a patch in that can free up > directory blocks by swapping with the last block. Once we have that > then we could implement merging. I agree; I'd wait to implementing merging until we get directory block removal working. Simply trying to shrink the directory when a leaf block which is *not* the last block in an indexed directory is going to be substantially better compared to waiting until the last block in the directory is empty. - Ted