From patchwork Thu Oct 10 15:22:09 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: yukaixiong X-Patchwork-Id: 13830200 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 24E26CF11F9 for ; Thu, 10 Oct 2024 14:12:07 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id D842C6B00A0; Thu, 10 Oct 2024 10:12:05 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id D2FF96B009F; Thu, 10 Oct 2024 10:12:05 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id BAA686B00A0; Thu, 10 Oct 2024 10:12:05 -0400 (EDT) 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 9F3ED6B009E for ; Thu, 10 Oct 2024 10:12:05 -0400 (EDT) Received: from smtpin28.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay03.hostedemail.com (Postfix) with ESMTP id D5A0AA0280 for ; Thu, 10 Oct 2024 14:11:58 +0000 (UTC) X-FDA: 82657881810.28.9F409EA Received: from szxga05-in.huawei.com (szxga05-in.huawei.com [45.249.212.191]) by imf29.hostedemail.com (Postfix) with ESMTP id 3FD73120022 for ; Thu, 10 Oct 2024 14:12:00 +0000 (UTC) Authentication-Results: imf29.hostedemail.com; dkim=none; spf=pass (imf29.hostedemail.com: domain of yukaixiong@huawei.com designates 45.249.212.191 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=1728569453; 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=tKrT3z68GpyU14ZsW9Udy/3EKw4RLNtJqOq3GBJQh/k=; b=itiOi6sB3VHyhpO2IMJ54qCaXHZa/YlNZfm8YkDXXaEYYScHbxnoVLdsFwuc55GaxXZB9Y L7erKccXRTtJSs2f5JmSl89uhz4CuA9fOiN7m0z+bu/6E3Y/JWaLpqqqCnq/AyQsm6oHaQ hZZNxslh9LGjWAJxwpICqEKQjrWxgEU= ARC-Authentication-Results: i=1; imf29.hostedemail.com; dkim=none; spf=pass (imf29.hostedemail.com: domain of yukaixiong@huawei.com designates 45.249.212.191 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=1728569453; a=rsa-sha256; cv=none; b=eHMXFL/YMz5l31FnClBhS1cyFmiFiHujGeRSTzsC14FUa+UPp8vdb4tTt/xiRXhWVFjtky ssAysFdK8oXw0CFYTjpXL4a0BmdUXgVzoXyquLO/aJoT6mXX407ekTu5bx3qBFDvslYwOK SFf3Um49CT4lrtu4HnW9FKy+bwilA68= Received: from mail.maildlp.com (unknown [172.19.88.163]) by szxga05-in.huawei.com (SkyGuard) with ESMTP id 4XPWmm4zJFz1HKkx; Thu, 10 Oct 2024 22:07:52 +0800 (CST) Received: from kwepemh100016.china.huawei.com (unknown [7.202.181.102]) by mail.maildlp.com (Postfix) with ESMTPS id 9D41D18001B; Thu, 10 Oct 2024 22:11:59 +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; Thu, 10 Oct 2024 22:11:56 +0800 From: Kaixiong Yu To: , CC: , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , Subject: [PATCH v3 -next 09/15] fs: fs-writeback: move sysctl to fs/fs-writeback.c Date: Thu, 10 Oct 2024 23:22:09 +0800 Message-ID: <20241010152215.3025842-10-yukaixiong@huawei.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20241010152215.3025842-1-yukaixiong@huawei.com> References: <20241010152215.3025842-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-Rspamd-Server: rspam03 X-Rspam-User: X-Rspamd-Queue-Id: 3FD73120022 X-Stat-Signature: yesncgb5fsdp9fg53a9h4x5pbteimkhk X-HE-Tag: 1728569520-76612 X-HE-Meta: U2FsdGVkX18i7UamNwik0AcY1s8Md9MJC1a8rs6hOFeUiyNVANYpaPqJMb57yLPev9uS/ZJWfKCKvAEslL44oLQtp/mDaFggc83FYcZbGy75fcU6C6QweSmS2y9/zhaxiBkKGJ4hMlSKMeTwR4ax2Us1CZKB93efrjz5Of0QcEjKO/eZfJwZgjmuRRAcihQLbYKGyN2rJiM1qOH+QCJkOvCkN4zGU5Odh5yQ/F/63h7cEzcU1hJOSTAH1MhI2t49sYnL+SFF5pylS6olzXOf5cG89S/hbF24HAS13UD8W9/y1COkNiwrc8f1r4llVPgikn3gcFjOqS2fPqMUlIlC7LIf7K2ZQ4fAxpI2rdSOuRDMxhF58MaeI/zmhEv1g1MlYNMAM6ufqtsuj/OWwKboEvWOuX0ZCRqlHn/suzzzQVA2gyLoMIyM9UusKXvjgFgViZXY/siVGK+EWUcuCn3t6U6fS8+Lt+2a5xmBCQV03fBwnPazhY8D9BPk4hi8mDIL73QHUfQiUkaomgYHIDXcmuFGkDNMff4VoK6Wfy+xtnB9T2o6bXHB4RTKu8912nJI8ewZCX8zER2mF1bXoJg7WyeMuPtsNBmlb0gQzTU3SHLeJfyVxXYhBd7uHH03jmbKjIRxnB5kEP/flbqvL6Tas/9qdM71niexEUdWlFIYxACDOMe5fDcnMtWurl6aH9UyfDo2ZeoRq2AphZS9/vgQZYVfuqhvtImQkoJVSH6ErJB3f39o/t1gnYg/7XbYwIAPIUX7VPFZV8j+2CuPH3T/qmueFp2xbrjNC9HWaL1XpKDsyFPlOCCXIuhR7O3239KRnfjogbEtJPht5PKKfGgAEKxgE7KzF+o+rWzvgycwyLzAs7YGwUQiPlOWKqtodRVSvSm8B0vH92rnHiPuqXnjfAPjeXXVY8P13Ji2vEF6ajHujYNzAQksdiMtYtGJKWCcmtA3B/7hE4O9uM5vKGR kMgpdk9B 5veiT4K1jLW9eQJujsfjTq1eVw0cTX+pHXV+EgRtaxpOnKFGa8A1uGtKC5tdiEP6RwYSUh8e5+N7jsKzsZU7MrTEw/ESRIx6K7qCBFBpEQALptkEadOFb9M7fejUdHbY6nBKc9YEACN9uiqjCnC1rnLQSSj88uKTz9bMP 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 --- 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 d8bec3c1bb1f..4fedefdb8e15 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) { @@ -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,