From patchwork Sat Jan 11 07:07:44 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kaixiong Yu X-Patchwork-Id: 13935840 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 F165EE7719A for ; Sat, 11 Jan 2025 07:12:56 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 8ABF76B00AC; Sat, 11 Jan 2025 02:12:56 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 85B4D6B00AD; Sat, 11 Jan 2025 02:12:56 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 6AEA06B00AE; Sat, 11 Jan 2025 02:12:56 -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 4190C6B00AC for ; Sat, 11 Jan 2025 02:12:56 -0500 (EST) Received: from smtpin09.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay04.hostedemail.com (Postfix) with ESMTP id DB9AA1A0470 for ; Sat, 11 Jan 2025 07:12:55 +0000 (UTC) X-FDA: 82994303910.09.B560B0F Received: from szxga02-in.huawei.com (szxga02-in.huawei.com [45.249.212.188]) by imf15.hostedemail.com (Postfix) with ESMTP id 6F8A9A000E for ; Sat, 11 Jan 2025 07:12:53 +0000 (UTC) Authentication-Results: imf15.hostedemail.com; dkim=none; dmarc=pass (policy=quarantine) header.from=huawei.com; spf=pass (imf15.hostedemail.com: domain of yukaixiong@huawei.com designates 45.249.212.188 as permitted sender) smtp.mailfrom=yukaixiong@huawei.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1736579574; 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=HGioNgTRYjK8C91dpiIXceWZcSRDFEHQFR/3LewOKyCvoQgfeycO8FXPQzyEcLm1B1/MPd proSINTEAt92H5ATIwzr0HqRt+b70ti1PSxzBpeV/yHpO6eq/tAGsy/Uz/76PTo21Aw1Ic LjRLuVTLbDVzo4GQcwAEOYH4SmFAUjc= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1736579574; a=rsa-sha256; cv=none; b=0BWDdXWCb6dVwoOZHb81byFmPX8G7yCtwbiOFTinxy2GBrIDFTHedi3NmNGyIEXwDl+gX/ K7/TiPuyKpo41YJeDKuGhxNIg/gHrYguabPV93dKPK9/wi5wXMS6arKpDKi3z+oBjM6aIU JI0VJRX7z/uPchD9wiTL70rDL+/aClk= ARC-Authentication-Results: i=1; imf15.hostedemail.com; dkim=none; dmarc=pass (policy=quarantine) header.from=huawei.com; spf=pass (imf15.hostedemail.com: domain of yukaixiong@huawei.com designates 45.249.212.188 as permitted sender) smtp.mailfrom=yukaixiong@huawei.com Received: from mail.maildlp.com (unknown [172.19.88.194]) by szxga02-in.huawei.com (SkyGuard) with ESMTP id 4YVV712NdxzrRtl; Sat, 11 Jan 2025 15:11:09 +0800 (CST) Received: from kwepemh100016.china.huawei.com (unknown [7.202.181.102]) by mail.maildlp.com (Postfix) with ESMTPS id 522901401F3; Sat, 11 Jan 2025 15:12:50 +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, 11 Jan 2025 15:12:46 +0800 From: Kaixiong Yu To: , , CC: , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , Subject: [PATCH v5 -next 09/16] fs: fs-writeback: move sysctl to fs/fs-writeback.c Date: Sat, 11 Jan 2025 15:07:44 +0800 Message-ID: <20250111070751.2588654-10-yukaixiong@huawei.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20250111070751.2588654-1-yukaixiong@huawei.com> References: <20250111070751.2588654-1-yukaixiong@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.175.113.32] X-ClientProxiedBy: dggems703-chm.china.huawei.com (10.3.19.180) To kwepemh100016.china.huawei.com (7.202.181.102) X-Stat-Signature: ad9bmysfaqp8fdcs6penmq54ep1oyi95 X-Rspamd-Queue-Id: 6F8A9A000E X-Rspam-User: X-Rspamd-Server: rspam01 X-HE-Tag: 1736579573-921492 X-HE-Meta: U2FsdGVkX1+hMO6qN4Gmafk8QT0yVzhidW2iPoTEEgo8wH7hvzdOpWJ4TfhJzqHTTJ6WRXkIhwrT/7ZPa0UJ3d8WJp6/6LRcBbSKwoROfw5rI2TMQQjh+HmTzUtAJVdBqx7L/ONSbFNLUnqd6gYu/hCmqnZJrScGs6sMxxCPURm4K2rXaKV+h5i2ZhDHKmUnrkyO0zG59avUm9RMX0x211/oy9057LzYpS2aUkfCFtXPQOdAlCGWk24EzVhWZL4zi2hmVJpEXLDYHYVvfb9DOHw/AMqrsLCnsjp9TCjDcAbtrmoS+UkNFubPVq0yyBxrX7+i0qMKdETABeeKyoXxzHWLhQPIJSwnBLWdBNaUd3QEEfaMHybCsS7NiSHmTHLrwEgkuRlXzHxeP5YlC2EL1wWh1s+zIw98atj3X87HP9rPE8Dk1Oaf4MLxPTxp13FTQXrjgGncgkowUXsMqWFZT14CPV5WWpm2vqvPRdg2kputNHqyi4LnxpiOnU2Q6drhge8KhHcP0Vx33PceyFKuAYZ684o3O4dr2jYIy2IXvjpwWLZ6+kG6I0Htrm5b04inHKWxKjdCisEKGFBAIewVXBgM6sRJfqv0P9WFgtnn0gbWxP7Fr5z1el/KHr0gEqxOR7UICt0lK+J1PUiHepT4Mtq19xDULrCb0CKFGaPaV04s0Ucx8TzXmQvJP3JQDjQPJ/kjC7rxJ+jS/1DYpS2er7VjP8rZxLCkPr01+7hnVlRX99Y+NsKspAKtHAUuCw1iRQIcsaftp+XhsIYZpa+Fzx2ReaxhVgN3cGOSV5tCKNfRqtyir0teQp9NaTzT3M7TfAwqvUrJ4tQaqJ984MG3nNiG6fkIDu6wbMETO/vmrZPQnHLzU+0zPTI016rqIRZJrdyeLx3//r3NkecODQCCg1zHyiFgpf87pmPb5Mg+Etcimf8Wuq7Qc7P283cdBERKxdv511X+zB9Oseg9MU7 LPiq61Po VXLTgI0+rYH9kcMfUS+5sx4Ce+7E9VV/TIUVD3LC/P5Dj9WOMe1GB0nweSwN1uLWbe3k5l088JYzTQMZE1kocynX6wiXD2JHYWeK63N7bc8bBEVaonqgzc3pLUILeZ8UODpBeXPKM+hBs6LdbABhcpd07kZB6wLy3Y5RGhdeWXtIuKR04FehAgvSBdF8R6p+/LkZtNStsuEuyLIC9ar2E2RAkhrv1JCEETJPjABreWKsiN+0ObiYZ2FKoGO3HipV6cZt9+WFUGDeJainXMhw26UEpEuLKOmnM5kD1YEDrevRaXNt4/u1LCSMDNf4YJORiFcCZLW85fIcxU8E= 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,