Received: by 2002:a05:6a10:5bc5:0:0:0:0 with SMTP id os5csp1659087pxb; Thu, 28 Oct 2021 07:46:24 -0700 (PDT) X-Google-Smtp-Source: ABdhPJy0i817+93+Fo8a1QXyEmqqGAzewt/Gpu6OfxgI8cF3ocHt0D8YvE0FPhcnjaRvRNYCpRxk X-Received: by 2002:a17:907:c18:: with SMTP id ga24mr6048765ejc.243.1635432383793; Thu, 28 Oct 2021 07:46:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1635432383; cv=none; d=google.com; s=arc-20160816; b=TVV8oZWlvSGJC7N7jInFuITHnttEXjCzkBzXqQk+hGrlljmr23jKgS+PEW61jLbUxV dtI9c5o+abuFiPN6sDFcI6yvBxVmMlvApN63CXRsqjTqAON0GI50r/dC/8SChQj1j4FQ n/PZYfYibP4ieAGb9KYjRWv4kjuYpveAUxWxdxkqL7+ke9oahGOivfFmgWSc9VDL9bfu soP7IxXc+Dq/PPf32E0QMf4stUx4MnJhK0teTGayGh7zNIDjjIisuRM4KOlKPdO5zAN7 OpxBPEuW1Yu8uuSl22buaBIQak2afyimUQazxP1+sx9x4ujAlZQBL7CgXXk/mvvenJBo 0Yng== 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=Y8zC+hqXjfFqmvRsZFRi26MoPzoreOBdRg/AvGVXOeE=; b=BQzAVE3Qln5OhOKOp5JesMI7VCY8OZ8lQHu0OTllQDsp3ot7W7ArTzjnQBzkuht19L bTtXHOW8JIM1QRsRP7BGkN5df+50F9rYURAZfYBSVsh5aywvJ83iunmvOMHrqjXecxpp 6W/qQGoxKBgff+8sGddiiDx6lzYBLofbvNTItjBYh9/OLvdaC+uL3/jZAHrbxU42fJwG c2QYSIVdE+pz58DTGj6apP9ZmjKU+P9cmIIYSg9RqmXypDc3pQe/IRICCe3OC8LtQb3W kN7cbsjP7MLW6dAafRHCX5zfkstnSA7IwHOLYEB2zsHYsNR1lgsek0sFzHT8ADpzNTbS Q8Lw== 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 gs43si5477334ejc.209.2021.10.28.07.45.51; Thu, 28 Oct 2021 07:46:23 -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 S231151AbhJ1OsP (ORCPT + 99 others); Thu, 28 Oct 2021 10:48:15 -0400 Received: from outgoing-auth-1.mit.edu ([18.9.28.11]:37072 "EHLO outgoing.mit.edu" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S230451AbhJ1OsP (ORCPT ); Thu, 28 Oct 2021 10:48:15 -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 19SEjd1s030338 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 28 Oct 2021 10:45:40 -0400 Received: by cwcc.thunk.org (Postfix, from userid 15806) id 8034A15C00B9; Thu, 28 Oct 2021 10:45:39 -0400 (EDT) Date: Thu, 28 Oct 2021 10:45:39 -0400 From: "Theodore Ts'o" To: Andreas Dilger Cc: linux-ext4@vger.kernel.org Subject: Re: [PATCH] ext2fs: avoid re-reading inode multiple times Message-ID: References: <20210407075023.44324-1-adilger@dilger.ca> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20210407075023.44324-1-adilger@dilger.ca> Precedence: bulk List-ID: X-Mailing-List: linux-ext4@vger.kernel.org On Wed, Apr 07, 2021 at 01:50:23AM -0600, Andreas Dilger wrote: > Reduce the number of times that the inode is read from storage. > Factor ext2fs_xattrs_read() into a new ext2fs_xattrs_read_inode() > function that can accept an in-memory inode, and call that from > within ext2fs_xattrs_read() and in e2fsck_pass1() when the inode > is already available. > > Similarly, in e2fsck_pass4() avoid re-reading the inode multiple > times in disconnect_inode(), check_ea_inode(), and in the main > function body if possible. > > Signed-off-by: Andreas Dilger Applied, although I needed to add this initialization patch to avoid a "make check" failure. diff --git a/lib/ext2fs/ext_attr.c b/lib/ext2fs/ext_attr.c index 157e6eac..d36fe68d 100644 --- a/lib/ext2fs/ext_attr.c +++ b/lib/ext2fs/ext_attr.c @@ -998,7 +998,7 @@ errcode_t ext2fs_xattrs_read_inode(struct ext2_xattr_handle *handle, char *start, *block_buf = NULL; blk64_t blk; size_t i; - errcode_t err; + errcode_t err = 0; EXT2_CHECK_MAGIC(handle, EXT2_ET_MAGIC_EA_HANDLE); - Ted