From patchwork Sat Dec 28 14:57:40 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: yukaixiong X-Patchwork-Id: 13922371 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 7A481E7718F for ; Sat, 28 Dec 2024 15:02:20 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 01A1E6B009E; Sat, 28 Dec 2024 10:02:20 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id F32EC6B009F; Sat, 28 Dec 2024 10:02:19 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id DD3726B00A0; Sat, 28 Dec 2024 10:02:19 -0500 (EST) 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 B85FE6B009E for ; Sat, 28 Dec 2024 10:02:19 -0500 (EST) Received: from smtpin26.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay01.hostedemail.com (Postfix) with ESMTP id 75F4C1C92B4 for ; Sat, 28 Dec 2024 15:02:19 +0000 (UTC) X-FDA: 82944682296.26.FF3D774 Received: from szxga04-in.huawei.com (szxga04-in.huawei.com [45.249.212.190]) by imf14.hostedemail.com (Postfix) with ESMTP id A3FCE100026 for ; Sat, 28 Dec 2024 15:01:27 +0000 (UTC) Authentication-Results: imf14.hostedemail.com; dkim=none; spf=pass (imf14.hostedemail.com: domain of yukaixiong@huawei.com designates 45.249.212.190 as permitted sender) smtp.mailfrom=yukaixiong@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=1735398091; 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=Giw4aSA7nLP9q76arckZL69EH5cSA1K/X7FELVtRGE8=; b=uzHRfGWB/5hpRjvJFcrSFGpvH1e40clUjiAsFvfv9f83RvaPUu5Qs5ZIIPeu/tjh13PGnv nl+I3UxomVneY+fPFz2Bf4DlnVe2oWu1hdGhCAW/izWqjfux/aOPiwxQGwEBpsr/meWzBd 51TzNRKso1zzcGFr/Tu7EX19cfEbizM= ARC-Authentication-Results: i=1; imf14.hostedemail.com; dkim=none; spf=pass (imf14.hostedemail.com: domain of yukaixiong@huawei.com designates 45.249.212.190 as permitted sender) smtp.mailfrom=yukaixiong@huawei.com; dmarc=pass (policy=quarantine) header.from=huawei.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1735398091; a=rsa-sha256; cv=none; b=RrdomueihPJD1MBW+xdu4enn4oMryiH18450UmYYtDbPrYqGoNnNOJW+ZYYm+jH3KK0TH7 oQoQo3aaT/WHGn03CcEiYeB6/xPITDntzW+m53ouIS2AvsEUZePpgbVHzkCivlO3sUCw3S N8nJ2JtG8kKOUZzEZy6eIQSsZHnL61w= Received: from mail.maildlp.com (unknown [172.19.163.17]) by szxga04-in.huawei.com (SkyGuard) with ESMTP id 4YL59n2bf5z2FcBc; Sat, 28 Dec 2024 22:59:25 +0800 (CST) Received: from kwepemh100016.china.huawei.com (unknown [7.202.181.102]) by mail.maildlp.com (Postfix) with ESMTPS id F29C51A0188; Sat, 28 Dec 2024 23:02:12 +0800 (CST) Received: from huawei.com (10.175.113.32) by kwepemh100016.china.huawei.com (7.202.181.102) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1544.11; Sat, 28 Dec 2024 23:02:09 +0800 From: Kaixiong Yu To: , CC: , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , Subject: [PATCH v4 -next 09/15] fs: fs-writeback: move sysctl to fs/fs-writeback.c Date: Sat, 28 Dec 2024 22:57:40 +0800 Message-ID: <20241228145746.2783627-10-yukaixiong@huawei.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20241228145746.2783627-1-yukaixiong@huawei.com> References: <20241228145746.2783627-1-yukaixiong@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.175.113.32] X-ClientProxiedBy: dggems705-chm.china.huawei.com (10.3.19.182) To kwepemh100016.china.huawei.com (7.202.181.102) X-Rspamd-Server: rspam06 X-Rspamd-Queue-Id: A3FCE100026 X-Rspam-User: X-Stat-Signature: s7yjuucimbhg9gdnbki9s5qdr467ccge X-HE-Tag: 1735398087-591332 X-HE-Meta: U2FsdGVkX19X77AJ2FTGp+TcjIW2hwt5PfRqG1978bpeAyzLP/f0+2lzWFrGrcuJTNmz+9bYxh4YTLVcYGcvhlvJ70gi25NjsI5n0rCkVTEHRh/91Os6of4/FRU2EbVN5FfIU1HrNCWPt0KfgrCYuXPABLfrGLALA8Qm9asiklozdZcrecB6qGDHQP2pQTKtVhWC7D4jlBGiSyJ/0lJFYfctT0JL4BQuwrMTim+wafBak82khwrYQ76dd3TnnSg3t/IMgYUpGECJQziQE54Uunw49HVL1JfL1Zy6q0sPM/sg43i4+wZTvmv86MIMwpb6HIBSYOjUITSYj+lgjFFXgpAkOhv1ldQYvVmrCvy72qXwSthvplrQXiWRwvFGc+eCH+N8lQNbruGfTK3XzfMajiStIFJJE/ZQJye0bFm2ZfBNl87F0/Vlq60ps0XUG6ZbUnTjhef2vAxoQOEhpH7n+Y8PHtzh36voyJK7PS/lA585GHBE6D+uBWcb4D0fO1yVcsDOa0hleaPw2NPfomnN6ybtj4ktxag4SQgmulvcFrtkXE5lIrp5WwiJWCjSMXJFyPr3zF2z65IZUfcfzzmH4LuqtlzPdTDuRRjPwcGpix091NXKUHiavOL/J/20UGMDNua/6geBShzd+Wlu1XZDvo4IykQeuDJF/twZJLuH5PlMUCfOZflPmQZhs8Sv3ACuJ/a3enajz2JfVuy4wysK3DjWd10P1QvGy3M7GRxtYTGkan1TshBeenux4tBDMSn4EeUPzxM7ibNEuPK7S9DLY5GWXOVpKupYL0byk1URgh7T5QT+nnGTf+S9kpJM59iUJtryeODQvdt9sPia8CbHmAPzOoIzjkcVfiQIhQLXp7t7rP9OSu/NajiBQ2LWq7tsQrO+tth2XyDlZAZNLXZn0nCyNfiuZAmPgdPV5Jeo3mE47ADA2pBSzOo0762msQTXyZMpcguPYZHcz5a+AAW sUSzpBzG 1XDezB/XdZ3rz+kSAvVPYKe7yE3Sk4RnvtS7JqEp1+1ALzw58t5+nti3tboqtuqxQ9I9UzTrk5lzFddDw0B42jP3OzSVL3ljKVPUFLmlPun/mp0IMaRWhT+WF10ZwIFmMNFfV7QEHQ3BAfpAM2DAPX8a0Ii3bM5cjc6nCv/bd/hCLC/BL+N/Z/iGu3HYWwr2OPzNOzYFPsiiHa28gdOefDFuHxLlr83qskvlmLnAHShejNM/78iW1L/w0MTnv2hZAOp0NZukGXhkcj2ep7htecVhjEBf1LSM1Le2u8O/ZoLSLHbcfvJ6+p2fXZ3caeSWy85bS 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: List-Subscribe: List-Unsubscribe: The dirtytime_expire_interval belongs to fs/fs-writeback.c, move it to fs/fs-writeback.c from /kernel/sysctl.c. And remove the useless extern variable declaration and the function declaration from include/linux/writeback.h Signed-off-by: Kaixiong Yu Reviewed-by: Kees Cook Reviewed-by: Jan Kara --- v4: - const qualify struct ctl_table vm_fs_writeback_table v3: - change dirtytime_expire_interval to static type - change the title --- --- fs/fs-writeback.c | 30 +++++++++++++++++++++--------- include/linux/writeback.h | 4 ---- kernel/sysctl.c | 8 -------- 3 files changed, 21 insertions(+), 21 deletions(-) diff --git a/fs/fs-writeback.c b/fs/fs-writeback.c index 5980ac24c7a4..4f907e8dbfff 100644 --- a/fs/fs-writeback.c +++ b/fs/fs-writeback.c @@ -65,7 +65,7 @@ struct wb_writeback_work { * timestamps written to disk after 12 hours, but in the worst case a * few inodes might not their timestamps updated for 24 hours. */ -unsigned int dirtytime_expire_interval = 12 * 60 * 60; +static unsigned int dirtytime_expire_interval = 12 * 60 * 60; static inline struct inode *wb_inode(struct list_head *head) { @@ -2435,14 +2435,7 @@ static void wakeup_dirtytime_writeback(struct work_struct *w) schedule_delayed_work(&dirtytime_work, dirtytime_expire_interval * HZ); } -static int __init start_dirtytime_writeback(void) -{ - schedule_delayed_work(&dirtytime_work, dirtytime_expire_interval * HZ); - return 0; -} -__initcall(start_dirtytime_writeback); - -int dirtytime_interval_handler(const struct ctl_table *table, int write, +static int dirtytime_interval_handler(const struct ctl_table *table, int write, void *buffer, size_t *lenp, loff_t *ppos) { int ret; @@ -2453,6 +2446,25 @@ int dirtytime_interval_handler(const struct ctl_table *table, int write, return ret; } +static const struct ctl_table vm_fs_writeback_table[] = { + { + .procname = "dirtytime_expire_seconds", + .data = &dirtytime_expire_interval, + .maxlen = sizeof(dirtytime_expire_interval), + .mode = 0644, + .proc_handler = dirtytime_interval_handler, + .extra1 = SYSCTL_ZERO, + }, +}; + +static int __init start_dirtytime_writeback(void) +{ + schedule_delayed_work(&dirtytime_work, dirtytime_expire_interval * HZ); + register_sysctl_init("vm", vm_fs_writeback_table); + return 0; +} +__initcall(start_dirtytime_writeback); + /** * __mark_inode_dirty - internal function to mark an inode dirty * diff --git a/include/linux/writeback.h b/include/linux/writeback.h index d11b903c2edb..caf4f0b12235 100644 --- a/include/linux/writeback.h +++ b/include/linux/writeback.h @@ -327,12 +327,8 @@ extern struct wb_domain global_wb_domain; /* These are exported to sysctl. */ extern unsigned int dirty_writeback_interval; extern unsigned int dirty_expire_interval; -extern unsigned int dirtytime_expire_interval; extern int laptop_mode; -int dirtytime_interval_handler(const struct ctl_table *table, int write, - void *buffer, size_t *lenp, loff_t *ppos); - void global_dirty_limits(unsigned long *pbackground, unsigned long *pdirty); unsigned long wb_calc_thresh(struct bdi_writeback *wb, unsigned long thresh); unsigned long cgwb_calc_thresh(struct bdi_writeback *wb); diff --git a/kernel/sysctl.c b/kernel/sysctl.c index 97f9abffff0f..c5527f59e3f2 100644 --- a/kernel/sysctl.c +++ b/kernel/sysctl.c @@ -2014,14 +2014,6 @@ static struct ctl_table kern_table[] = { }; static struct ctl_table vm_table[] = { - { - .procname = "dirtytime_expire_seconds", - .data = &dirtytime_expire_interval, - .maxlen = sizeof(dirtytime_expire_interval), - .mode = 0644, - .proc_handler = dirtytime_interval_handler, - .extra1 = SYSCTL_ZERO, - }, { .procname = "drop_caches", .data = &sysctl_drop_caches,