From patchwork Mon Dec 23 14:15:28 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kaixiong Yu X-Patchwork-Id: 13918962 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 7DD6CE7718E for ; Mon, 23 Dec 2024 14:20:11 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 8CA426B00C1; Mon, 23 Dec 2024 09:20:10 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 830316B00C2; Mon, 23 Dec 2024 09:20:10 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 6C72F6B00C3; Mon, 23 Dec 2024 09:20:10 -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 4ACCE6B00C1 for ; Mon, 23 Dec 2024 09:20:10 -0500 (EST) Received: from smtpin04.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay07.hostedemail.com (Postfix) with ESMTP id 01B46160E09 for ; Mon, 23 Dec 2024 14:20:09 +0000 (UTC) X-FDA: 82926432624.04.9AD4176 Received: from szxga02-in.huawei.com (szxga02-in.huawei.com [45.249.212.188]) by imf13.hostedemail.com (Postfix) with ESMTP id AFD922000B for ; Mon, 23 Dec 2024 14:19:30 +0000 (UTC) Authentication-Results: imf13.hostedemail.com; dkim=none; dmarc=pass (policy=quarantine) header.from=huawei.com; spf=pass (imf13.hostedemail.com: domain of yukaixiong@huawei.com designates 45.249.212.188 as permitted sender) smtp.mailfrom=yukaixiong@huawei.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1734963572; a=rsa-sha256; cv=none; b=oYcmlg+Ep44o58N2++159Zzez96AEyRa1pHwOqYMmag6oPrY2T3Ct3ol+YvXSWoNj8sxRu McYB5y2N1sOM8u03u0ADARxbHgPZftYYPDSLhZBo7rcFtQzw2APLAr3b0cw/UvPRn1lsGt S97B+gR4Zd2k6rRnhNWQa8jKc5Vdx0Y= 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 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=1734963572; 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=2pgn9lU7fhnrm1VRi1/tPVdiKQlL0nOYBizdWQ5m9/+fBx4nsi8ncGGRK5m/ZET+Y19k0a y/0c8u/N4FsjorO39lGKFHRqBKAQUK43X8B6bhhh4IybMX+FZjfFxZWGwzuqMHz9R1ycwG bJNufgj9LRjK9Jbk1GTcsZn5BPKc2ls= Received: from mail.maildlp.com (unknown [172.19.163.252]) by szxga02-in.huawei.com (SkyGuard) with ESMTP id 4YH0Vf5Nw9zrRn0; Mon, 23 Dec 2024 22:18:18 +0800 (CST) Received: from kwepemh100016.china.huawei.com (unknown [7.202.181.102]) by mail.maildlp.com (Postfix) with ESMTPS id 7E6C31800D1; Mon, 23 Dec 2024 22:20:03 +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:00 +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:28 +0800 Message-ID: <20241223141550.638616-10-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-Rspamd-Server: rspam04 X-Rspamd-Queue-Id: AFD922000B X-Stat-Signature: ejo7oaiantm3h854ym1g7caq9tay3j89 X-Rspam-User: X-HE-Tag: 1734963570-875082 X-HE-Meta: U2FsdGVkX19gzbKA/ggJthuJiD0XCPBOrXMtSmFgy+bYD+uiJEm5aWofrfyDJ1VQmFWK9xO5FTAuUJWXaUaB7khrGr59ObLbpmglbNF0/UVvXslDhwlzizfRvRDnofuvvsr/fo9GMgKbfOPuKs7W80kZI1r/VyVQKTkLuKtCtMgjC4meZAY3aXr4tcGLR5RYH0GhHMVKMxkThV0LrPhe2516oPUA/nDzSc1TJufNNdyIJ2z+QFkhP288Cq38UBmenVJxH8DDvqFfU7PVGA35lkQpu/9HXuLpukDkxCMUcrmJf7D/cYMIJNCfcHD1yL/gywlrZ1QFEKIXLn32TmYwteAHktxkocALAqq/CbAoTHbC1KGmvoAz/y4yEFyVGvyXaDX3qF45E6Ea41c0fCc8t3Vsm68yG+iIpGVBLAXeWiyRrJyxCcqKU39Fy0U+QqNgVvOm2dQaGvDaTQ4ZqQa59mifxFfq19ON607g/LPhmvtxMdUypw9UoeV7xX5petVSktm5exB39xmaPgAejw2uKEdgOXVsOBCJsGX7kcdxHD35MMb6CGoCwSbM63L0ez4v7cb9D93A48QmN3OumChNJR/CpbLop0TFa7Vo/+5ibumD5LIlgUGxmq26LLvkuBJ1sPlM76VlwCjhv5BsXJor7u57HVs5wflbVusQRovHP8C3/W9GV9i4r5ZVTrt4z0L9iWGIBztgAuZ7mVc2yXeCfmx9iENj+biGuJq6H6Lr4AP9qhsO/vh0TVCEoXTqzrBPWjXmwqE7JTVo9MZGZ61QX5rGdAt3lc3Bgc3/w4QztmoSeG3wJ3wAqDFnF/4am9bNj9yl/WleQb5cTK7CUnf+G+DrEQrXCpzv0pVw4y2E/UnDV8QYRZ4Qdr7voSWL7z63p8TcaDzq9ZsVAjRBGTsmaN9JpcJLgqPO+Gn+ejFRXU+uD/8bsmyYEKwiI+EK7/q858dU9iKMcm2Oo5Bsdo2 qTZw6fvw rGHHoxrXNE1bkH6R/98IdESOPyd18Ov/F1U6BwEpgrHSe/dvRL0EoC/hx9MqU+3dFzlCeUMXRtaRIoEYaOGGOsvJZYKadciZEEm0oDe4/shGZimTZMHPffNyR8gXcGyEZFB4sCOvZtemzZX3WYOBsnwkOf7jdrbJnPTdwg9xVjwZ61Bs= 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,