From patchwork Thu Jan 18 20:33:39 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kemeng Shi X-Patchwork-Id: 13522801 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 6E302C47422 for ; Thu, 18 Jan 2024 12:36:00 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id E68CD6B007D; Thu, 18 Jan 2024 07:35:59 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id DF1AD6B007E; Thu, 18 Jan 2024 07:35:59 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id C6B426B0082; Thu, 18 Jan 2024 07:35:59 -0500 (EST) 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 B2CED6B007D for ; Thu, 18 Jan 2024 07:35:59 -0500 (EST) Received: from smtpin25.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay10.hostedemail.com (Postfix) with ESMTP id 84523C0C02 for ; Thu, 18 Jan 2024 12:35:59 +0000 (UTC) X-FDA: 81692378838.25.AF0BC81 Received: from dggsgout11.his.huawei.com (unknown [45.249.212.51]) by imf02.hostedemail.com (Postfix) with ESMTP id 0895480019 for ; Thu, 18 Jan 2024 12:35:56 +0000 (UTC) Authentication-Results: imf02.hostedemail.com; dkim=none; spf=pass (imf02.hostedemail.com: domain of shikemeng@huaweicloud.com designates 45.249.212.51 as permitted sender) smtp.mailfrom=shikemeng@huaweicloud.com; dmarc=none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1705581357; 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-transfer-encoding:content-transfer-encoding: in-reply-to:references; bh=ByKChDEZduCv/L9P4dmMmLpIdo4fmAvuoNja6/nrW7U=; b=eKMM5lnCr5GqRPv+jwvz2wrS4W9eJCgJuZ0XAJz3QCOnLpAegelWn6WD6Oznyb9Q1vV0tR XpgEb9SBhdHbWODIbaJDL4LYU2ov5Rr8dR+9MZbEQQiPcztZOvoQsqorgBx8HID8P7BAPT ihSXzBSX1iLizxtQaT4u2XRBlZXCrWY= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1705581357; a=rsa-sha256; cv=none; b=A8dz5AkyyjLxfACasi8WbBkIbzFiK8nVhQHsM1BoeuyivXoN//P3y8GH5Y9oaAJtX3QQKG zd+1ur/X+onUqQZe4Gzq4bk4rrlMBUAkv8lMHVGmYSSrIK/Jni2TsIRGdZGOKe1Hdp+sXd 8RvcON0p9oEuU4eYHnwO3Ry3b/rEwrU= ARC-Authentication-Results: i=1; imf02.hostedemail.com; dkim=none; spf=pass (imf02.hostedemail.com: domain of shikemeng@huaweicloud.com designates 45.249.212.51 as permitted sender) smtp.mailfrom=shikemeng@huaweicloud.com; dmarc=none Received: from mail.maildlp.com (unknown [172.19.163.216]) by dggsgout11.his.huawei.com (SkyGuard) with ESMTP id 4TG2KF0lp1z4f3lD0 for ; Thu, 18 Jan 2024 20:35:45 +0800 (CST) Received: from mail02.huawei.com (unknown [10.116.40.128]) by mail.maildlp.com (Postfix) with ESMTP id 3FD441A017A for ; Thu, 18 Jan 2024 20:35:51 +0800 (CST) Received: from huaweicloud.com (unknown [10.175.124.27]) by APP4 (Coremail) with SMTP id gCh0CgAHWmwmG6lle9LlBA--.42947S2; Thu, 18 Jan 2024 20:35:51 +0800 (CST) From: Kemeng Shi To: viro@zeniv.linux.org.uk, brauner@kernel.org, jack@suse.cz, akpm@linux-foundation.org Cc: tj@kernel.org, xiujianfeng@huawei.com, linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org, linux-mm@kvack.org Subject: [PATCH] writeback: move wb_wakeup_delayed defination to fs-writeback.c Date: Fri, 19 Jan 2024 04:33:39 +0800 Message-Id: <20240118203339.764093-1-shikemeng@huaweicloud.com> X-Mailer: git-send-email 2.30.0 MIME-Version: 1.0 X-CM-TRANSID: gCh0CgAHWmwmG6lle9LlBA--.42947S2 X-Coremail-Antispam: 1UD129KBjvJXoWxZFy3ur1kKw4UJFWDury5CFg_yoWrJw17pF y3K3sxJF48Zry7WrsxWay2gr1Yg3ykKr47GFyxWFs7tr9rua1Y9FWvgry0yF1UCrZ3ZFW3 ur4FvrW8urW0yr7anT9S1TB71UUUUUUqnTZGkaVYY2UrUUUUjbIjqfuFe4nvWSU5nxnvy2 9KBjDU0xBIdaVrnRJUUUkYb4IE77IF4wAFF20E14v26r4j6ryUM7CY07I20VC2zVCF04k2 6cxKx2IYs7xG6rWj6s0DM7CIcVAFz4kK6r1j6r18M280x2IEY4vEnII2IxkI6r1a6r45M2 8lY4IEw2IIxxk0rwA2F7IY1VAKz4vEj48ve4kI8wA2z4x0Y4vE2Ix0cI8IcVAFwI0_Ar0_ tr1l84ACjcxK6xIIjxv20xvEc7CjxVAFwI0_Cr0_Gr1UM28EF7xvwVC2z280aVAFwI0_Gc CE3s1l84ACjcxK6I8E87Iv6xkF7I0E14v26rxl6s0DM2AIxVAIcxkEcVAq07x20xvEncxI r21l5I8CrVACY4xI64kE6c02F40Ex7xfMcIj6xIIjxv20xvE14v26r106r15McIj6I8E87 Iv67AKxVWUJVW8JwAm72CE4IkC6x0Yz7v_Jr0_Gr1lF7xvr2IYc2Ij64vIr41l42xK82IY c2Ij64vIr41l4I8I3I0E4IkC6x0Yz7v_Jr0_Gr1lx2IqxVAqx4xG67AKxVWUJVWUGwC20s 026x8GjcxK67AKxVWUGVWUWwC2zVAF1VAY17CE14v26r1q6r43MIIYrxkI7VAKI48JMIIF 0xvE2Ix0cI8IcVAFwI0_Jr0_JF4lIxAIcVC0I7IYx2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Y/poysPilWcuaI5zNuAX/g4wyfvwl041/uZmxk/R+9/S3leWIyp2OYPGLCPEuAqCU1973Q8fFI7u1Ty5IH6jZa0HJsDuk0os28pSirnIq0j0VkFfMKReHISVOb1TAPRL8CLWO5gKvF3j3pyx50tDLEgHf+XB+F0c6YpB3ykC9SNngJ3CjScAf0hpMfP5/rh/g/iMjoPgHGVRLMZSrsA1KVUyjS/6Ln/h1DcY4F eFWBkOLD qLhruk/m09M+FaNlnDMhLQ3S/khIU16b5CM47NOIRn/Ywzx4/1flbc+ldG0Yg3GmWDqvyT6+eErKfodTjhWJ4alZm0j1L+jKTmR/OOkkF46l05K0Q/M1G3ljiaHOdd0W1fFb3cZwuSJlH9xELItw+x1Lh4vbAeBMGgUOYIDYzPBtmhAkf5WjU4OKrtMuIxnTy59PmVtVCCOnFvHgeQK1aExGix9OOxZqny1VVE/87qUSgFTtZw5qWpl/znHexQ4/40/XMVcW/zlGxF6FxiouNeXvIrg6jAPUNbcWaW3cSOs0j4Fw= 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 wb_wakeup_delayed is only used in fs-writeback.c. Move it to fs-writeback.c after defination of wb_wakeup and make it static. Signed-off-by: Kemeng Shi Reviewed-by: Jan Kara --- fs/fs-writeback.c | 25 +++++++++++++++++++++++++ include/linux/backing-dev.h | 1 - mm/backing-dev.c | 25 ------------------------- 3 files changed, 25 insertions(+), 26 deletions(-) diff --git a/fs/fs-writeback.c b/fs/fs-writeback.c index 1767493dffda..5ab1aaf805f7 100644 --- a/fs/fs-writeback.c +++ b/fs/fs-writeback.c @@ -141,6 +141,31 @@ static void wb_wakeup(struct bdi_writeback *wb) spin_unlock_irq(&wb->work_lock); } +/* + * This function is used when the first inode for this wb is marked dirty. It + * wakes-up the corresponding bdi thread which should then take care of the + * periodic background write-out of dirty inodes. Since the write-out would + * starts only 'dirty_writeback_interval' centisecs from now anyway, we just + * set up a timer which wakes the bdi thread up later. + * + * Note, we wouldn't bother setting up the timer, but this function is on the + * fast-path (used by '__mark_inode_dirty()'), so we save few context switches + * by delaying the wake-up. + * + * We have to be careful not to postpone flush work if it is scheduled for + * earlier. Thus we use queue_delayed_work(). + */ +static void wb_wakeup_delayed(struct bdi_writeback *wb) +{ + unsigned long timeout; + + timeout = msecs_to_jiffies(dirty_writeback_interval * 10); + spin_lock_irq(&wb->work_lock); + if (test_bit(WB_registered, &wb->state)) + queue_delayed_work(bdi_wq, &wb->dwork, timeout); + spin_unlock_irq(&wb->work_lock); +} + static void finish_writeback_work(struct bdi_writeback *wb, struct wb_writeback_work *work) { diff --git a/include/linux/backing-dev.h b/include/linux/backing-dev.h index 1a97277f99b1..8e7af9a03b41 100644 --- a/include/linux/backing-dev.h +++ b/include/linux/backing-dev.h @@ -38,7 +38,6 @@ struct backing_dev_info *bdi_alloc(int node_id); void wb_start_background_writeback(struct bdi_writeback *wb); void wb_workfn(struct work_struct *work); -void wb_wakeup_delayed(struct bdi_writeback *wb); void wb_wait_for_completion(struct wb_completion *done); diff --git a/mm/backing-dev.c b/mm/backing-dev.c index 1e3447bccdb1..039dc74b505a 100644 --- a/mm/backing-dev.c +++ b/mm/backing-dev.c @@ -372,31 +372,6 @@ static int __init default_bdi_init(void) } subsys_initcall(default_bdi_init); -/* - * This function is used when the first inode for this wb is marked dirty. It - * wakes-up the corresponding bdi thread which should then take care of the - * periodic background write-out of dirty inodes. Since the write-out would - * starts only 'dirty_writeback_interval' centisecs from now anyway, we just - * set up a timer which wakes the bdi thread up later. - * - * Note, we wouldn't bother setting up the timer, but this function is on the - * fast-path (used by '__mark_inode_dirty()'), so we save few context switches - * by delaying the wake-up. - * - * We have to be careful not to postpone flush work if it is scheduled for - * earlier. Thus we use queue_delayed_work(). - */ -void wb_wakeup_delayed(struct bdi_writeback *wb) -{ - unsigned long timeout; - - timeout = msecs_to_jiffies(dirty_writeback_interval * 10); - spin_lock_irq(&wb->work_lock); - if (test_bit(WB_registered, &wb->state)) - queue_delayed_work(bdi_wq, &wb->dwork, timeout); - spin_unlock_irq(&wb->work_lock); -} - static void wb_update_bandwidth_workfn(struct work_struct *work) { struct bdi_writeback *wb = container_of(to_delayed_work(work),