linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* Re: [PATCH] writeback: move wb_wakeup_delayed defination to fs-writeback.c
  2024-01-18 20:33 [PATCH] writeback: move wb_wakeup_delayed defination to fs-writeback.c Kemeng Shi
@ 2024-01-18 14:36 ` Christian Brauner
  2024-01-19 15:26 ` Jan Kara
  2024-01-22 10:57 ` Christian Brauner
  2 siblings, 0 replies; 4+ messages in thread
From: Christian Brauner @ 2024-01-18 14:36 UTC (permalink / raw)
  To: Kemeng Shi, jack
  Cc: viro, akpm, tj, xiujianfeng, linux-fsdevel, linux-kernel,
	linux-mm

On Fri, Jan 19, 2024 at 04:33:39AM +0800, 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 <shikemeng@huaweicloud.com>
> ---

I'll leave that for Jan to review.

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [PATCH] writeback: move wb_wakeup_delayed defination to fs-writeback.c
@ 2024-01-18 20:33 Kemeng Shi
  2024-01-18 14:36 ` Christian Brauner
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Kemeng Shi @ 2024-01-18 20:33 UTC (permalink / raw)
  To: viro, brauner, jack, akpm
  Cc: tj, xiujianfeng, linux-fsdevel, linux-kernel, linux-mm

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 <shikemeng@huaweicloud.com>
---
 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


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] writeback: move wb_wakeup_delayed defination to fs-writeback.c
  2024-01-18 20:33 [PATCH] writeback: move wb_wakeup_delayed defination to fs-writeback.c Kemeng Shi
  2024-01-18 14:36 ` Christian Brauner
@ 2024-01-19 15:26 ` Jan Kara
  2024-01-22 10:57 ` Christian Brauner
  2 siblings, 0 replies; 4+ messages in thread
From: Jan Kara @ 2024-01-19 15:26 UTC (permalink / raw)
  To: Kemeng Shi
  Cc: viro, brauner, jack, akpm, tj, xiujianfeng, linux-fsdevel,
	linux-kernel, linux-mm

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 <shikemeng@huaweicloud.com>

Yeah, not sure why it was left there. Feel free to add:

Reviewed-by: Jan Kara <jack@suse.cz>

								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 <jack@suse.com>
SUSE Labs, CR

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] writeback: move wb_wakeup_delayed defination to fs-writeback.c
  2024-01-18 20:33 [PATCH] writeback: move wb_wakeup_delayed defination to fs-writeback.c Kemeng Shi
  2024-01-18 14:36 ` Christian Brauner
  2024-01-19 15:26 ` Jan Kara
@ 2024-01-22 10:57 ` Christian Brauner
  2 siblings, 0 replies; 4+ messages in thread
From: Christian Brauner @ 2024-01-22 10:57 UTC (permalink / raw)
  To: Kemeng Shi
  Cc: Christian Brauner, tj, xiujianfeng, linux-fsdevel, linux-kernel,
	linux-mm, viro, jack, akpm

On Fri, 19 Jan 2024 04:33:39 +0800, 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.
> 
> 

Applied to the vfs.misc branch of the vfs/vfs.git tree.
Patches in the vfs.misc branch should appear in linux-next soon.

Please report any outstanding bugs that were missed during review in a
new review to the original patch series allowing us to drop it.

It's encouraged to provide Acked-bys and Reviewed-bys even though the
patch has now been applied. If possible patch trailers will be updated.

Note that commit hashes shown below are subject to change due to rebase,
trailer updates or similar. If in doubt, please check the listed branch.

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/vfs/vfs.git
branch: vfs.misc

[1/1] writeback: move wb_wakeup_delayed defination to fs-writeback.c
      https://git.kernel.org/vfs/vfs/c/983d926149ea

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2024-01-22 10:57 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-01-18 20:33 [PATCH] writeback: move wb_wakeup_delayed defination to fs-writeback.c Kemeng Shi
2024-01-18 14:36 ` Christian Brauner
2024-01-19 15:26 ` Jan Kara
2024-01-22 10:57 ` Christian Brauner

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).