From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-yw0-f169.google.com ([209.85.161.169]:33460 "EHLO mail-yw0-f169.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752234AbdFQCEq (ORCPT ); Fri, 16 Jun 2017 22:04:46 -0400 Received: by mail-yw0-f169.google.com with SMTP id 63so25922507ywr.0 for ; Fri, 16 Jun 2017 19:04:46 -0700 (PDT) MIME-Version: 1.0 In-Reply-To: <20170615091026.GG1764@quack2.suse.cz> References: <20170614172340.18720-1-tahsin@google.com> <20170615091026.GG1764@quack2.suse.cz> From: Tahsin Erdogan Date: Fri, 16 Jun 2017 19:04:44 -0700 Message-ID: Subject: Re: [PATCH 30/31] ext4: eliminate xattr entry e_hash recalculation for removes To: Jan Kara Cc: "Darrick J . Wong" , Jan Kara , "Theodore Ts'o" , Andreas Dilger , Dave Kleikamp , Alexander Viro , Mark Fasheh , Joel Becker , Jens Axboe , Deepa Dinamani , Mike Christie , Fabian Frederick , linux-ext4@vger.kernel.org, linux-kernel@vger.kernel.org, jfs-discussion@lists.sourceforge.net, linux-fsdevel@vger.kernel.org, ocfs2-devel@oss.oracle.com, reiserfs-devel@vger.kernel.org Content-Type: text/plain; charset="UTF-8" Sender: linux-fsdevel-owner@vger.kernel.org List-ID: On Thu, Jun 15, 2017 at 2:10 AM, Jan Kara wrote: > I agree with moving ext4_xattr_rehash_entry() out of ext4_xattr_rehash(). > However how about just keeping ext4_xattr_rehash() in > ext4_xattr_block_set() (so that you don't have to pass aditional argument > to ext4_xattr_set_entry()) and calling ext4_xattr_rehash_entry() when > i->value != NULL? That would seem easier and cleaner as well... The is_block parameter is also used to decide whether block reserve check should be performed: @@ -1500,8 +1502,8 @@ static int ext4_xattr_set_entry(struct ext4_xattr_info *i, * attribute block so that a long value does not occupy the * whole space and prevent futher entries being added. */ - if (ext4_has_feature_ea_inode(inode->i_sb) && new_size && - (s->end - s->base) == i_blocksize(inode) && + if (ext4_has_feature_ea_inode(inode->i_sb) && + new_size && is_block && (min_offs + old_size - new_size) < EXT4_XATTR_BLOCK_RESERVE(inode)) { ret = -ENOSPC; Because of that, I think moving ext4_xattr_rehash to caller makes it bit more complicated. Let me know if you disagree.