Received: by 2002:a05:6a10:f3d0:0:0:0:0 with SMTP id a16csp578673pxv; Wed, 30 Jun 2021 12:21:37 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxurvpOfCI/6x3lv4jK0Slo8uNb1W9n3lc7rNjGU1FN3x8nZ8JuhedW1ungsY/47gU9hb9E X-Received: by 2002:a92:d8ce:: with SMTP id l14mr20023508ilo.283.1625080897560; Wed, 30 Jun 2021 12:21:37 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1625080897; cv=none; d=google.com; s=arc-20160816; b=El3wRbAqtUC2I5PYlTBrqrVENgKHlgNe4sULB8iDR83ZTiOJfH9nC0q2gFHAJge32f 7nJ6dr46TLYybzAYmeXWtLm24nWX7zBXfTbGOnMxU53wHBG1462+HUKtku534qIEYpai c8DXCluxXFwJFZYRazQcgSJWvwD/+zXorF6ti7A/8N27lp0ujf983hUU/6kiRzJBr2pD 0deQ2xDW9GoA3IbdmH90ag8bvS67NF+U7Ka2ZYWT+Y8731n01+eYmVG6zfMfjZeXiQZe OkJ+2SSBEvTZzc7ppCXhyk3riIpxjRSUjasYhPhIguJcYtp2Yc+ckYP8fnJ0pjpLZQLO 2imw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date; bh=TAEeldJZja6VRLo3OwD+EJxZ1IcoQqlqfzC5L+uxVeM=; b=Bh55hJCBuU+XYkG2XgNRF6yVgb8O8ENayTBwCmeUul940UgdrDAycpxp5Uf8PwLnnG FhG5bvZPoiBmQwWHQRSmOc8U63A7ITaMry1KR3WAqH83ir0GmgVnQyTQd750Tx6lZ0Hy seSZ6a0Xp/kHh+K1UKHJsnGULmj1/50m2XJv7PTz8iwarviQLh9m/0DE/U0HSHNZz72O scrrj65foSANs4vtNPd+hDNKpukly4WCBbNJTH49Bb/29eKsb7nufGfLAv7yO6GdQ1vE q7zTimOv7JDsTWl9c8Z4gUQSbysLn3F0U6mMCMAOq5K5zfFQUmnX1/q/tb6csYIyrDK7 qgxw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-ext4-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-ext4-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id d25si23257399iop.15.2021.06.30.12.21.18; Wed, 30 Jun 2021 12:21:37 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-ext4-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-ext4-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-ext4-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233670AbhF3TXB (ORCPT + 99 others); Wed, 30 Jun 2021 15:23:01 -0400 Received: from outgoing-auth-1.mit.edu ([18.9.28.11]:59419 "EHLO outgoing.mit.edu" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S233536AbhF3TXA (ORCPT ); Wed, 30 Jun 2021 15:23:00 -0400 Received: from cwcc.thunk.org (pool-72-74-133-215.bstnma.fios.verizon.net [72.74.133.215]) (authenticated bits=0) (User authenticated as tytso@ATHENA.MIT.EDU) by outgoing.mit.edu (8.14.7/8.12.4) with ESMTP id 15UJKNdL003140 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 30 Jun 2021 15:20:24 -0400 Received: by cwcc.thunk.org (Postfix, from userid 15806) id 75A8715C3C8E; Wed, 30 Jun 2021 15:20:23 -0400 (EDT) Date: Wed, 30 Jun 2021 15:20:23 -0400 From: "Theodore Ts'o" To: "Darrick J. Wong" Cc: Ritesh Harjani , fstests@vger.kernel.org, linux-ext4@vger.kernel.org Subject: Re: [PATCH 9/9] common/attr: Reduce MAX_ATTRS to leave some overhead for 64K blocksize Message-ID: References: <20210630155150.GC13743@locust> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20210630155150.GC13743@locust> Precedence: bulk List-ID: X-Mailing-List: linux-ext4@vger.kernel.org On Wed, Jun 30, 2021 at 08:51:50AM -0700, Darrick J. Wong wrote: > On Mon, Jun 14, 2021 at 11:58:13AM +0530, Ritesh Harjani wrote: > > Test generic/020 fails for ext4 with 64K blocksize. So increase some overhead > > value to reduce the MAX_ATTRS so that it can accomodate for 64K blocksize. > > > > Signed-off-by: Ritesh Harjani > > --- > > common/attr | 2 +- > > 1 file changed, 1 insertion(+), 1 deletion(-) > > > > diff --git a/common/attr b/common/attr > > index d3902346..e8661d80 100644 > > --- a/common/attr > > +++ b/common/attr > > @@ -260,7 +260,7 @@ xfs|udf|pvfs2|9p|ceph|nfs) > > # Assume max ~1 block of attrs > > BLOCK_SIZE=`_get_block_size $TEST_DIR` > > # user.attribute_XXX="value.XXX" is about 32 bytes; leave some overhead > > - let MAX_ATTRS=$BLOCK_SIZE/40 > > + let MAX_ATTRS=$BLOCK_SIZE/48 > > 50% is quite a lot of overhead; maybe we should special-case this? The problem is that 32 bytes is an underestimate when i > 99 for user.attribute_$i=value_$i. And with a 4k blocksize, MAX_ATTRS = 4096 / 40 = 102. The exact calculation for ext4 is: fixed_block_overhead = 32 fixed_entry_overhead = 16 max_attr = (block_size - fixed_block_overhead) / (fixed_entry_overhead + round_up(len(attr_name), 4) + round_up(len(value), 4)) For 4k blocksizes, most of the attributes have an attr_name of "attribute_NN" which is 8, and "value_NN" which is 12. But for larger block sizes, we start having extended attributes of the form "attribute_NNN" or "attribute_NNNN", and "value_NNN" and "value_NNNN", which causes the round(len(..), 4) to jump up by 4 bytes. So round_up(len(attr_name, 4)) becomes 12 instead of 8, and round_up(len(value, 4)) becomes 16 instead of 12. So: max_attrs = (block_size - 32) / (16 + 12 + 16) or max_attrs = (block_size - 32) / 44 instead of: max_attrs = (block_size - 32) / (16 + 8 + 12) or max_attrs = (block_size - 32) / 36 So special casing things for block sizes > 4k may very well make sense. Perhaps it's even worth it to put in an ext[234] specific, exalc calculation for MAX_ATTRS in common/attr. Cheers, - Ted