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=-4.0 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=ham 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 ACEA2C282DD for ; Fri, 24 May 2019 02:07:21 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 6B4882168B for ; Fri, 24 May 2019 02:07:21 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2387465AbfEXCHU (ORCPT ); Thu, 23 May 2019 22:07:20 -0400 Received: from sender2-pp-o92.zoho.com.cn ([163.53.93.251]:25907 "EHLO sender1.zoho.com.cn" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1731708AbfEXCHU (ORCPT ); Thu, 23 May 2019 22:07:20 -0400 ARC-Seal: i=1; a=rsa-sha256; t=1558663629; cv=none; d=zoho.com.cn; s=zohoarc; b=Vi3CK/7q2NJmaoE7M1durxoWtOk6MQT7owcQ0wr0HUk/wBIMoXcnDirXqB+BCN6VbaKmTKDEN4Y0g3PC2279X2ldmEWvSLHfyWXCrkjBnUVXeT1/QCafQI/m6wbVkO+jWuDcTmvhcy7LSVOUzOsb38/5Y6mzB7YinrVKOAKjm2s= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com.cn; s=zohoarc; t=1558663629; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:MIME-Version:Message-ID:Reply-To:References:Subject:To:ARC-Authentication-Results; bh=QYj9ny+JDgYrQsRWseOKBXd42kYLCGLL+fweYsgL83o=; b=g4J1Fz6z0VxAamNY5dBtVzpMThpL4lEG4p94xV0+AAdWLYFiNEAGVZ3dWXi6ivnQFQkQYIRAAU1UqQx4mHkfNBkvayLikbZS0+M9auW5rtIJ2VpmPFJtIFvOZ1Ac8I4VsBrmIJmtS9reKBP/jOmI+b5fbr3CjnauRGf/IqWsShQ= ARC-Authentication-Results: i=1; mx.zoho.com.cn; dkim=pass header.i=zoho.com.cn; spf=pass smtp.mailfrom=cgxu519@zoho.com.cn; dmarc=pass header.from= header.from= Received: from hades (218.18.229.179 [218.18.229.179]) by mx.zoho.com.cn with SMTPS id 1558663626468140.65912124378826; Fri, 24 May 2019 10:07:06 +0800 (CST) Message-ID: Subject: Re: [PATCH] ext2: optimize ext2_xattr_get() From: "cgxu519@zoho.com.cn" Reply-To: cgxu519@zoho.com.cn To: Jan Kara Cc: jack@suse.com, linux-ext4@vger.kernel.org Date: Fri, 24 May 2019 10:07:05 +0800 In-Reply-To: <20190523144612.GA18841@quack2.suse.cz> References: <20190521082140.19992-1-cgxu519@zoho.com.cn> <20190523144612.GA18841@quack2.suse.cz> Content-Type: text/plain; charset="UTF-8" User-Agent: Evolution 3.30.5 (3.30.5-1.fc29) MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-ZohoCNMailClient: External Sender: linux-ext4-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-ext4@vger.kernel.org On Thu, 2019-05-23 at 16:46 +0200, Jan Kara wrote: > On Tue 21-05-19 16:21:39, Chengguang Xu wrote: > > Since xattr entry names are sorted, we don't have > > to continue when current entry name is greater than > > target. > > > > Signed-off-by: Chengguang Xu > > Thanks for the patch! If we are going to do these comparisons in multiple > places, then please create a helper function to do the comparison (so that > we have the same comparison in every place). Something like: > > int ext2_xattr_cmp(int name_index, size_t name_len, const char *name, > struct ext2_xattr_entry *entry) > Hi Jan, Thanks for the review and advice. You are right we should introduce a helper to handle this part of work and personally I think maybe implementing a helper to find target entry will be more useful, do you think it makes sense? Thanks, Chengguang