From patchwork Tue Dec 13 02:36:59 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Yuezhang.Mo@sony.com" X-Patchwork-Id: 13071668 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 6C782C00145 for ; Tue, 13 Dec 2022 02:38:31 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234382AbiLMCi1 (ORCPT ); Mon, 12 Dec 2022 21:38:27 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45550 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234193AbiLMCiC (ORCPT ); Mon, 12 Dec 2022 21:38:02 -0500 Received: from mx08-001d1705.pphosted.com (mx08-001d1705.pphosted.com [185.183.30.70]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 97F5B1E71A; Mon, 12 Dec 2022 18:37:15 -0800 (PST) Received: from pps.filterd (m0209322.ppops.net [127.0.0.1]) by mx08-001d1705.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 2BD1YF56012328; Tue, 13 Dec 2022 02:37:05 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sony.com; h=from : to : cc : subject : date : message-id : content-type : content-transfer-encoding : mime-version; s=S1; bh=RsWUC/zRObHxOPv1FlIyfmC6cM7JQtBg9nKz/ys/nhI=; b=niFKY06E1GJGkcqp289P1A32iG3N6xiTzUsHx1Kd5JfOiW1MNfTFaAs9ZK2ZmyNpu+TN i1xJrP4dX0o0fNO2hVr4Ov2l6U8NKP2PsKl87uBa6Xii1S9WzAAOgDJaBTYaTcGjz2VY J3H+rXN5zh5P6e4pZ+GeQofeXpYafy46LMalyNkddcrEABkmQ9o9+jpVDxkItWTyw8EU OJFLdJOq9LQHbj3b8Q87tlZD9lrXZj77ac/O230Obh34GAEulGNMhfsTnP3m4rWbnFTI b13O1PZ4BAw1Cjq3BNjByt09CgLoWHqCVxpDG6PCAmGwJwm5FBn7NMaYRZZ+Kjhhp1FY pg== Received: from apc01-tyz-obe.outbound.protection.outlook.com (mail-tyzapc01lp2047.outbound.protection.outlook.com [104.47.110.47]) by mx08-001d1705.pphosted.com (PPS) with ESMTPS id 3mcgw7th26-2 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 13 Dec 2022 02:37:05 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=C647pOu+Zt9x27LqMS3/PkkHOaxVTUWWlhM0bOIsfOj3YCM8ly6KEjHXV+6Pl7ziiDknEcbmnXBjBtlTMAnhddTZEdLC/Wg8gYcBhZ3VA5W3nH4TDA7rCD7v7Rdqnoz3tmZaPxF97uxPFQUtC1lB6WFicwg8IcqoVbX/ZgVSvCS5dX9oVMjNvtpXFviLgZF3CHylg4k0TyVppkQdkZSRlgcUhGIqcOtEFOPg1BQv/r+rkxqvgbRBGDOKWvQcryF+BSNhbiD1SPpzTKmiIdLzbz96srk1BmKGrqbJMFcoXwfuHClxc0eWpBf1418SHVSnaKUobHj5FWI9/Nm8dO7LCQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=RsWUC/zRObHxOPv1FlIyfmC6cM7JQtBg9nKz/ys/nhI=; b=CD9bYMM87tQuvmXDId/SOAz67odRjVmJGTE9k3lR6XJG/DuvcR5zy1AS+wjRofNTtlZx4O4x1+e6noy4peYn25kAXe9hZNbFqfocjuP4yPRa0MWtYTZv5SvLtUz8EZEuxO6vyD2+cKdac+A+8GTWrrLm7fC3a2K172DVgrUYvUICJY5X8ZYKScqzZ3IgzHSavXmIN9OpULfdPxmRpP2HO56YyZCLRdIEK6t5PHGvPEGc8aAxh1Fx56bYtRue9VDY1Hq0BPL6/ZEtRdcVz1ONu+suWNtsqFHZWVD94meM4iGGqZ95lhzeLRgwqBUhs9HDf6/zsC5+MvP3OMaoU5kC1A== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=sony.com; dmarc=pass action=none header.from=sony.com; dkim=pass header.d=sony.com; arc=none Received: from PUZPR04MB6316.apcprd04.prod.outlook.com (2603:1096:301:fc::7) by SEZPR04MB6948.apcprd04.prod.outlook.com (2603:1096:101:e1::10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5924.10; Tue, 13 Dec 2022 02:36:59 +0000 Received: from PUZPR04MB6316.apcprd04.prod.outlook.com ([fe80::c689:d665:b3a2:d4de]) by PUZPR04MB6316.apcprd04.prod.outlook.com ([fe80::c689:d665:b3a2:d4de%7]) with mapi id 15.20.5924.009; Tue, 13 Dec 2022 02:36:59 +0000 From: "Yuezhang.Mo@sony.com" To: "sj1557.seo@samsung.com" , "linkinjeon@kernel.org" CC: "linux-fsdevel@vger.kernel.org" , "linux-kernel@vger.kernel.org" , "Andy.Wu@sony.com" , "Wataru.Aoyama@sony.com" Subject: [PATCH v2 3/7] exfat: remove unnecessary arguments from exfat_find_dir_entry() Thread-Topic: [PATCH v2 3/7] exfat: remove unnecessary arguments from exfat_find_dir_entry() Thread-Index: AdkOmduhIQbmVfGOQoO6mEOmIBBoRg== Date: Tue, 13 Dec 2022 02:36:59 +0000 Message-ID: Accept-Language: zh-CN, en-US Content-Language: zh-CN X-MS-Has-Attach: X-MS-TNEF-Correlator: x-ms-publictraffictype: Email x-ms-traffictypediagnostic: PUZPR04MB6316:EE_|SEZPR04MB6948:EE_ x-ms-office365-filtering-correlation-id: 781109f2-7eb1-41cb-4ab1-08dadcb2e8d5 x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: NzYQNyXSBcYGgIJKihKtBrLhktBEn7lM08KIjNQYqH4hXRMkIn/aqWlYUtTlUNPxvts5BSYlq+r2aC4mjBhRmLQQRlUG20rxsAPgjDIUvn+C7H5rn32mj3ftAVXnxFdGsp6U5YwfbxwfQu4WSOyPLdIUanHm3eYowQjeBx/gDfwEKz9cSRUJUAIc5yXSjbmA5SWGbsWcTYdneKQnsI4uwnQ3RdQ1o9k54ItyVMBFoFwPALeX1qQwxCDvSSj8jVk6YFsr2lXc/4hLw04YkA7Mml3Cxd6R5FZ9eQ4TDcwRjjx8ahFtUCAJ/ZbReuSc7XKWF+VkND+lnQf3x7sY3CUTpOTnPXXKFkUrCp/F0l6qU0PwQA6/DqddVA7TPMA2mAkcZafElWA9gL+HnBRK5DXS7CLPhKWGfFgP1GT/X8/3RD8go7mus00itNz7MAozBKjZYPASn82i7cTmJp99C5pFVmvwbie4Nxg7v3tF3BrLREO9QxO8HI6kvx/iARKB3vNpgZa72+Ywfs1W4anLrlXlF/yLRtAcPVs4YP5I9uskAuccHRs3gBc1n9sxJXFZRf97i8WzEXLXQ1ubWuxmKbD6KKI1D1skHZjyPhSVoguanvCuS7XDPAkCnb1d5j9nof4+1weS/p6A4GCluj8arpdZfWomJ7K7tCh4e4pc1CgsoFRne07x2MBJC3XdDJnHg9aghpTL+lboa78zHoy1UI4iHg== x-forefront-antispam-report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:PUZPR04MB6316.apcprd04.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230022)(4636009)(39860400002)(376002)(136003)(366004)(346002)(396003)(451199015)(86362001)(82960400001)(38070700005)(2906002)(8936002)(4326008)(8676002)(66946007)(66476007)(66446008)(64756008)(66556008)(5660300002)(122000001)(38100700002)(33656002)(83380400001)(478600001)(110136005)(316002)(54906003)(71200400001)(76116006)(55016003)(52536014)(41300700001)(6506007)(7696005)(26005)(186003)(9686003)(107886003);DIR:OUT;SFP:1102; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?utf-8?q?A0rz7rAUv1lUbkCtbQ3CaOdw6wPv?= =?utf-8?q?RyS/6uwupjP4tGPOknvb9Zh2wmdtzPoBKoExTNnGlALZ5GrQDJzUzmEplkfonykg+?= =?utf-8?q?LZkU5EPgo2CCvbnzYZAxc7VWLz1eYnB2QUWfOH90kl2VRU4JSw+RNDduaG1wGTW3C?= =?utf-8?q?20NPkwgCqzvV3Swn8LzE57bhJobXfjMu+mV5X5uUi2FfP6oAGY3/8yxNeDhWC4yz5?= =?utf-8?q?d5VR2kxVC+f1xY91EUlcl7q1nJTfUCiclvNg9bO10YC6uBORikeWAA+DcVOI4o1uW?= =?utf-8?q?TgyCuQoayPluJNsDtC24PYnfRavDUIDaEdi+qq8atmfVGtDWUGezmWRpzGb1q4f+D?= =?utf-8?q?EGUAStXh+5y+U/tdVRDnm2pAO7HBzep17e7RWB1MYD/5t43vAObX3P0RsQHGNHKBL?= =?utf-8?q?EbwKxLrDFlFnENAIeaI0VP7uRlRLn+QwSkGpaC9eLwLa1jS7nbHthwWEy6xMFbQGh?= =?utf-8?q?uitWL/jJVMYOunRTO/oYGjwyVHADO4diEQEl/Oeo+K5WUYo39B0XQZZBR/juNLQVY?= =?utf-8?q?xOyWa6in+jef+/6aDv/g7MDKnlxh8g+IxF3wGoUZftR6PUzH7WTgPDcMt2j0a1l+e?= =?utf-8?q?fzgVbiazC3ryy3+NrGfe81TFDtjdzEtckiuKVYUXYstDj8srViR0XECvGFbkVb2X+?= =?utf-8?q?MsARXhSw6olZNLB7bWhaI4AkE3sJPdV6kmHhTqv89uO9HOz4EgTr1Q+yBWZoqpBon?= =?utf-8?q?+nuhdFQYexzodTHCDKTgjCfWoqFxMIDd6oM4CDOz95/huX9cKgo3A1UwRlKl+gENM?= =?utf-8?q?Vhl248J4ZiebnFZG6hCnikB4buU7cwff8nQHj7OKYmhXxK2kL4p6QVXsJOTdCraSO?= =?utf-8?q?rDKu5jzaKa/D2E9i0A6frxSjnLdEHQ51CY/1kv3rzEirV3HXngShn9wcSk7HpCZGT?= =?utf-8?q?wI4VrEi0X3+Je13EGQPqIY1c4G0AWhu+XDUhVq7hAlfpk/utjPAiyD4kGuPjC5xgw?= =?utf-8?q?UmMYq66h/BkpoUWcKsWxmjvMyZOWa+YD55hW+5ZIghTRA1QOduIRpGWy2mRzO8+fL?= =?utf-8?q?NNk4ZdkMNvbxYY4Mgb8dlxDp0Cp+rZcj+rs1OQiJszZ9EFrht7fNPNhAS9zvp1avI?= =?utf-8?q?HVBw+QvpHKin1I4Sx74P/1CAFiauMX9598ze5xGjnOtwyH5D6rlScIqrwyyT6+7Nw?= =?utf-8?q?24+vXLghcIx01qQCbAbugSIE+QT88NX2KIdRzv6Iz0VrFeCLEOSuaj2DnxX4+HO7O?= =?utf-8?q?H2DejHZyyf1ps6TomIfTzAK+Ie3p47oyQuILPSQPwAOJldWQJcMPkdJV470OiuDlY?= =?utf-8?q?+0R8aynWzF13rxrBygwMImSRnpFmkn+9gNO2xhBQeq4YqHsewrLQoGnvh2nwn6D31?= =?utf-8?q?up3IO2QaBW3aVu/Hg3BgNVw7z6qdNZpdTK7EYZyXBzAqwLsiCIHS6o6ItWcsU6lWn?= =?utf-8?q?W4rVF4jl5xsH6/SBhgVtRlsFjLrUOp+DUEyO2UxZeiEnjNkau8xjGt6N+x7sUEBCM?= =?utf-8?q?38UpE0FbA+zkNtFG5KhRsS8fzyVdLwHFzADRHXjR9mPUkJvh1pPAQp0mo4dKnNix/?= =?utf-8?q?+xBcIqZyJG5l?= MIME-Version: 1.0 X-OriginatorOrg: sony.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: PUZPR04MB6316.apcprd04.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 781109f2-7eb1-41cb-4ab1-08dadcb2e8d5 X-MS-Exchange-CrossTenant-originalarrivaltime: 13 Dec 2022 02:36:59.4615 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 66c65d8a-9158-4521-a2d8-664963db48e4 X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: 4IPrWCD8JbcIW3J1B+ZWPiWQsxOf1MIeIswAqt1O3AAA6mCuyYLt0IJB1WHSxcVS787OPXpqCO9KUN6yAxOHJw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: SEZPR04MB6948 X-Proofpoint-ORIG-GUID: y-3SaFqLa4hnE3K0r3K6T1McdrWNpHih X-Proofpoint-GUID: y-3SaFqLa4hnE3K0r3K6T1McdrWNpHih X-Sony-Outbound-GUID: y-3SaFqLa4hnE3K0r3K6T1McdrWNpHih X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.205,Aquarius:18.0.923,Hydra:6.0.545,FMLib:17.11.122.1 definitions=2022-12-12_02,2022-12-12_02,2022-06-22_01 Precedence: bulk List-ID: X-Mailing-List: linux-fsdevel@vger.kernel.org This commit removes argument 'num_entries' and 'type' from exfat_find_dir_entry(). Code refinement, no functional changes. Signed-off-by: Yuezhang Mo Reviewed-by: Andy Wu Reviewed-by: Aoyama Wataru --- fs/exfat/dir.c | 12 +++++++----- fs/exfat/exfat_fs.h | 3 +-- fs/exfat/namei.c | 10 ++-------- 3 files changed, 10 insertions(+), 15 deletions(-) diff --git a/fs/exfat/dir.c b/fs/exfat/dir.c index 397ea2d98848..8121a7e073bc 100644 --- a/fs/exfat/dir.c +++ b/fs/exfat/dir.c @@ -956,7 +956,7 @@ enum { */ int exfat_find_dir_entry(struct super_block *sb, struct exfat_inode_info *ei, struct exfat_chain *p_dir, struct exfat_uni_name *p_uniname, - int num_entries, unsigned int type, struct exfat_hint *hint_opt) + struct exfat_hint *hint_opt) { int i, rewind = 0, dentry = 0, end_eidx = 0, num_ext = 0, len; int order, step, name_len = 0; @@ -967,6 +967,10 @@ int exfat_find_dir_entry(struct super_block *sb, struct exfat_inode_info *ei, struct exfat_hint *hint_stat = &ei->hint_stat; struct exfat_hint_femp candi_empty; struct exfat_sb_info *sbi = EXFAT_SB(sb); + int num_entries = exfat_calc_num_entries(p_uniname); + + if (num_entries < 0) + return num_entries; dentries_per_clu = sbi->dentries_per_clu; @@ -1020,10 +1024,8 @@ int exfat_find_dir_entry(struct super_block *sb, struct exfat_inode_info *ei, step = DIRENT_STEP_FILE; hint_opt->clu = clu.dir; hint_opt->eidx = i; - if (type == TYPE_ALL || type == entry_type) { - num_ext = ep->dentry.file.num_ext; - step = DIRENT_STEP_STRM; - } + num_ext = ep->dentry.file.num_ext; + step = DIRENT_STEP_STRM; brelse(bh); continue; } diff --git a/fs/exfat/exfat_fs.h b/fs/exfat/exfat_fs.h index 37e8af8042aa..21fec01d68ff 100644 --- a/fs/exfat/exfat_fs.h +++ b/fs/exfat/exfat_fs.h @@ -71,7 +71,6 @@ enum { #define TYPE_PADDING 0x0402 #define TYPE_ACLTAB 0x0403 #define TYPE_BENIGN_SEC 0x0800 -#define TYPE_ALL 0x0FFF #define MAX_CHARSET_SIZE 6 /* max size of multi-byte character */ #define MAX_NAME_LENGTH 255 /* max len of file name excluding NULL */ @@ -490,7 +489,7 @@ void exfat_update_dir_chksum_with_entry_set(struct exfat_entry_set_cache *es); int exfat_calc_num_entries(struct exfat_uni_name *p_uniname); int exfat_find_dir_entry(struct super_block *sb, struct exfat_inode_info *ei, struct exfat_chain *p_dir, struct exfat_uni_name *p_uniname, - int num_entries, unsigned int type, struct exfat_hint *hint_opt); + struct exfat_hint *hint_opt); int exfat_alloc_new_dir(struct inode *inode, struct exfat_chain *clu); struct exfat_dentry *exfat_get_dentry(struct super_block *sb, struct exfat_chain *p_dir, int entry, struct buffer_head **bh); diff --git a/fs/exfat/namei.c b/fs/exfat/namei.c index 347c8df45bd0..5f995eba5dbb 100644 --- a/fs/exfat/namei.c +++ b/fs/exfat/namei.c @@ -597,7 +597,7 @@ static int exfat_create(struct user_namespace *mnt_userns, struct inode *dir, static int exfat_find(struct inode *dir, struct qstr *qname, struct exfat_dir_entry *info) { - int ret, dentry, num_entries, count; + int ret, dentry, count; struct exfat_chain cdir; struct exfat_uni_name uni_name; struct super_block *sb = dir->i_sb; @@ -616,10 +616,6 @@ static int exfat_find(struct inode *dir, struct qstr *qname, if (ret) return ret; - num_entries = exfat_calc_num_entries(&uni_name); - if (num_entries < 0) - return num_entries; - /* check the validation of hint_stat and initialize it if required */ if (ei->version != (inode_peek_iversion_raw(dir) & 0xffffffff)) { ei->hint_stat.clu = cdir.dir; @@ -629,9 +625,7 @@ static int exfat_find(struct inode *dir, struct qstr *qname, } /* search the file name for directories */ - dentry = exfat_find_dir_entry(sb, ei, &cdir, &uni_name, - num_entries, TYPE_ALL, &hint_opt); - + dentry = exfat_find_dir_entry(sb, ei, &cdir, &uni_name, &hint_opt); if (dentry < 0) return dentry; /* -error value */