From patchwork Mon Dec 23 14:15:44 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kaixiong Yu X-Patchwork-Id: 13918977 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 D71C4E7718B for ; Mon, 23 Dec 2024 14:21:03 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 606986B00A0; Mon, 23 Dec 2024 09:21:03 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 5B5A06B00E2; Mon, 23 Dec 2024 09:21:03 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 42FD76B00E3; Mon, 23 Dec 2024 09:21:03 -0500 (EST) 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 1EAAD6B00A0 for ; Mon, 23 Dec 2024 09:21:03 -0500 (EST) Received: from smtpin01.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay02.hostedemail.com (Postfix) with ESMTP id C0D4A121805 for ; Mon, 23 Dec 2024 14:21:02 +0000 (UTC) X-FDA: 82926433716.01.5E68D6C Received: from szxga08-in.huawei.com (szxga08-in.huawei.com [45.249.212.255]) by imf27.hostedemail.com (Postfix) with ESMTP id C8A2B40017 for ; Mon, 23 Dec 2024 14:20:18 +0000 (UTC) Authentication-Results: imf27.hostedemail.com; dkim=none; dmarc=pass (policy=quarantine) header.from=huawei.com; spf=pass (imf27.hostedemail.com: domain of yukaixiong@huawei.com designates 45.249.212.255 as permitted sender) smtp.mailfrom=yukaixiong@huawei.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1734963643; a=rsa-sha256; cv=none; b=GaSu/1K0njtB9QMT5KU4OhAOEfn0e3A+kFBywGnVNnjjn4HjE+4VUQ/gXA9S+mMhHFWJho huyCtej4q7oLFZtiRkCIkOiMaI8QhfWb1T5PGL76xn6IE+/Mvf5AOdYisf9pDjjQ7Z609F R+EHUe1HSV46t2MolCg/a6s0Nv7bAJM= ARC-Authentication-Results: i=1; imf27.hostedemail.com; dkim=none; dmarc=pass (policy=quarantine) header.from=huawei.com; spf=pass (imf27.hostedemail.com: domain of yukaixiong@huawei.com designates 45.249.212.255 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=1734963643; 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=a/PfyQLMCm5n3rJl++CbYIHWlCSQfqOG6kU6xi9XOJfg/DCFVDbVHSg7mHEo0G0JGjiWN0 JUGlfule01WOxQ3C3FNZhIu2tlhxecqY6oQ/TjYPi//KFgJX2b8QkjJTI0OSlgU6yen731 6ccvvvh4P5tJG/Gt4nVUQuGeXGZBvBY= Received: from mail.maildlp.com (unknown [172.19.163.174]) by szxga08-in.huawei.com (SkyGuard) with ESMTP id 4YH0Tq3txpz1V6w2; Mon, 23 Dec 2024 22:17:35 +0800 (CST) Received: from kwepemh100016.china.huawei.com (unknown [7.202.181.102]) by mail.maildlp.com (Postfix) with ESMTPS id D1AD3140391; Mon, 23 Dec 2024 22:20:56 +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; Mon, 23 Dec 2024 22:20:53 +0800 From: Kaixiong Yu To: , CC: , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , Subject: [PATCH v4 -next 09/15] fs: fs-writeback: move sysctl to fs/fs-writeback.c Date: Mon, 23 Dec 2024 22:15:44 +0800 Message-ID: <20241223141550.638616-26-yukaixiong@huawei.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20241223141550.638616-1-yukaixiong@huawei.com> References: <20241223141550.638616-1-yukaixiong@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.175.113.32] X-ClientProxiedBy: dggems702-chm.china.huawei.com (10.3.19.179) To kwepemh100016.china.huawei.com (7.202.181.102) X-Rspam-User: X-Rspamd-Server: rspam03 X-Rspamd-Queue-Id: C8A2B40017 X-Stat-Signature: ejo7oaiantm3h854ym1g7caq9tay3j89 X-HE-Tag: 1734963618-377388 X-HE-Meta: U2FsdGVkX1+yCHKfV0y5WyG8+9oLLrByIZmbhTBccaXs3P7K4+2F1qKsgFb0ZmtEHIovFXdfqxtPk6SYFtkgPORGyVhVCMi8XU+EouaQWRn6h2zQcbTgXhjX6JoGIVg1iw104givplOVXXQYTEMOoKJZyGoVxMIi9w4jDnzJyCaT0kP5L4LgITym8qjnG/94txaWcIaQeWhf1xKd8RVU+wBsih87NwjoJ8JPDgO8oVoq1ju0x5C9EE0Pn1y062QwLsfa2YaZ9ZdWQHMk4z1E15wq63Y2YdUtO6b2FFgNtztegTBADKlK51aD2KpnLoB5y9Li2ux8EHbNiIJpVgcpRnYuO7FuKSX30R6EAPTZvhkQxU7jpsEKITMjA2QkXiR0givAUoEA3A0fIJhIfAqrD3m8O6MIx05OUGzNCdZz003QTubFVz7xHKd3lhedckrlf6XF5qZBunwNiBGbz2E43RF/OD2Kvu0MYOxIwNKodjsoNh0TcU5TEAR7XRnjtOmyYIob7LRUEbJeJav/HktjLlT2C9nMyuqJMKAD7PYEJoDZ+qDd8k8MM0b4eZ4dvCKNSmxOSNHSF2VtIR8UjJST8zPjhuYCiXWOEZDAUosvDRAzKkh/y3jQ8Uyc3kMpxVPyIMHzFTNkMOpzS1nzmCCEgb4lZ5gk+TUpNscgQOO2qgTpHZwj8PaZOg1VVhLxMVIbtIEhjBsALm79Dxg33c3ETIyg1ojiCYoS8TWbtIe3LfQmO14EOUwxAm5icEUeGUBUuB2488ugNRjoTiHXxcFqq9nBEreIZC5emFM7BpyRU6gtHelYn93oIYGrx84xeLLteTZbOaYzVQFANk4vv2Rai3DIN7N07srwI7FEcmUf9NFA3PIfRSEvq7Gabw9KERwmPeA0LabXWT64eNS5zrH/gyTicOpPWLhENnkr8Mk01nnRHLxvrFOWYcFFIPvSaIhOn4maWtrMmtF4+HeaSWu +SZK0RBO RbVwMLXoIxgBTcFU7fJs5+QzCnNfBZenlECGHdGFnv+9EGesfo8T8h0fLtF8FiEQIoZvRHJWDgtwpOS5sReuzvBqb63pZgDF6x6l1B3qaFZUZNSIUJcSeXrnRid8ZsnfS4xuPSv8Mf6jiuiVPWc12fvf+did9Qx9KTsV7 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,