From nobody Sat Feb 7 21:23:51 2026 Received: from pdx-out-014.esa.us-west-2.outbound.mail-perimeter.amazon.com (pdx-out-014.esa.us-west-2.outbound.mail-perimeter.amazon.com [35.83.148.184]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 1531D3D5228; Wed, 21 Jan 2026 19:41:43 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=35.83.148.184 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1769024506; cv=none; b=i7glcch+CpZ8x0HhqAtCyZuZZhv2tGYmYxpbp5iw0ssJDyDeFU62ZlVQA7bHgU2nvU/2PY+7ji/sLUo8UQfZtbr2aH+UH+KTcfdbTrskgMqbv4Igd3ugmSPT3950lL7ay1Ps5XhTEQqNta9nHj/BucyzWfzhrD/aGBVz5IbZL70= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1769024506; c=relaxed/simple; bh=XOgwSnZJeK713yQMdMbALyRA+5GyjqZpxbGj3e6XiUk=; h=From:To:CC:Subject:Date:Message-ID:MIME-Version:Content-Type; b=axHhu2ssRteqwdD8dI45GFHaLLKRy38vKEZaonGWZIigc+avkeHMQ5SN4dJuXEPsNNclSvAuExOfboqHZX+tUN0ouVdiWyb6mdVAh1LzVSwUh2d27EqITebQgS+damb1g70fh6UyhyeDTv5GhXO7eKA021q8aMLxUIx9shEYCm0= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=amazon.com; spf=pass smtp.mailfrom=amazon.com; dkim=pass (2048-bit key) header.d=amazon.com header.i=@amazon.com header.b=tXPRry4m; arc=none smtp.client-ip=35.83.148.184 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=amazon.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=amazon.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=amazon.com header.i=@amazon.com header.b="tXPRry4m" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amazon.com; i=@amazon.com; q=dns/txt; s=amazoncorp2; t=1769024504; x=1800560504; h=from:to:cc:subject:date:message-id:mime-version: content-transfer-encoding; bh=NVBmq2PvfFfaooqrHPovx1jJmYeoNrtc1bzeNX7e6Oc=; b=tXPRry4mwFq4f9VWXssuvGxzNyrYn5nkaq1tjOhzLVkZoUnS4R63NW4s AS6g8C3QRbrzN05xtfC5V0vXBY2+bWnWQu6yiY3J0hzLg6956pqa9ftyB P9acg1seNmAHXgP2U2a5+i59mCZABA4gsbw3wA6389OF+h+GApYCQQZRV X4+ZFFV1sc9IifZs7hLSYric1eAecQeHhVCfiZpZDUtFXt/ZBoaQDBu6s mkPSXhEqW1eI0+CNZ/teUcgSBhedVk1w1T6deK93jsZL9TR1csr63ohgP gbiug442nZDWlCW/82AucmQvkMC0gVIGn803DyfYkozCjU2QNtBtKml9Y Q==; X-CSE-ConnectionGUID: WBmheypdQQOFbFS4+nMGzA== X-CSE-MsgGUID: zPStVyfpS5C3NZDr0NnFgA== X-IronPort-AV: E=Sophos;i="6.21,244,1763424000"; d="scan'208";a="11114008" Received: from ip-10-5-9-48.us-west-2.compute.internal (HELO smtpout.naws.us-west-2.prod.farcaster.email.amazon.dev) ([10.5.9.48]) by internal-pdx-out-014.esa.us-west-2.outbound.mail-perimeter.amazon.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 21 Jan 2026 19:41:40 +0000 Received: from EX19MTAUWC001.ant.amazon.com [205.251.233.105:8153] by smtpin.naws.us-west-2.prod.farcaster.email.amazon.dev [10.0.14.244:2525] with esmtp (Farcaster) id 2ef3123d-e002-4fe5-95cb-5ef8607876b8; Wed, 21 Jan 2026 19:41:40 +0000 (UTC) X-Farcaster-Flow-ID: 2ef3123d-e002-4fe5-95cb-5ef8607876b8 Received: from EX19D001UWA001.ant.amazon.com (10.13.138.214) by EX19MTAUWC001.ant.amazon.com (10.250.64.174) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA) id 15.2.2562.35; Wed, 21 Jan 2026 19:41:40 +0000 Received: from c889f3b07a0a.amazon.com (10.106.83.29) by EX19D001UWA001.ant.amazon.com (10.13.138.214) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA) id 15.2.2562.35; Wed, 21 Jan 2026 19:41:39 +0000 From: Yuto Ohnuki To: CC: , Yuto Ohnuki Subject: [PATCH] ufs: use fs_umode_to_dtype() for d_type table lookup Date: Wed, 21 Jan 2026 19:41:28 +0000 Message-ID: <20260121194128.61320-1-ytohnuki@amazon.com> X-Mailer: git-send-email 2.50.0 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-ClientProxiedBy: EX19D046UWA001.ant.amazon.com (10.13.139.112) To EX19D001UWA001.ant.amazon.com (10.13.138.214) Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Replace the switch statement in ufs_set_de_type() with fs_umode_to_dtype() as suggested by the TODO comment. This improves maintainability by using the helper function. No functional change intended. Signed-off-by: Yuto Ohnuki --- fs/ufs/util.h | 30 ++---------------------------- 1 file changed, 2 insertions(+), 28 deletions(-) diff --git a/fs/ufs/util.h b/fs/ufs/util.h index 391bb4f11d74..e03d768b982d 100644 --- a/fs/ufs/util.h +++ b/fs/ufs/util.h @@ -9,6 +9,7 @@ =20 #include #include +#include #include "swab.h" =20 /* @@ -152,34 +153,7 @@ ufs_set_de_type(struct super_block *sb, struct ufs_dir= _entry *de, int mode) if ((UFS_SB(sb)->s_flags & UFS_DE_MASK) !=3D UFS_DE_44BSD) return; =20 - /* - * TODO turn this into a table lookup - */ - switch (mode & S_IFMT) { - case S_IFSOCK: - de->d_u.d_44.d_type =3D DT_SOCK; - break; - case S_IFLNK: - de->d_u.d_44.d_type =3D DT_LNK; - break; - case S_IFREG: - de->d_u.d_44.d_type =3D DT_REG; - break; - case S_IFBLK: - de->d_u.d_44.d_type =3D DT_BLK; - break; - case S_IFDIR: - de->d_u.d_44.d_type =3D DT_DIR; - break; - case S_IFCHR: - de->d_u.d_44.d_type =3D DT_CHR; - break; - case S_IFIFO: - de->d_u.d_44.d_type =3D DT_FIFO; - break; - default: - de->d_u.d_44.d_type =3D DT_UNKNOWN; - } + de->d_u.d_44.d_type =3D fs_umode_to_dtype(mode); } =20 static inline u32 --=20 2.50.1 Amazon Web Services EMEA SARL, 38 avenue John F. Kennedy, L-1855 Luxembourg= , R.C.S. Luxembourg B186284 Amazon Web Services EMEA SARL, Irish Branch, One Burlington Plaza, Burlingt= on Road, Dublin 4, Ireland, branch registration number 908705