fs-writeback: Add helper function to start writeback if idle
Subsystems (2)
PATCH 1/2 fs-writeback: Add helper function to start writeback if idle
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.
---
fs/fs-writeback.c +17 -0
@@ -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 *
include/linux/writeback.h +1 -0
@@ -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);
Quoted 9 lines
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.
Quoted 6 lines
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 <[email protected]>
The patch looks good.
Honza
Quoted 47 lines
---
fs/fs-writeback.c +17
-0@@ -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 * include/linux/writeback.h +1
-1@@ -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 [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Signature · 2 lines
Jan Kara <[email protected]> SuSE CR Labs
Quoted 6 lines · Eric Sandeen
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.
Quoted 7 lines
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.
Signature · 1 line
Jens Axboe
Quoted 10 lines · Jens Axboe
Quoted 9 lines · Eric Sandeen
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.
Quoted 8 lines
Quoted 4 lines
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
Quoted 16 lines · Eric Sandeen
Quoted 15 lines · Jens Axboe
Quoted 13 lines · Eric Sandeen
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.
Quoted 6 lines
Quoted 3 lines
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 :-)
Signature · 1 line
Jens Axboe
Quoted 4 lines · Jens Axboe
Quoted 2 lines
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.