From nobody Sun Feb 8 10:03:15 2026 Received: from SHSQR01.spreadtrum.com (mx1.unisoc.com [222.66.158.135]) (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 04883336ECB for ; Wed, 17 Dec 2025 07:46:55 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=222.66.158.135 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1765957620; cv=none; b=r7Jo+XXkE0WppBGv2HiQxn8Sw8WrsV66iFaA27483wBYir0JwxRaJ0YpEM2xAVVzoUSF+LAe+iEzv6MWzT7i4/aI6Cuqfk9Bi1kMHZQojOwKyNd/gGJQBvJJWXTpN7fIVDB3/UiNcLtAef/9bY6Sbv3o7G5xua9kXOY6Y/QpMZM= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1765957620; c=relaxed/simple; bh=Ch+L726kfbxNsj3DW+YzA8zFabnf6sKM7CnJBOMXebw=; h=From:To:CC:Subject:Date:Message-ID:MIME-Version:Content-Type; b=dyzmQ1pTriNLbhhKS/gSWXGL3A+Y6eYwN2Kx6pm1bm4ud0QJgnntd+VmrzPzH8718SZK1OZ1Hm4GxPUmLYaBLJsEv6Fg/vEwU/XhXuhIHK8SedA+ux9rnaJl/oRm0G8Zr9fmHPJudQJZd6liL+KPeMOTq/13mPlAjmFghuSoXsY= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=unisoc.com; spf=pass smtp.mailfrom=unisoc.com; dkim=pass (2048-bit key) header.d=unisoc.com header.i=@unisoc.com header.b=uRjHHEXR; arc=none smtp.client-ip=222.66.158.135 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=unisoc.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=unisoc.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=unisoc.com header.i=@unisoc.com header.b="uRjHHEXR" Received: from dlp.unisoc.com ([10.29.3.86]) by SHSQR01.spreadtrum.com with ESMTP id 5BH7k4Gw072027; Wed, 17 Dec 2025 15:46:04 +0800 (+08) (envelope-from Zhiguo.Niu@unisoc.com) Received: from SHDLP.spreadtrum.com (BJMBX02.spreadtrum.com [10.0.64.8]) by dlp.unisoc.com (SkyGuard) with ESMTPS id 4dWQj92mRcz2LGQlt; Wed, 17 Dec 2025 15:41:33 +0800 (CST) Received: from bj08434pcu.spreadtrum.com (10.0.73.87) by BJMBX02.spreadtrum.com (10.0.64.8) with Microsoft SMTP Server (TLS) id 15.0.1497.48; Wed, 17 Dec 2025 15:46:02 +0800 From: Zhiguo Niu To: , CC: , , , , , Subject: [PATCH] f2fs: remove some redundant codes in f2fs_quota_enable Date: Wed, 17 Dec 2025 15:45:29 +0800 Message-ID: <1765957529-4285-1-git-send-email-zhiguo.niu@unisoc.com> X-Mailer: git-send-email 1.9.1 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-ClientProxiedBy: SHCAS03.spreadtrum.com (10.0.1.207) To BJMBX02.spreadtrum.com (10.0.64.8) X-MAIL: SHSQR01.spreadtrum.com 5BH7k4Gw072027 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=unisoc.com; s=default; t=1765957572; bh=N2HTrVYim/QtAf4B2idR++dp72Ua8MMW9yOTDliLULU=; h=From:To:CC:Subject:Date; b=uRjHHEXRSV6uDnxtscfFmZ/sr3QZ8nBLSWKCORbbea/tEco6VBOCUuiyUj1vuLGEp nwIoePOxgTf0e0I0zf+2oNSP2nyEXAo8j09cFWfkYeYL9QgCuFNMXuyewr3UkNd+T9 lUyYtyfjqO/GSPZQ0ML0WVJhPJsln8sRwgWoXgHDBy/zYzQZ/m/VE64aq5mYjW8XNT H/RCq94pL2swFj3DJJnt48qQ2Utz6ryY2NfW1dUWktR1uFv41hV2YPAP24Nap3XVLV MbW5PFfbSazX7uz1/Oj9Nrj3+PMKcMlG/h5J9iHarIAzM2mx/7+KZUY84PikehDVqb o+uWhk4oqnl8g== Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" 1. qf_inum has been got and checked in its caller f2fs_enable_quotas 2. f2fs_sb_has_quota_ino has bee checked in its all callers 3. use sbi cleanup F2FS_SB(sb) Signed-off-by: Zhiguo Niu Reviewed-by: Chao Yu --- fs/f2fs/super.c | 16 ++++------------ 1 file changed, 4 insertions(+), 12 deletions(-) diff --git a/fs/f2fs/super.c b/fs/f2fs/super.c index c4c225e..036ba9c 100644 --- a/fs/f2fs/super.c +++ b/fs/f2fs/super.c @@ -3222,19 +3222,12 @@ int f2fs_enable_quota_files(struct f2fs_sb_info *sb= i, bool rdonly) } =20 static int f2fs_quota_enable(struct super_block *sb, int type, int format_= id, - unsigned int flags) + unsigned int flags, unsigned long qf_inum) { struct inode *qf_inode; - unsigned long qf_inum; unsigned long qf_flag =3D F2FS_QUOTA_DEFAULT_FL; int err; =20 - BUG_ON(!f2fs_sb_has_quota_ino(F2FS_SB(sb))); - - qf_inum =3D f2fs_qf_ino(sb, type); - if (!qf_inum) - return -EPERM; - qf_inode =3D f2fs_iget(sb, qf_inum); if (IS_ERR(qf_inode)) { f2fs_err(F2FS_SB(sb), "Bad quota inode %u:%lu", type, qf_inum); @@ -3267,7 +3260,7 @@ static int f2fs_enable_quotas(struct super_block *sb) test_opt(sbi, PRJQUOTA), }; =20 - if (is_set_ckpt_flags(F2FS_SB(sb), CP_QUOTA_NEED_FSCK_FLAG)) { + if (is_set_ckpt_flags(sbi, CP_QUOTA_NEED_FSCK_FLAG)) { f2fs_err(sbi, "quota file may be corrupted, skip loading it"); return 0; } @@ -3279,14 +3272,13 @@ static int f2fs_enable_quotas(struct super_block *s= b) if (qf_inum) { err =3D f2fs_quota_enable(sb, type, QFMT_VFS_V1, DQUOT_USAGE_ENABLED | - (quota_mopt[type] ? DQUOT_LIMITS_ENABLED : 0)); + (quota_mopt[type] ? DQUOT_LIMITS_ENABLED : 0), qf_inum); if (err) { f2fs_err(sbi, "Failed to enable quota tracking (type=3D%d, err=3D%d). = Please run fsck to fix.", type, err); for (type--; type >=3D 0; type--) dquot_quota_off(sb, type); - set_sbi_flag(F2FS_SB(sb), - SBI_QUOTA_NEED_REPAIR); + set_sbi_flag(sbi, SBI_QUOTA_NEED_REPAIR); return err; } } --=20 1.9.1