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 Received: from lists.sourceforge.net (lists.sourceforge.net [216.105.38.7]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id E6B36ECAAD8 for ; Tue, 13 Sep 2022 23:59:26 +0000 (UTC) Received: from [127.0.0.1] (helo=sfs-ml-1.v29.lw.sourceforge.com) by sfs-ml-1.v29.lw.sourceforge.com with esmtp (Exim 4.95) (envelope-from ) id 1oYFoL-0006P9-W0; Tue, 13 Sep 2022 23:59:25 +0000 Received: from [172.30.20.202] (helo=mx.sourceforge.net) by sfs-ml-1.v29.lw.sourceforge.com with esmtps (TLS1.2) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.95) (envelope-from ) id 1oYFoC-0006OE-F1 for linux-f2fs-devel@lists.sourceforge.net; Tue, 13 Sep 2022 23:59:16 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=sourceforge.net; s=x; h=Content-Transfer-Encoding:MIME-Version:References: In-Reply-To:Message-Id:Date:Subject:Cc:To:From:Sender:Reply-To:Content-Type: Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender: Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=WN1MVYblJJtt2Jw6bEwScxP1wBJkEi33gbgDw95Hv5g=; b=Z35VB0cGdGMu5yy2MmeCZTjIih uyoOSla6sbsjeuBFv+6XqP+3Q2eKduBfBihnH//hplVVeo7Gh/2edF/NuhpbzVoxq2UxpcTWvFAYa yivvBz9IjcJpaddvWCaUBaSxd8kMvF9ScMyG0IFR5SWofaULRv3/00jFiWfELbiQ6Wec=; DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=sf.net; s=x ; h=Content-Transfer-Encoding:MIME-Version:References:In-Reply-To:Message-Id: Date:Subject:Cc:To:From:Sender:Reply-To:Content-Type:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Id:List-Help:List-Unsubscribe:List-Subscribe: List-Post:List-Owner:List-Archive; bh=WN1MVYblJJtt2Jw6bEwScxP1wBJkEi33gbgDw95Hv5g=; b=jR2BFpGtoriAvdbZDRcHrFy07t Bn1sZd1puP5q3vu+wWTFl2i8vSgtvmWq+WbFyNRkfiwzFpDzAzq0HiZvFJsQPjpT4Y+UmHvF1/5g8 sYqX1gtmKsAcfw92/frE7VVBowclTZ4n3yU5DlqTtaSxvx9S9SWdXSxzHGoR9lFWL6Uw=; Received: from madras.collabora.co.uk ([46.235.227.172]) by sfi-mx-2.v28.lw.sourceforge.com with esmtps (TLS1.2:ECDHE-RSA-AES256-GCM-SHA384:256) (Exim 4.95) id 1oYFo8-00035P-5V for linux-f2fs-devel@lists.sourceforge.net; Tue, 13 Sep 2022 23:59:16 +0000 Received: from localhost (modemcable141.102-20-96.mc.videotron.ca [96.20.102.141]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) (Authenticated sender: krisman) by madras.collabora.co.uk (Postfix) with ESMTPSA id 80A556602006; Wed, 14 Sep 2022 00:42:03 +0100 (BST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=collabora.com; s=mail; t=1663112523; bh=jf9T5L6PRNHlcb48D47of+kLT0Zw6OxWvEXKI5LNRlI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Xkxp3dGo9fciEHhCGMCoZWDcyp99eh0tfAgS0N4L2t2H+wCg5sMo693fivSMDKnDk 5CGMgcfarak2vCLnLvD/DElWKQAM++HCu0yOx1Xzaa6ZsSoEB94YGxGdDx4Ujd+dak jbJ6hW+vfLG+S79UP3k4C0eqLiAESxmQ+XBjllztEbmTdJtvorvitLJskVK0z6V7I5 uda8Dx5Bm/vzNdSEQuBJgF8D9hc3dVxqV7qZKRrCd8VkhL6mM6JViEpo7oSNnqKzF8 43EXmSZFD4reZQ9md0aAtYpkEIfEVxaM/2ZbXNvj1HBnqajguETnOb3bOXoKTcT9D9 X0OASbnNGyBfw== From: Gabriel Krisman Bertazi To: tytso@mit.edu, adilger.kernel@dilger.ca, jaegeuk@kernel.org, ebiggers@kernel.org Date: Tue, 13 Sep 2022 19:41:43 -0400 Message-Id: <20220913234150.513075-2-krisman@collabora.com> X-Mailer: git-send-email 2.37.3 In-Reply-To: <20220913234150.513075-1-krisman@collabora.com> References: <20220913234150.513075-1-krisman@collabora.com> MIME-Version: 1.0 X-Headers-End: 1oYFo8-00035P-5V Subject: [f2fs-dev] [PATCH v9 1/8] ext4: Simplify the handling of cached insensitive names X-BeenThere: linux-f2fs-devel@lists.sourceforge.net X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: linux-ext4@vger.kernel.org, Gabriel Krisman Bertazi , kernel@collabora.com, Eric Biggers , linux-f2fs-devel@lists.sourceforge.net Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: linux-f2fs-devel-bounces@lists.sourceforge.net Keeping it as qstr avoids the unnecessary conversion in ext4_match Reviewed-by: Eric Biggers Signed-off-by: Gabriel Krisman Bertazi --- Changes since v1: - Simplify hunk (eric) --- fs/ext4/ext4.h | 2 +- fs/ext4/namei.c | 23 +++++++++++------------ 2 files changed, 12 insertions(+), 13 deletions(-) diff --git a/fs/ext4/ext4.h b/fs/ext4/ext4.h index 9bca5565547b..9717b9832425 100644 --- a/fs/ext4/ext4.h +++ b/fs/ext4/ext4.h @@ -2497,7 +2497,7 @@ struct ext4_filename { struct fscrypt_str crypto_buf; #endif #if IS_ENABLED(CONFIG_UNICODE) - struct fscrypt_str cf_name; + struct qstr cf_name; #endif }; diff --git a/fs/ext4/namei.c b/fs/ext4/namei.c index 3a31b662f661..089ea8b42a1e 100644 --- a/fs/ext4/namei.c +++ b/fs/ext4/namei.c @@ -1419,7 +1419,8 @@ static int ext4_ci_compare(const struct inode *parent, const struct qstr *name, int ext4_fname_setup_ci_filename(struct inode *dir, const struct qstr *iname, struct ext4_filename *name) { - struct fscrypt_str *cf_name = &name->cf_name; + struct qstr *cf_name = &name->cf_name; + unsigned char *buf; struct dx_hash_info *hinfo = &name->hinfo; int len; @@ -1429,18 +1430,18 @@ int ext4_fname_setup_ci_filename(struct inode *dir, const struct qstr *iname, return 0; } - cf_name->name = kmalloc(EXT4_NAME_LEN, GFP_NOFS); - if (!cf_name->name) + buf = kmalloc(EXT4_NAME_LEN, GFP_NOFS); + if (!buf) return -ENOMEM; - len = utf8_casefold(dir->i_sb->s_encoding, - iname, cf_name->name, - EXT4_NAME_LEN); + len = utf8_casefold(dir->i_sb->s_encoding, iname, buf, EXT4_NAME_LEN); if (len <= 0) { - kfree(cf_name->name); - cf_name->name = NULL; + kfree(buf); + buf = NULL; } + cf_name->name = buf; cf_name->len = (unsigned) len; + if (!IS_ENCRYPTED(dir)) return 0; @@ -1478,8 +1479,6 @@ static bool ext4_match(struct inode *parent, if (parent->i_sb->s_encoding && IS_CASEFOLDED(parent) && (!IS_ENCRYPTED(parent) || fscrypt_has_encryption_key(parent))) { if (fname->cf_name.name) { - struct qstr cf = {.name = fname->cf_name.name, - .len = fname->cf_name.len}; if (IS_ENCRYPTED(parent)) { if (fname->hinfo.hash != EXT4_DIRENT_HASH(de) || fname->hinfo.minor_hash != @@ -1488,8 +1487,8 @@ static bool ext4_match(struct inode *parent, return false; } } - return !ext4_ci_compare(parent, &cf, de->name, - de->name_len, true); + return !ext4_ci_compare(parent, &fname->cf_name, + de->name, de->name_len, true); } return !ext4_ci_compare(parent, fname->usr_fname, de->name, de->name_len, false); -- 2.37.3 _______________________________________________ Linux-f2fs-devel mailing list Linux-f2fs-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel