From patchwork Tue Sep 3 03:30:05 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: yukaixiong X-Patchwork-Id: 13787958 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 2201DCD3427 for ; Tue, 3 Sep 2024 03:31:33 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id EA7098D012F; Mon, 2 Sep 2024 23:31:29 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id E80278D0119; Mon, 2 Sep 2024 23:31:29 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id D6D208D012F; Mon, 2 Sep 2024 23:31:29 -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 B68528D0119 for ; Mon, 2 Sep 2024 23:31:29 -0400 (EDT) Received: from smtpin10.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay01.hostedemail.com (Postfix) with ESMTP id 6A27F1C13A2 for ; Tue, 3 Sep 2024 03:31:29 +0000 (UTC) X-FDA: 82522001898.10.F8E7C31 Received: from szxga08-in.huawei.com (szxga08-in.huawei.com [45.249.212.255]) by imf19.hostedemail.com (Postfix) with ESMTP id 169F71A0005 for ; Tue, 3 Sep 2024 03:31:26 +0000 (UTC) Authentication-Results: imf19.hostedemail.com; dkim=none; spf=pass (imf19.hostedemail.com: domain of yukaixiong@huawei.com designates 45.249.212.255 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=1725334193; 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=GsszZcU5MEX5KSbdKVfP/hsrZJbmsi1mtRWwn7a0E1w=; b=S/TWNVKIKhrbcL9DoAplLrOx2D6GOOwirGHDjHwF7yukWeDjQNIzIg0vhnoEKp7uk1f4se wUC7lfx545GEJkzQX5iuF5SC4mM362GnHc+oQ357i/CCu778Pyc4TIhHAfc4OOWOUHf5FI j6dDbPvkluuBx2Be7Yk6qGMZKgcEjys= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1725334193; a=rsa-sha256; cv=none; b=wHiVOlQDQ4orb6qWUe1l5e7/iBWh4K61Z4tu3MJwQPogX7MpGjEQWIeXORGTmZOGx8pNFo jZBDnACFzP1pgSxT4gjxsT3bb1H8WmwzZmTJ6ydaTwd8Vs5hAOK1dBAkwtyrypN7sONqW9 rBa9ATbECGNPfINlc8idy8Y1Un2SK4s= ARC-Authentication-Results: i=1; imf19.hostedemail.com; dkim=none; spf=pass (imf19.hostedemail.com: domain of yukaixiong@huawei.com designates 45.249.212.255 as permitted sender) smtp.mailfrom=yukaixiong@huawei.com; dmarc=pass (policy=quarantine) header.from=huawei.com Received: from mail.maildlp.com (unknown [172.19.163.48]) by szxga08-in.huawei.com (SkyGuard) with ESMTP id 4WyWNM5w5pz18Mv5; Tue, 3 Sep 2024 11:30:27 +0800 (CST) Received: from kwepemh100016.china.huawei.com (unknown [7.202.181.102]) by mail.maildlp.com (Postfix) with ESMTPS id 77D0C180087; Tue, 3 Sep 2024 11:31:23 +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; Tue, 3 Sep 2024 11:31:20 +0800 From: Kaixiong Yu To: , CC: , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , Subject: [PATCH v2 -next 09/15] fs: fs-writeback: move sysctl to its own file Date: Tue, 3 Sep 2024 11:30:05 +0800 Message-ID: <20240903033011.2870608-10-yukaixiong@huawei.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20240903033011.2870608-1-yukaixiong@huawei.com> References: <20240903033011.2870608-1-yukaixiong@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.175.113.32] X-ClientProxiedBy: dggems706-chm.china.huawei.com (10.3.19.183) To kwepemh100016.china.huawei.com (7.202.181.102) X-Rspam-User: X-Rspamd-Server: rspam04 X-Rspamd-Queue-Id: 169F71A0005 X-Stat-Signature: n6ctgmk9wez4j7cnuhxdzoz6mdqfkjiw X-HE-Tag: 1725334286-558105 X-HE-Meta: U2FsdGVkX18128/1LtF7HihE7KKAfVjgG8RTl3yeouPiPMiwxQqYuDiMVTZKlgaLLbUXkSr/OtBSyA9Tv69B5nOCpex6P/maeZb9gYMN5vzr+HdeKHMPgzRMaWrFCc/KtbXYR/IoE8oHi5hoomDFDIW6I1InZlnDyYizdVMBFOFm68Ltt0XOSim5oP/FRhIMhnmUKNadbmCPPxVXLndBSVcpQWlhSuZuYTN8amDvSFhfhASXDE5FdrDbKFBdau9NRMA1RXcgtoeyrVRr6JP4K2AEuon5isGv7dfdVWH60/VhEh5oSOaAqx2PDsIh6Q/34Xf5tlImNoHxga+25TBLqxXcYevhW0S1VFo9fuSGriL1C3BYzXQGuX0LrXFBezKDePW7AnVEAZsm1dwibJeVUdoRHKJ0dUOI3+WDBPL8Ig/+Am+j/H2OR9o1NAhX7zMVW/B0DpEpLL6f358QCSEpeW6aiPlsL65LDEP3q7v35gZ1IEWkJmf92MIo0vtc6Tcb39SnnfXb44RpWWyVyuGb0oj3X2A9WrPhFGO/aei/11t64ZJm63EtERllQNdLrFATISrKg8V0goipMO0gY7sACv4fSP1G/2bMPhmunPdCC17XC2ud6dXcFVoBNel7MI9iFFuOCciD+Kp8/8MVxy8btO94qME0i/mZDT6MEZAH6/nzVlPnNuCzPD5o7/wpPWJmVa0g24rSYq33ux5Sa3CC57Bqu1b43JLv665Six/HSoAl2ufl3SIo7qzFmttk4cMfm/WQu8t2WG1K59xLq8HJAwBEmhdpstxpYriMQWoZr3upNgLdPJ+DAN/uhDV0NqAgeUwlZMQkx2eqob/GBLN5wTv7gBm7BcBajtHLZMwTx69tsgLG4wDhysE+9FzQ7+7dG/zzAuCk8+fklqN4iwioZEhnHaIikA8atw4Y75uTyN/H0QPgyhTwO6ITZAY55Ykrg8IauvF6ezdt+JybpSE S8HD60Pg /Pa+Ijdm7nyQUfCmiKaqT9QIkdFomhETxkxL4MAVivNEIcmffHhqAmwnVG/4OAe6NTKrDe2a4bgX7AlqgWC+De43gBpw6nxtyiE8KryNrOZbwXP1y+xGNRK+EXcpYH7LtBJ/r2De39OlVccdilawdYDAyEc6Y7E1aTSarcysVTicnxF0= 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 into its own file 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 --- fs/fs-writeback.c | 28 ++++++++++++++++++++-------- include/linux/writeback.h | 4 ---- kernel/sysctl.c | 8 -------- 3 files changed, 20 insertions(+), 20 deletions(-) diff --git a/fs/fs-writeback.c b/fs/fs-writeback.c index d8bec3c1bb1f..9217afaa31d3 100644 --- a/fs/fs-writeback.c +++ b/fs/fs-writeback.c @@ -2413,14 +2413,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; @@ -2431,6 +2424,25 @@ int dirtytime_interval_handler(const struct ctl_table *table, int write, return ret; } +static 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 d6db822e4bb3..5f35b24aff7b 100644 --- a/include/linux/writeback.h +++ b/include/linux/writeback.h @@ -351,12 +351,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 d3de31ec74bf..373e018b950c 100644 --- a/kernel/sysctl.c +++ b/kernel/sysctl.c @@ -2024,14 +2024,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,