diff options
author | Chris Mason <chris.mason@oracle.com> | 2008-11-06 22:02:51 -0500 |
---|---|---|
committer | Chris Mason <chris.mason@oracle.com> | 2008-11-06 22:02:51 -0500 |
commit | 771ed689d2cd53439e28e095bc38fbe40a71429e (patch) | |
tree | 518801f7141928e398d40c2b5955720d4346ce1a /fs/btrfs/super.c | |
parent | 4a69a41009c4ac691f7d9c289f5f37fabeddce46 (diff) |
Btrfs: Optimize compressed writeback and reads
When reading compressed extents, try to put pages into the page cache
for any pages covered by the compressed extent that readpages didn't already
preload.
Add an async work queue to handle transformations at delayed allocation processing
time. Right now this is just compression. The workflow is:
1) Find offsets in the file marked for delayed allocation
2) Lock the pages
3) Lock the state bits
4) Call the async delalloc code
The async delalloc code clears the state lock bits and delalloc bits. It is
important this happens before the range goes into the work queue because
otherwise it might deadlock with other work queue items that try to lock
those extent bits.
The file pages are compressed, and if the compression doesn't work the
pages are written back directly.
An ordered work queue is used to make sure the inodes are written in the same
order that pdflush or writepages sent them down.
This changes extent_write_cache_pages to let the writepage function
update the wbc nr_written count.
Signed-off-by: Chris Mason <chris.mason@oracle.com>
Diffstat (limited to 'fs/btrfs/super.c')
-rw-r--r-- | fs/btrfs/super.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/fs/btrfs/super.c b/fs/btrfs/super.c index 431fdf144b58..ab9d5e89ed13 100644 --- a/fs/btrfs/super.c +++ b/fs/btrfs/super.c | |||
@@ -375,6 +375,10 @@ int btrfs_sync_fs(struct super_block *sb, int wait) | |||
375 | filemap_flush(root->fs_info->btree_inode->i_mapping); | 375 | filemap_flush(root->fs_info->btree_inode->i_mapping); |
376 | return 0; | 376 | return 0; |
377 | } | 377 | } |
378 | |||
379 | btrfs_start_delalloc_inodes(root); | ||
380 | btrfs_wait_ordered_extents(root, 0); | ||
381 | |||
378 | btrfs_clean_old_snapshots(root); | 382 | btrfs_clean_old_snapshots(root); |
379 | trans = btrfs_start_transaction(root, 1); | 383 | trans = btrfs_start_transaction(root, 1); |
380 | ret = btrfs_commit_transaction(trans, root); | 384 | ret = btrfs_commit_transaction(trans, root); |