From patchwork Thu Jul 21 13:16:33 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Miaohe Lin X-Patchwork-Id: 12925104 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 kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id E6BCAC43334 for ; Thu, 21 Jul 2022 13:16:54 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 6A3E68E0006; Thu, 21 Jul 2022 09:16:54 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 68CE68E000A; Thu, 21 Jul 2022 09:16:54 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 52CB98E0006; Thu, 21 Jul 2022 09:16:54 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0015.hostedemail.com [216.40.44.15]) by kanga.kvack.org (Postfix) with ESMTP id 466288E0001 for ; Thu, 21 Jul 2022 09:16:54 -0400 (EDT) Received: from smtpin19.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay08.hostedemail.com (Postfix) with ESMTP id 177B1140904 for ; Thu, 21 Jul 2022 13:16:54 +0000 (UTC) X-FDA: 79711157148.19.7DE8443 Received: from szxga03-in.huawei.com (szxga03-in.huawei.com [45.249.212.189]) by imf19.hostedemail.com (Postfix) with ESMTP id 0FD8C1A0020 for ; Thu, 21 Jul 2022 13:16:52 +0000 (UTC) Received: from canpemm500002.china.huawei.com (unknown [172.30.72.53]) by szxga03-in.huawei.com (SkyGuard) with ESMTP id 4LpY3P5bhQzGpB1; Thu, 21 Jul 2022 21:15:45 +0800 (CST) Received: from huawei.com (10.175.124.27) by canpemm500002.china.huawei.com (7.192.104.244) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.24; Thu, 21 Jul 2022 21:16:49 +0800 From: Miaohe Lin To: , , CC: , , Subject: [PATCH 1/5] hugetlbfs: use helper macro SZ_1{K,M} Date: Thu, 21 Jul 2022 21:16:33 +0800 Message-ID: <20220721131637.6306-2-linmiaohe@huawei.com> X-Mailer: git-send-email 2.23.0 In-Reply-To: <20220721131637.6306-1-linmiaohe@huawei.com> References: <20220721131637.6306-1-linmiaohe@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.175.124.27] X-ClientProxiedBy: dggems703-chm.china.huawei.com (10.3.19.180) To canpemm500002.china.huawei.com (7.192.104.244) X-CFilter-Loop: Reflected ARC-Authentication-Results: i=1; imf19.hostedemail.com; dkim=none; dmarc=pass (policy=quarantine) header.from=huawei.com; spf=pass (imf19.hostedemail.com: domain of linmiaohe@huawei.com designates 45.249.212.189 as permitted sender) smtp.mailfrom=linmiaohe@huawei.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1658409413; a=rsa-sha256; cv=none; b=zgk2HukT5KwPGXrhvUI9RCO8emTJZ8cC2Bvg2grZXC79kjCuQJ9WHG19s53GVog1WLBzDL 9faQzkosOIc48pE+QOB0Nvk4Sra1en/Fawenc+EP1Sg/dwcmSHr2uDcd3SRLiuPg5WPuJP ggFynTQ4ej2CV0AQiXoi55WmAJu6/ec= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1658409413; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=kn70LfoaoQVCS1gdGpO3t59LOsjCh4HKNqCKQRHWEN4=; b=RuGSOy5HNpzfPOCxc6twZhaqjJsc++/Qr7087+yaV9qeIijcv14nvnWo0Wo8SN+5AZU/Ad dFl+PrHt8S2Q2Urd6ANl8u1Z2q0wtL2yKdIzO13phgDG2h5kzz/HUQELpEMXd+SxKvj+CP 0G3GHUNLLXs5KSMepmnQwFH9QZw2aCA= Authentication-Results: imf19.hostedemail.com; dkim=none; dmarc=pass (policy=quarantine) header.from=huawei.com; spf=pass (imf19.hostedemail.com: domain of linmiaohe@huawei.com designates 45.249.212.189 as permitted sender) smtp.mailfrom=linmiaohe@huawei.com X-Rspam-User: X-Rspamd-Server: rspam01 X-Stat-Signature: rh9qm15g1wozn3mmdghzomfjpm1rs1or X-Rspamd-Queue-Id: 0FD8C1A0020 X-HE-Tag: 1658409412-172701 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: Use helper macro SZ_1K and SZ_1M to do the size conversion. Minor readability improvement. Signed-off-by: Miaohe Lin Reviewed-by: Mike Kravetz --- fs/hugetlbfs/inode.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/fs/hugetlbfs/inode.c b/fs/hugetlbfs/inode.c index 20336cb3c040..e998c416b85f 100644 --- a/fs/hugetlbfs/inode.c +++ b/fs/hugetlbfs/inode.c @@ -1309,7 +1309,7 @@ static int hugetlbfs_parse_param(struct fs_context *fc, struct fs_parameter *par ps = memparse(param->string, &rest); ctx->hstate = size_to_hstate(ps); if (!ctx->hstate) { - pr_err("Unsupported page size %lu MB\n", ps >> 20); + pr_err("Unsupported page size %lu MB\n", ps / SZ_1M); return -EINVAL; } return 0; @@ -1555,7 +1555,7 @@ static struct vfsmount *__init mount_one_hugetlbfs(struct hstate *h) } if (IS_ERR(mnt)) pr_err("Cannot mount internal hugetlbfs for page size %luK", - huge_page_size(h) >> 10); + huge_page_size(h) / SZ_1K); return mnt; } From patchwork Thu Jul 21 13:16:34 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Miaohe Lin X-Patchwork-Id: 12925108 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 kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 38947C433EF for ; Thu, 21 Jul 2022 13:17:01 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id A10F38E000D; Thu, 21 Jul 2022 09:16:55 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 9C1508E000E; Thu, 21 Jul 2022 09:16:55 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 7C54C8E0001; Thu, 21 Jul 2022 09:16:55 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0013.hostedemail.com [216.40.44.13]) by kanga.kvack.org (Postfix) with ESMTP id 622A08E000D for ; Thu, 21 Jul 2022 09:16:55 -0400 (EDT) Received: from smtpin16.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay06.hostedemail.com (Postfix) with ESMTP id 34289AB21F for ; Thu, 21 Jul 2022 13:16:55 +0000 (UTC) X-FDA: 79711157190.16.E1182DD Received: from szxga02-in.huawei.com (szxga02-in.huawei.com [45.249.212.188]) by imf17.hostedemail.com (Postfix) with ESMTP id 54436400A1 for ; Thu, 21 Jul 2022 13:16:53 +0000 (UTC) Received: from canpemm500002.china.huawei.com (unknown [172.30.72.57]) by szxga02-in.huawei.com (SkyGuard) with ESMTP id 4LpY1t1P70zkXG5; Thu, 21 Jul 2022 21:14:26 +0800 (CST) Received: from huawei.com (10.175.124.27) by canpemm500002.china.huawei.com (7.192.104.244) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.24; Thu, 21 Jul 2022 21:16:49 +0800 From: Miaohe Lin To: , , CC: , , Subject: [PATCH 2/5] hugetlbfs: remove unneeded hugetlbfs_ops forward declaration Date: Thu, 21 Jul 2022 21:16:34 +0800 Message-ID: <20220721131637.6306-3-linmiaohe@huawei.com> X-Mailer: git-send-email 2.23.0 In-Reply-To: <20220721131637.6306-1-linmiaohe@huawei.com> References: <20220721131637.6306-1-linmiaohe@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.175.124.27] X-ClientProxiedBy: dggems703-chm.china.huawei.com (10.3.19.180) To canpemm500002.china.huawei.com (7.192.104.244) X-CFilter-Loop: Reflected ARC-Authentication-Results: i=1; imf17.hostedemail.com; dkim=none; dmarc=pass (policy=quarantine) header.from=huawei.com; spf=pass (imf17.hostedemail.com: domain of linmiaohe@huawei.com designates 45.249.212.188 as permitted sender) smtp.mailfrom=linmiaohe@huawei.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1658409413; a=rsa-sha256; cv=none; b=sMdxrZWaVBuQPnu4U2JUrnNxzB0JqLm1jchCkEfKBk3FSdmaj47dTyAAmV3D/PbsVmNNBG ExRVxijw1bJSIyxObu4cMyX7uKhgaov3fnuwXwiJemUrdFIstnlbfB+EW31x8/gxLfx+HO l+K4cc1w290CjY5iNAvQXoD913xf6Xo= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1658409413; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=maquh9EDDYoYvITFl33TfvanP1Wn7igS/aW6AbUVNFM=; b=CAajNXdcym401PuZtRpdcFPJBCIaqquRlkiU6L1Gu+CDy9VvaQ3JVeobWeYVCWzmXkt/fX M6qVtffbbqzo2aN6IWsDkPSSzbwiIszeL9Qd4RPgG8ppNvS4MC5pWXMRw0m76UcvQYTNGU ZonMAyL+8+e9Gvz42IswXCPThkX9/IE= Authentication-Results: imf17.hostedemail.com; dkim=none; dmarc=pass (policy=quarantine) header.from=huawei.com; spf=pass (imf17.hostedemail.com: domain of linmiaohe@huawei.com designates 45.249.212.188 as permitted sender) smtp.mailfrom=linmiaohe@huawei.com X-Rspam-User: X-Rspamd-Server: rspam01 X-Stat-Signature: yz86cdt5gim4c9e81p6eh9peakhhsbbm X-Rspamd-Queue-Id: 54436400A1 X-HE-Tag: 1658409413-128178 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: The forward declaration for hugetlbfs_ops is unnecessary. Remove it. Signed-off-by: Miaohe Lin Reviewed-by: Mike Kravetz --- fs/hugetlbfs/inode.c | 1 - 1 file changed, 1 deletion(-) diff --git a/fs/hugetlbfs/inode.c b/fs/hugetlbfs/inode.c index e998c416b85f..a10156df5726 100644 --- a/fs/hugetlbfs/inode.c +++ b/fs/hugetlbfs/inode.c @@ -40,7 +40,6 @@ #include #include -static const struct super_operations hugetlbfs_ops; static const struct address_space_operations hugetlbfs_aops; const struct file_operations hugetlbfs_file_operations; static const struct inode_operations hugetlbfs_dir_inode_operations; From patchwork Thu Jul 21 13:16:35 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Miaohe Lin X-Patchwork-Id: 12925105 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 kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id D35D4C433EF for ; Thu, 21 Jul 2022 13:16:55 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id A18468E000B; Thu, 21 Jul 2022 09:16:54 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 9E6BC8E000A; Thu, 21 Jul 2022 09:16:54 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 75B688E000B; Thu, 21 Jul 2022 09:16:54 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0010.hostedemail.com [216.40.44.10]) by kanga.kvack.org (Postfix) with ESMTP id 5EE118E0001 for ; Thu, 21 Jul 2022 09:16:54 -0400 (EDT) Received: from smtpin04.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay01.hostedemail.com (Postfix) with ESMTP id 2DD991C5BBC for ; Thu, 21 Jul 2022 13:16:54 +0000 (UTC) X-FDA: 79711157148.04.061F8EB Received: from szxga01-in.huawei.com (szxga01-in.huawei.com [45.249.212.187]) by imf12.hostedemail.com (Postfix) with ESMTP id 4E41C400A2 for ; Thu, 21 Jul 2022 13:16:53 +0000 (UTC) Received: from canpemm500002.china.huawei.com (unknown [172.30.72.56]) by szxga01-in.huawei.com (SkyGuard) with ESMTP id 4LpY2g37q8zmV8d; Thu, 21 Jul 2022 21:15:07 +0800 (CST) Received: from huawei.com (10.175.124.27) by canpemm500002.china.huawei.com (7.192.104.244) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.24; Thu, 21 Jul 2022 21:16:50 +0800 From: Miaohe Lin To: , , CC: , , Subject: [PATCH 3/5] hugetlbfs: remove unneeded header file Date: Thu, 21 Jul 2022 21:16:35 +0800 Message-ID: <20220721131637.6306-4-linmiaohe@huawei.com> X-Mailer: git-send-email 2.23.0 In-Reply-To: <20220721131637.6306-1-linmiaohe@huawei.com> References: <20220721131637.6306-1-linmiaohe@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.175.124.27] X-ClientProxiedBy: dggems703-chm.china.huawei.com (10.3.19.180) To canpemm500002.china.huawei.com (7.192.104.244) X-CFilter-Loop: Reflected ARC-Authentication-Results: i=1; imf12.hostedemail.com; dkim=none; dmarc=pass (policy=quarantine) header.from=huawei.com; spf=pass (imf12.hostedemail.com: domain of linmiaohe@huawei.com designates 45.249.212.187 as permitted sender) smtp.mailfrom=linmiaohe@huawei.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1658409413; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=Er5xS8p+gIT+LJVbKK7uehcjGMO1Tscwu42qGcWJcKk=; b=hI7Obr7da06lMJc2Flebmu/BI71ikY68z7SGd3wm3RxlaI6SFJzbwCwYpUtpdScudW4EMX bonkFWR+Zof1ANcWO5+VNMcc4rRQdCACj138qrbxRysWosnA/MSsiTi/5owhX2NtH9Piob xvbdEA7Q8kEuphNcnD2kAO9pEHGxyiI= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1658409413; a=rsa-sha256; cv=none; b=7BhygdUgk22Bh7N0fPzyuEy+tqdiWfafrRCjKhLUipljvLNtmQYHJ6hOELs+C8hSQz7DBJ yZHH8YIpMka8S5/eiwvbhOwe5t1tro8SCmkP+3REbbcn+Wf5+gKsuYa7VrIaZ0MqqrInW5 exd/3y4yLPjHcWfH2E99mXw1ORpIgXI= X-Rspamd-Queue-Id: 4E41C400A2 Authentication-Results: imf12.hostedemail.com; dkim=none; dmarc=pass (policy=quarantine) header.from=huawei.com; spf=pass (imf12.hostedemail.com: domain of linmiaohe@huawei.com designates 45.249.212.187 as permitted sender) smtp.mailfrom=linmiaohe@huawei.com X-Rspam-User: X-Rspamd-Server: rspam03 X-Stat-Signature: k6ja5ds3fbwp1jjj7gayawfcuq48youw X-HE-Tag: 1658409413-723772 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: The header file signal.h is unneeded now. Remove it. Signed-off-by: Miaohe Lin Reviewed-by: Mike Kravetz --- fs/hugetlbfs/inode.c | 1 - 1 file changed, 1 deletion(-) diff --git a/fs/hugetlbfs/inode.c b/fs/hugetlbfs/inode.c index a10156df5726..aa7a5b8fc724 100644 --- a/fs/hugetlbfs/inode.c +++ b/fs/hugetlbfs/inode.c @@ -11,7 +11,6 @@ #include #include -#include /* remove ASAP */ #include #include #include From patchwork Thu Jul 21 13:16:36 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Miaohe Lin X-Patchwork-Id: 12925107 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 kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 617D1C43334 for ; Thu, 21 Jul 2022 13:16:59 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 3617D8E000C; Thu, 21 Jul 2022 09:16:55 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 2E2908E0001; Thu, 21 Jul 2022 09:16:55 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 1A9F38E000C; Thu, 21 Jul 2022 09:16:55 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0017.hostedemail.com [216.40.44.17]) by kanga.kvack.org (Postfix) with ESMTP id 0B1248E0001 for ; Thu, 21 Jul 2022 09:16:55 -0400 (EDT) Received: from smtpin26.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay03.hostedemail.com (Postfix) with ESMTP id DD65FA0934 for ; Thu, 21 Jul 2022 13:16:54 +0000 (UTC) X-FDA: 79711157148.26.3D155A0 Received: from szxga02-in.huawei.com (szxga02-in.huawei.com [45.249.212.188]) by imf02.hostedemail.com (Postfix) with ESMTP id 3ECB580068 for ; Thu, 21 Jul 2022 13:16:54 +0000 (UTC) Received: from canpemm500002.china.huawei.com (unknown [172.30.72.55]) by szxga02-in.huawei.com (SkyGuard) with ESMTP id 4LpY1v10yQzkXGY; Thu, 21 Jul 2022 21:14:27 +0800 (CST) Received: from huawei.com (10.175.124.27) by canpemm500002.china.huawei.com (7.192.104.244) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.24; Thu, 21 Jul 2022 21:16:50 +0800 From: Miaohe Lin To: , , CC: , , Subject: [PATCH 4/5] hugetlbfs: cleanup some comments in inode.c Date: Thu, 21 Jul 2022 21:16:36 +0800 Message-ID: <20220721131637.6306-5-linmiaohe@huawei.com> X-Mailer: git-send-email 2.23.0 In-Reply-To: <20220721131637.6306-1-linmiaohe@huawei.com> References: <20220721131637.6306-1-linmiaohe@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.175.124.27] X-ClientProxiedBy: dggems703-chm.china.huawei.com (10.3.19.180) To canpemm500002.china.huawei.com (7.192.104.244) X-CFilter-Loop: Reflected ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1658409414; a=rsa-sha256; cv=none; b=dm9PPU7jbWJ7RYf2Vf2ataAj7etnI2SCzC1Poh6B8Le6DlHS39l968Zq+7kFC6hYbI+KXQ r+H116z5DMHj04IfbjBXeZtfXN6okxPs5ohVdBfb/f4rUF53KUlCVMDx4jvDIF6Xkiki9Z kDofPFvVKGDxC0n4lw4oYVxkYVEoRK0= ARC-Authentication-Results: i=1; imf02.hostedemail.com; dkim=none; spf=pass (imf02.hostedemail.com: domain of linmiaohe@huawei.com designates 45.249.212.188 as permitted sender) smtp.mailfrom=linmiaohe@huawei.com; dmarc=pass (policy=quarantine) header.from=huawei.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1658409414; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=msl3p2UFesfPWovUkKVRc+55nmBTZmy1EpG5CTJNySM=; b=W8jtHOF/yqeO02NDHDoX9bTm8RnMBrCMt1rRign7L2VMAccfpY40f5BR495Y2CGeNSBwJN B5LwpEzGrgrTnSfIuwHUs7ZqREnf82PpPg1vYUyvo7oCL7WjIymwfVMSqKD/uGsCgBon+V 6MXq8rY1Ss45t+YD10BXo5iz4ha/wYk= X-Rspam-User: X-Rspamd-Server: rspam05 X-Rspamd-Queue-Id: 3ECB580068 Authentication-Results: imf02.hostedemail.com; dkim=none; spf=pass (imf02.hostedemail.com: domain of linmiaohe@huawei.com designates 45.249.212.188 as permitted sender) smtp.mailfrom=linmiaohe@huawei.com; dmarc=pass (policy=quarantine) header.from=huawei.com X-Stat-Signature: sbozxrnuir947txtxpoq68qddpfw5din X-HE-Tag: 1658409414-620584 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: The function generic_file_buffered_read has been renamed to filemap_read since commit 87fa0f3eb267 ("mm/filemap: rename generic_file_buffered_read to filemap_read"). Update the corresponding comment. And duplicated taken in hugetlbfs_fill_super is removed. Signed-off-by: Miaohe Lin Reviewed-by: Mike Kravetz --- fs/hugetlbfs/inode.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/fs/hugetlbfs/inode.c b/fs/hugetlbfs/inode.c index aa7a5b8fc724..19fc62a9c2fe 100644 --- a/fs/hugetlbfs/inode.c +++ b/fs/hugetlbfs/inode.c @@ -313,8 +313,8 @@ hugetlbfs_read_actor(struct page *page, unsigned long offset, /* * Support for read() - Find the page attached to f_mapping and copy out the - * data. Its *very* similar to generic_file_buffered_read(), we can't use that - * since it has PAGE_SIZE assumptions. + * data. Its *very* similar to filemap_read(), we can't use that since it has + * PAGE_SIZE assumptions. */ static ssize_t hugetlbfs_read_iter(struct kiocb *iocb, struct iov_iter *to) { @@ -1383,7 +1383,7 @@ hugetlbfs_fill_super(struct super_block *sb, struct fs_context *fc) /* * Allocate and initialize subpool if maximum or minimum size is * specified. Any needed reservations (for minimum size) are taken - * taken when the subpool is created. + * when the subpool is created. */ if (ctx->max_hpages != -1 || ctx->min_hpages != -1) { sbinfo->spool = hugepage_new_subpool(ctx->hstate, From patchwork Thu Jul 21 13:16:37 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Miaohe Lin X-Patchwork-Id: 12925109 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 kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 100C3CCA479 for ; Thu, 21 Jul 2022 13:17:03 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id CCE218E0001; Thu, 21 Jul 2022 09:16:55 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id C414F8E000F; Thu, 21 Jul 2022 09:16:55 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id A0D8C8E0001; Thu, 21 Jul 2022 09:16:55 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0015.hostedemail.com [216.40.44.15]) by kanga.kvack.org (Postfix) with ESMTP id 7E9518E000D for ; Thu, 21 Jul 2022 09:16:55 -0400 (EDT) Received: from smtpin08.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay05.hostedemail.com (Postfix) with ESMTP id 6100B4098E for ; Thu, 21 Jul 2022 13:16:55 +0000 (UTC) X-FDA: 79711157190.08.E046371 Received: from szxga01-in.huawei.com (szxga01-in.huawei.com [45.249.212.187]) by imf13.hostedemail.com (Postfix) with ESMTP id 0CE99200A9 for ; Thu, 21 Jul 2022 13:16:53 +0000 (UTC) Received: from canpemm500002.china.huawei.com (unknown [172.30.72.53]) by szxga01-in.huawei.com (SkyGuard) with ESMTP id 4LpY2h2cDfzmV8l; Thu, 21 Jul 2022 21:15:08 +0800 (CST) Received: from huawei.com (10.175.124.27) by canpemm500002.china.huawei.com (7.192.104.244) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.24; Thu, 21 Jul 2022 21:16:51 +0800 From: Miaohe Lin To: , , CC: , , Subject: [PATCH 5/5] hugetlbfs: fix confusing hugetlbfs stat Date: Thu, 21 Jul 2022 21:16:37 +0800 Message-ID: <20220721131637.6306-6-linmiaohe@huawei.com> X-Mailer: git-send-email 2.23.0 In-Reply-To: <20220721131637.6306-1-linmiaohe@huawei.com> References: <20220721131637.6306-1-linmiaohe@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.175.124.27] X-ClientProxiedBy: dggems703-chm.china.huawei.com (10.3.19.180) To canpemm500002.china.huawei.com (7.192.104.244) X-CFilter-Loop: Reflected ARC-Authentication-Results: i=1; imf13.hostedemail.com; dkim=none; dmarc=pass (policy=quarantine) header.from=huawei.com; spf=pass (imf13.hostedemail.com: domain of linmiaohe@huawei.com designates 45.249.212.187 as permitted sender) smtp.mailfrom=linmiaohe@huawei.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1658409414; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=JYFjDUxI/AUexedIePppUKUCucA973bePWmAT+ANa34=; b=WbWTjKL5L0TzunzQ56sJv9L0pAmh1t8vvexkALS7wm5mC4DqUE+e6pH43YhHquhoPlpLvO MAd3jhN/OSnG5mlTej8bjUd3xHdaoO94ruCSKR7kdKAPKb2NS9JxXzyGiipHbptDzOGyl5 O9VuT9y1au/fRLauru/S+a4pWO0J7as= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1658409414; a=rsa-sha256; cv=none; b=LxQZNGR+c0/bSrIl9ab0IMDUyduuJWLLhdZsavNU01tZ/utc+ZjlCiVv4z8bpY5OE3BC7L qztf6jgIGvmizazHhPbkMdAlkgTRwV3y2Ibgzv3IMuP6mt5kA4cYNI5Hbal6IppPfYa3b+ sRuByns2Zuck8Pu+Knm/Avz2BE0xqKM= X-Rspamd-Queue-Id: 0CE99200A9 Authentication-Results: imf13.hostedemail.com; dkim=none; dmarc=pass (policy=quarantine) header.from=huawei.com; spf=pass (imf13.hostedemail.com: domain of linmiaohe@huawei.com designates 45.249.212.187 as permitted sender) smtp.mailfrom=linmiaohe@huawei.com X-Rspam-User: X-Rspamd-Server: rspam03 X-Stat-Signature: 8horacogp78h8g95y59wraqd4hzuw86o X-HE-Tag: 1658409413-756535 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: When size option is not specified, f_blocks, f_bavail and f_bfree will be set to -1 instead of 0. Likewise, when nr_inodes is not specified, f_files and f_ffree will be set to -1 too. Check max_hpages and max_inodes against -1 first to make sure 0 is reported for max/free/used when no limit is set as the comment states. Signed-off-by: Miaohe Lin --- fs/hugetlbfs/inode.c | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/fs/hugetlbfs/inode.c b/fs/hugetlbfs/inode.c index 19fc62a9c2fe..44da9828e171 100644 --- a/fs/hugetlbfs/inode.c +++ b/fs/hugetlbfs/inode.c @@ -1083,16 +1083,20 @@ static int hugetlbfs_statfs(struct dentry *dentry, struct kstatfs *buf) /* If no limits set, just report 0 for max/free/used * blocks, like simple_statfs() */ if (sbinfo->spool) { - long free_pages; - spin_lock_irq(&sbinfo->spool->lock); - buf->f_blocks = sbinfo->spool->max_hpages; - free_pages = sbinfo->spool->max_hpages - - sbinfo->spool->used_hpages; - buf->f_bavail = buf->f_bfree = free_pages; + if (sbinfo->spool->max_hpages != -1) { + long free_pages; + + buf->f_blocks = sbinfo->spool->max_hpages; + free_pages = sbinfo->spool->max_hpages + - sbinfo->spool->used_hpages; + buf->f_bavail = buf->f_bfree = free_pages; + } spin_unlock_irq(&sbinfo->spool->lock); - buf->f_files = sbinfo->max_inodes; - buf->f_ffree = sbinfo->free_inodes; + if (sbinfo->max_inodes != -1) { + buf->f_files = sbinfo->max_inodes; + buf->f_ffree = sbinfo->free_inodes; + } } spin_unlock(&sbinfo->stat_lock); }