linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/2] fs-writeback: Add helper function to start writeback if idle
@ 2009-12-11 23:05 Eric Sandeen
  2009-12-16 20:44 ` Jan Kara
  2009-12-18 11:44 ` Jens Axboe
  0 siblings, 2 replies; 6+ messages in thread
From: Eric Sandeen @ 2009-12-11 23:05 UTC (permalink / raw)
  To: ext4 development; +Cc: linux-fsdevel, Jens Axboe

ext4, at least, would like to start pushing on writeback if it starts
to get close to ENOSPC when reserving worst-case blocks for delalloc
writes.  Writing out delalloc data will convert those worst-case
predictions into usually smaller actual usage, freeing up space
before we hit ENOSPC based on this speculation.

Thanks to Jens for the suggestion for the helper function,
& the naming help.

I've made the helper return status on whether writeback was
started even though I don't plan to use it in the ext4 patch;
it seems like it would be potentially useful to test this
in some cases.

Signed-off-by: Eric Sandeen <sandeen@redhat.com>
---

diff --git a/fs/fs-writeback.c b/fs/fs-writeback.c
index 9d5360c..bff5f77 100644
--- a/fs/fs-writeback.c
+++ b/fs/fs-writeback.c
@@ -1213,6 +1213,23 @@ void writeback_inodes_sb(struct super_block *sb)
 EXPORT_SYMBOL(writeback_inodes_sb);
 
 /**
+ * writeback_inodes_sb_if_idle	-	start writeback if none underway
+ * @sb: the superblock
+ *
+ * Invoke writeback_inodes_sb if no writeback is currently underway.
+ * Returns 1 if writeback was started, 0 if not.
+ */
+int writeback_inodes_sb_if_idle(struct super_block *sb)
+{
+	if (!writeback_in_progress(sb->s_bdi)) {
+		writeback_inodes_sb(sb);
+		return 1;
+	} else
+		return 0;
+}
+EXPORT_SYMBOL(writeback_inodes_sb_if_idle);
+
+/**
  * sync_inodes_sb	-	sync sb inode pages
  * @sb: the superblock
  *
diff --git a/include/linux/writeback.h b/include/linux/writeback.h
index 66ebddc..dc52482 100644
--- a/include/linux/writeback.h
+++ b/include/linux/writeback.h
@@ -69,6 +69,7 @@ struct writeback_control {
 struct bdi_writeback;
 int inode_wait(void *);
 void writeback_inodes_sb(struct super_block *);
+int writeback_inodes_sb_if_idle(struct super_block *);
 void sync_inodes_sb(struct super_block *);
 void writeback_inodes_wbc(struct writeback_control *wbc);
 long wb_do_writeback(struct bdi_writeback *wb, int force_wait);


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

* Re: [PATCH 1/2] fs-writeback: Add helper function to start writeback if idle
  2009-12-11 23:05 [PATCH 1/2] fs-writeback: Add helper function to start writeback if idle Eric Sandeen
@ 2009-12-16 20:44 ` Jan Kara
  2009-12-18 11:44 ` Jens Axboe
  1 sibling, 0 replies; 6+ messages in thread
From: Jan Kara @ 2009-12-16 20:44 UTC (permalink / raw)
  To: Eric Sandeen; +Cc: ext4 development, linux-fsdevel, Jens Axboe

> ext4, at least, would like to start pushing on writeback if it starts
> to get close to ENOSPC when reserving worst-case blocks for delalloc
> writes.  Writing out delalloc data will convert those worst-case
> predictions into usually smaller actual usage, freeing up space
> before we hit ENOSPC based on this speculation.
> 
> Thanks to Jens for the suggestion for the helper function,
> & the naming help.
> 
> I've made the helper return status on whether writeback was
> started even though I don't plan to use it in the ext4 patch;
> it seems like it would be potentially useful to test this
> in some cases.
> 
> Signed-off-by: Eric Sandeen <sandeen@redhat.com>
  The patch looks good.
Acked-by: Jan Kara <jack@suse.cz>

								Honza

> ---
> 
> diff --git a/fs/fs-writeback.c b/fs/fs-writeback.c
> index 9d5360c..bff5f77 100644
> --- a/fs/fs-writeback.c
> +++ b/fs/fs-writeback.c
> @@ -1213,6 +1213,23 @@ void writeback_inodes_sb(struct super_block *sb)
>  EXPORT_SYMBOL(writeback_inodes_sb);
>  
>  /**
> + * writeback_inodes_sb_if_idle	-	start writeback if none underway
> + * @sb: the superblock
> + *
> + * Invoke writeback_inodes_sb if no writeback is currently underway.
> + * Returns 1 if writeback was started, 0 if not.
> + */
> +int writeback_inodes_sb_if_idle(struct super_block *sb)
> +{
> +	if (!writeback_in_progress(sb->s_bdi)) {
> +		writeback_inodes_sb(sb);
> +		return 1;
> +	} else
> +		return 0;
> +}
> +EXPORT_SYMBOL(writeback_inodes_sb_if_idle);
> +
> +/**
>   * sync_inodes_sb	-	sync sb inode pages
>   * @sb: the superblock
>   *
> diff --git a/include/linux/writeback.h b/include/linux/writeback.h
> index 66ebddc..dc52482 100644
> --- a/include/linux/writeback.h
> +++ b/include/linux/writeback.h
> @@ -69,6 +69,7 @@ struct writeback_control {
>  struct bdi_writeback;
>  int inode_wait(void *);
>  void writeback_inodes_sb(struct super_block *);
> +int writeback_inodes_sb_if_idle(struct super_block *);
>  void sync_inodes_sb(struct super_block *);
>  void writeback_inodes_wbc(struct writeback_control *wbc);
>  long wb_do_writeback(struct bdi_writeback *wb, int force_wait);
> 
> --
> To unsubscribe from this list: send the line "unsubscribe linux-ext4" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
-- 
Jan Kara <jack@suse.cz>
SuSE CR Labs

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

* Re: [PATCH 1/2] fs-writeback: Add helper function to start writeback  if idle
  2009-12-11 23:05 [PATCH 1/2] fs-writeback: Add helper function to start writeback if idle Eric Sandeen
  2009-12-16 20:44 ` Jan Kara
@ 2009-12-18 11:44 ` Jens Axboe
  2009-12-18 15:29   ` Eric Sandeen
  1 sibling, 1 reply; 6+ messages in thread
From: Jens Axboe @ 2009-12-18 11:44 UTC (permalink / raw)
  To: Eric Sandeen; +Cc: ext4 development, linux-fsdevel

On Fri, Dec 11 2009, Eric Sandeen wrote:
> ext4, at least, would like to start pushing on writeback if it starts
> to get close to ENOSPC when reserving worst-case blocks for delalloc
> writes.  Writing out delalloc data will convert those worst-case
> predictions into usually smaller actual usage, freeing up space
> before we hit ENOSPC based on this speculation.
> 
> Thanks to Jens for the suggestion for the helper function,
> & the naming help.
> 
> I've made the helper return status on whether writeback was
> started even though I don't plan to use it in the ext4 patch;
> it seems like it would be potentially useful to test this
> in some cases.

Eric, how do you want to merge these? I can easily take this first one
through any branch, but I suppose the ext4 one should go through the
proper ext4 channels.

-- 
Jens Axboe


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

* Re: [PATCH 1/2] fs-writeback: Add helper function to start writeback if idle
  2009-12-18 11:44 ` Jens Axboe
@ 2009-12-18 15:29   ` Eric Sandeen
  2009-12-18 15:33     ` Jens Axboe
  0 siblings, 1 reply; 6+ messages in thread
From: Eric Sandeen @ 2009-12-18 15:29 UTC (permalink / raw)
  To: Jens Axboe; +Cc: ext4 development, linux-fsdevel

Jens Axboe wrote:
> On Fri, Dec 11 2009, Eric Sandeen wrote:
>> ext4, at least, would like to start pushing on writeback if it starts
>> to get close to ENOSPC when reserving worst-case blocks for delalloc
>> writes.  Writing out delalloc data will convert those worst-case
>> predictions into usually smaller actual usage, freeing up space
>> before we hit ENOSPC based on this speculation.
>>
>> Thanks to Jens for the suggestion for the helper function,
>> & the naming help.
>>
>> I've made the helper return status on whether writeback was
>> started even though I don't plan to use it in the ext4 patch;
>> it seems like it would be potentially useful to test this
>> in some cases.
> 
> Eric, how do you want to merge these? I can easily take this first one
> through any branch, but I suppose the ext4 one should go through the
> proper ext4 channels.

Doesn't matter to me really; maybe it'd be simpler if it all went
though the ext4 tree so that there aren't any ordering problems?

-Eric

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

* Re: [PATCH 1/2] fs-writeback: Add helper function to start writeback   if idle
  2009-12-18 15:29   ` Eric Sandeen
@ 2009-12-18 15:33     ` Jens Axboe
  2009-12-23 13:00       ` tytso
  0 siblings, 1 reply; 6+ messages in thread
From: Jens Axboe @ 2009-12-18 15:33 UTC (permalink / raw)
  To: Eric Sandeen; +Cc: ext4 development, linux-fsdevel

On Fri, Dec 18 2009, Eric Sandeen wrote:
> Jens Axboe wrote:
> > On Fri, Dec 11 2009, Eric Sandeen wrote:
> >> ext4, at least, would like to start pushing on writeback if it starts
> >> to get close to ENOSPC when reserving worst-case blocks for delalloc
> >> writes.  Writing out delalloc data will convert those worst-case
> >> predictions into usually smaller actual usage, freeing up space
> >> before we hit ENOSPC based on this speculation.
> >>
> >> Thanks to Jens for the suggestion for the helper function,
> >> & the naming help.
> >>
> >> I've made the helper return status on whether writeback was
> >> started even though I don't plan to use it in the ext4 patch;
> >> it seems like it would be potentially useful to test this
> >> in some cases.
> > 
> > Eric, how do you want to merge these? I can easily take this first one
> > through any branch, but I suppose the ext4 one should go through the
> > proper ext4 channels.
> 
> Doesn't matter to me really; maybe it'd be simpler if it all went
> though the ext4 tree so that there aren't any ordering problems?

Definately :-)

-- 
Jens Axboe


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

* Re: [PATCH 1/2] fs-writeback: Add helper function to start writeback   if idle
  2009-12-18 15:33     ` Jens Axboe
@ 2009-12-23 13:00       ` tytso
  0 siblings, 0 replies; 6+ messages in thread
From: tytso @ 2009-12-23 13:00 UTC (permalink / raw)
  To: Jens Axboe; +Cc: Eric Sandeen, ext4 development, linux-fsdevel

On Fri, Dec 18, 2009 at 04:33:36PM +0100, Jens Axboe wrote:
> > Doesn't matter to me really; maybe it'd be simpler if it all went
> > though the ext4 tree so that there aren't any ordering problems?
> 
> Definately :-)

Thanks, I've added them to the ext4 patch queue.

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

end of thread, other threads:[~2009-12-23 13:00 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-12-11 23:05 [PATCH 1/2] fs-writeback: Add helper function to start writeback if idle Eric Sandeen
2009-12-16 20:44 ` Jan Kara
2009-12-18 11:44 ` Jens Axboe
2009-12-18 15:29   ` Eric Sandeen
2009-12-18 15:33     ` Jens Axboe
2009-12-23 13:00       ` tytso

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).