From patchwork Mon Aug 26 12:04:43 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: yukaixiong X-Patchwork-Id: 13777721 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 46453C5321D for ; Mon, 26 Aug 2024 12:06:30 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 0E40A6B04D6; Mon, 26 Aug 2024 08:06:13 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id F127B6B04D8; Mon, 26 Aug 2024 08:06:12 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id D15586B04D9; Mon, 26 Aug 2024 08:06:12 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0015.hostedemail.com [216.40.44.15]) by kanga.kvack.org (Postfix) with ESMTP id AD3686B04D6 for ; Mon, 26 Aug 2024 08:06:12 -0400 (EDT) Received: from smtpin28.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay08.hostedemail.com (Postfix) with ESMTP id 609F2140F64 for ; Mon, 26 Aug 2024 12:06:12 +0000 (UTC) X-FDA: 82494268584.28.DDE52C8 Received: from szxga01-in.huawei.com (szxga01-in.huawei.com [45.249.212.187]) by imf02.hostedemail.com (Postfix) with ESMTP id EFB7C80024 for ; Mon, 26 Aug 2024 12:06:09 +0000 (UTC) Authentication-Results: imf02.hostedemail.com; dkim=none; spf=pass (imf02.hostedemail.com: domain of yukaixiong@huawei.com designates 45.249.212.187 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=1724673927; a=rsa-sha256; cv=none; b=SZwt03MsqfJIz8NJaPhoSewO3+zEnzp7hG94wqnP3A/y538vSEZUms6DM2kbd2rKqen/Cz EvJ8EoKIxaFNuJHqwLB6dYDSnZQnwazgv90Zl78Nl0NblP8Hp3u3UmfoPiX9QaoG09Ozw5 KjjBip4dSrUFiShrmTWt/ArDKLc4ZKE= ARC-Authentication-Results: i=1; imf02.hostedemail.com; dkim=none; spf=pass (imf02.hostedemail.com: domain of yukaixiong@huawei.com designates 45.249.212.187 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=1724673927; 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=4Z2oqMlL/Xp9UiwqHQYcsKaUzT4D+8dGm+Fnv6938lM=; b=2FyeZ+y1wh5AxSMmLeOzysHv54yExPNinYPKFOT5uIa97kAZSymn7cGbrWrdIIxRaTOYow PL7cxCo1oeeiZgmYevuqLJ4NLYtJdbPem+k99zpwWLDtsH+5XX7TAUrGMR2BZLT+4MKAPJ BqR9P6Cp1x51cHwyLS+1oKmbxQWtCDE= Received: from mail.maildlp.com (unknown [172.19.163.252]) by szxga01-in.huawei.com (SkyGuard) with ESMTP id 4WsqB146phzyR5w; Mon, 26 Aug 2024 20:05:13 +0800 (CST) Received: from kwepemh100016.china.huawei.com (unknown [7.202.181.102]) by mail.maildlp.com (Postfix) with ESMTPS id B6D8A1800A5; Mon, 26 Aug 2024 20:05:41 +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, 26 Aug 2024 20:05:39 +0800 From: Kaixiong Yu To: , CC: , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , Subject: [PATCH -next 09/15] fs: fs-writeback: move sysctl to its own file Date: Mon, 26 Aug 2024 20:04:43 +0800 Message-ID: <20240826120449.1666461-10-yukaixiong@huawei.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20240826120449.1666461-1-yukaixiong@huawei.com> References: <20240826120449.1666461-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-Stat-Signature: p5fwmz8i6bee475q7yypusdwgtuxb7y8 X-Rspamd-Queue-Id: EFB7C80024 X-Rspam-User: X-Rspamd-Server: rspam10 X-HE-Tag: 1724673969-422896 X-HE-Meta: U2FsdGVkX1+2qEgDzmFkzvoTzZ7jZwziDw4han0qec6GUMXEnLvybSSFYH1uple1luOXdpT8DqLn2N0xP2DUhajPiIcHNP/xlVAvQwVo8ELYhfctA9a9FliKBpZhmi3P0gNcA6fi98MWJ2G8Cx3/uOgWsEn8XFxGKTDl6nX6mQCRzjAT2lEgYKVolFU6Q+RnCcWFLgX4lPdJMDLk/4r2ipUYshk+YLNBv6vNg/XLJXAI/XG490ylVmATW7Mh/e/2X2eaFI1/aqnGZ6JkaArF106cQWxe9/jp76Ps0BaDEwNF+/JfhbTDxQI2/lDSHuq6NdqSArYDTw1wKTRxo9bh6sN8D5UK4us0nAVGyZP7vakx++J6AyAvfzMLWKYGdmJHbQgIhap4mbJIT4bHreFFvNPZfeJQa8cAOs8nYJVxesUXgtJVraRcdutwDa88ooug82+ydUAfilg2tZsf2iLHXiqWVQqCpBOP/VX5evXYzUTobdkJg7X3FgED4SqFHYdfrTVmLZ6Q6BRzaEsX6MCW5vKqh2NrM3Sln2jGJMQqqonqOA/ZUzQhRIPeVG2lfwcBqiVwfuBNtB7Ug0g2X6S9ChI902kPRfkid5bGBmcpsiK5amIcH53PAkCn65qSL9yN3boxGFF2IPQRQqWG31KmLvVnuBHcX2FveoUSiuhZ77O9apiSXl2e6LU8UvRZcagJvXSXVfTsjUkE0f5cdEdFJzfnRbsJaoZ+nBfW1SZawlM0gfOscw1GwFCoROXsM2EebChjdxtueHY4h8tgUYk0PFBDjRFV0nUEIatfy4TZ9QkclIDUg1wMMDku+YvS6TanBZlBvQDmiShBTRnrraG+QheLVxxR+YmRBcKQeVX+UYJsMGMM0cGAcD72dEpr5mwSSXdYDByPffNEdAb9KDQkTVJ2S7hPUKDPs0kFrdfRJSpyv+EX4yQfX3zvJqG2vUG/5pPHvNIKWRtSHZj+5vw aC1lZwFG SysC5I3H5H/Ylk5H8CuyapVxd+aAN6zy7EwDOtlaOHekioUqAb6hOHgxyV8E9ajD+Es7Y0pndkSww9xzVKIyhZGt5qOpLfilkGvBcvN1cCvWfekkN+phyVSuxHRfp2mSpQC+xqyGzLj8371CfNJG4YYm0AQ== 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 --- 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 1a5006329f6f..71ff73552323 100644 --- a/fs/fs-writeback.c +++ b/fs/fs-writeback.c @@ -2400,14 +2400,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; @@ -2418,6 +2411,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 21dac644d325..22bc047ed91e 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,