From mboxrd@z Thu Jan 1 00:00:00 1970 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 6CCE9C4725D for ; Fri, 19 Jan 2024 15:27:05 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id CFA806B0083; Fri, 19 Jan 2024 10:27:04 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id CAAAA6B0085; Fri, 19 Jan 2024 10:27:04 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id B4B206B0087; Fri, 19 Jan 2024 10:27:04 -0500 (EST) 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 A6AA76B0083 for ; Fri, 19 Jan 2024 10:27:04 -0500 (EST) Received: from smtpin23.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay06.hostedemail.com (Postfix) with ESMTP id 68145A1B5D for ; Fri, 19 Jan 2024 15:27:04 +0000 (UTC) X-FDA: 81696438768.23.57FDA99 Received: from smtp-out2.suse.de (smtp-out2.suse.de [195.135.223.131]) by imf15.hostedemail.com (Postfix) with ESMTP id 1D704A0024 for ; Fri, 19 Jan 2024 15:27:01 +0000 (UTC) Authentication-Results: imf15.hostedemail.com; dkim=pass header.d=suse.cz header.s=susede2_rsa header.b=nWM6ElDs; dkim=pass header.d=suse.cz header.s=susede2_ed25519 header.b=dNXizWJn; dkim=pass header.d=suse.cz header.s=susede2_rsa header.b=nWM6ElDs; dkim=pass header.d=suse.cz header.s=susede2_ed25519 header.b=dNXizWJn; dmarc=none; spf=pass (imf15.hostedemail.com: domain of jack@suse.cz designates 195.135.223.131 as permitted sender) smtp.mailfrom=jack@suse.cz ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1705678022; 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: in-reply-to:in-reply-to:references:references:dkim-signature; bh=vxcPS0/G6HHJ5b5iYVi8rX0C+ZxopTM5emRTtqK5mEc=; b=4nRl45q8GAUwIIDkl98XO8eYv+ZGnoQlNVLwONr+X351S3dk2gru7kM4alMyUIHgV5Qgc9 hC3uqAFSgCpwHFLiw/MOoj41XMsPdqDzvLyCwhw3IBdVMMpTXbi0MtsKhx1luKsE9aDlAI 0UIS7uXpb1MDZB+htQxXuE31lNBlQi4= ARC-Authentication-Results: i=1; imf15.hostedemail.com; dkim=pass header.d=suse.cz header.s=susede2_rsa header.b=nWM6ElDs; dkim=pass header.d=suse.cz header.s=susede2_ed25519 header.b=dNXizWJn; dkim=pass header.d=suse.cz header.s=susede2_rsa header.b=nWM6ElDs; dkim=pass header.d=suse.cz header.s=susede2_ed25519 header.b=dNXizWJn; dmarc=none; spf=pass (imf15.hostedemail.com: domain of jack@suse.cz designates 195.135.223.131 as permitted sender) smtp.mailfrom=jack@suse.cz ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1705678022; a=rsa-sha256; cv=none; b=c8TVWUhdir+Q5uWP8HmiJxpAkmGwd/7G8HJUC4dP9aGCPlHZl4o8R6Vra2vdqpO9XGNzmW ZPjeqMa9OQ1MxZLRyMJTVm9ojFhibMbkkuLacPpg1PcQigRrvi0NJ7ZaB+rij7iXywdvRy nWZuQZaQ/eoPjRxypBlupAKFG38d1LM= Received: from imap1.dmz-prg2.suse.org (imap1.dmz-prg2.suse.org [IPv6:2a07:de40:b281:104:10:150:64:97]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by smtp-out2.suse.de (Postfix) with ESMTPS id 546DF1F7F9; Fri, 19 Jan 2024 15:27:00 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_rsa; t=1705678020; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=vxcPS0/G6HHJ5b5iYVi8rX0C+ZxopTM5emRTtqK5mEc=; b=nWM6ElDsO70gVDzIpw/X5OmojQFWVg/b/CD497QQi7snPAYNYzEHuJ7rHYQtoiNDT59S/A a/Pqa7Dr7xQkI/kI5ceavl0ALoQFu1u/LQz3V1mj0NcKi/KykjlIwAlGiOiawov4LB579z 8em9bFDW9httwADNp3xaJAm3RGRtQLE= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_ed25519; t=1705678020; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=vxcPS0/G6HHJ5b5iYVi8rX0C+ZxopTM5emRTtqK5mEc=; b=dNXizWJnimFWh8EDbrLRiAzjUlrUXxZgfydlBxFe+TvWNgZaIPQfZnWGNRwtkHykTdLfSy LQ1glfjwFfUmSsAQ== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_rsa; t=1705678020; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=vxcPS0/G6HHJ5b5iYVi8rX0C+ZxopTM5emRTtqK5mEc=; b=nWM6ElDsO70gVDzIpw/X5OmojQFWVg/b/CD497QQi7snPAYNYzEHuJ7rHYQtoiNDT59S/A a/Pqa7Dr7xQkI/kI5ceavl0ALoQFu1u/LQz3V1mj0NcKi/KykjlIwAlGiOiawov4LB579z 8em9bFDW9httwADNp3xaJAm3RGRtQLE= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_ed25519; t=1705678020; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=vxcPS0/G6HHJ5b5iYVi8rX0C+ZxopTM5emRTtqK5mEc=; b=dNXizWJnimFWh8EDbrLRiAzjUlrUXxZgfydlBxFe+TvWNgZaIPQfZnWGNRwtkHykTdLfSy LQ1glfjwFfUmSsAQ== Received: from imap1.dmz-prg2.suse.org (localhost [127.0.0.1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by imap1.dmz-prg2.suse.org (Postfix) with ESMTPS id 49B831388C; Fri, 19 Jan 2024 15:27:00 +0000 (UTC) Received: from dovecot-director2.suse.de ([2a07:de40:b281:106:10:150:64:167]) by imap1.dmz-prg2.suse.org with ESMTPSA id 5N/2EcSUqmUxRQAAD6G6ig (envelope-from ); Fri, 19 Jan 2024 15:27:00 +0000 Received: by quack3.suse.cz (Postfix, from userid 1000) id DB033A0803; Fri, 19 Jan 2024 16:26:59 +0100 (CET) Date: Fri, 19 Jan 2024 16:26:59 +0100 From: Jan Kara To: Kemeng Shi Cc: viro@zeniv.linux.org.uk, brauner@kernel.org, jack@suse.cz, akpm@linux-foundation.org, tj@kernel.org, xiujianfeng@huawei.com, linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org, linux-mm@kvack.org Subject: Re: [PATCH] writeback: move wb_wakeup_delayed defination to fs-writeback.c Message-ID: <20240119152659.fvfk2axsd2pwhebk@quack3> References: <20240118203339.764093-1-shikemeng@huaweicloud.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20240118203339.764093-1-shikemeng@huaweicloud.com> X-Spamd-Bar: +++++ X-Rspam-User: X-Stat-Signature: ujgrdhd3wbum8p8jbwgamomxtuecwzty X-Rspamd-Server: rspam07 X-Rspamd-Queue-Id: 1D704A0024 X-HE-T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FACaYcLEM9xmH4nXZHJ7PfBEsivj9F4Fd4gs+s/h96ADzWmctMrxB8Jp9G/8A7ixsC12joxzEN22uD/7Oex6uzlio89n2PZwx9JbY61C+6aCE5EsanCByUlo9qWKQTUirP9e5EJwfkRwFCNmdvRFhrR5zlvpU+51Ebs5eAFIE7XL+lFfNkh5kwrdYA9YLl9yhLHJdZ+col46tebX/DPYJ78B7Ava4DVz0lwzPzIFJ0j7aVw9AeyF89BtPjRRfElrYJZTLY2+nEIsbaOnVHjENazhKuCvZTipzp9G4RwhZw6bmo4MwLCmoGBn7TmA 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: On Fri 19-01-24 04:33:39, Kemeng Shi wrote: > 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 Yeah, not sure why it was left there. Feel free to add: Reviewed-by: Jan Kara Honza > --- > 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), > -- > 2.30.0 > -- Jan Kara SUSE Labs, CR