diff options
author | Chris Mason <chris.mason@oracle.com> | 2009-06-09 20:28:34 -0400 |
---|---|---|
committer | Chris Mason <chris.mason@oracle.com> | 2009-06-10 11:29:52 -0400 |
commit | 451d7585a8bb1b9bec0d676ce3dece1923164e55 (patch) | |
tree | b4e9103b7010e45e02deff9ae4470df71475f8de /fs/btrfs/free-space-cache.c | |
parent | c604480171c510c1beeb81b82418e5bc4de8f1ae (diff) |
Btrfs: add mount -o ssd_spread to spread allocations out
Some SSDs perform best when reusing block numbers often, while
others perform much better when clustering strictly allocates
big chunks of unused space.
The default mount -o ssd will find rough groupings of blocks
where there are a bunch of free blocks that might have some
allocated blocks mixed in.
mount -o ssd_spread will make sure there are no allocated blocks
mixed in. It should perform better on lower end SSDs.
Signed-off-by: Chris Mason <chris.mason@oracle.com>
Diffstat (limited to 'fs/btrfs/free-space-cache.c')
-rw-r--r-- | fs/btrfs/free-space-cache.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/fs/btrfs/free-space-cache.c b/fs/btrfs/free-space-cache.c index ac23476beb6e..4538e48581a5 100644 --- a/fs/btrfs/free-space-cache.c +++ b/fs/btrfs/free-space-cache.c | |||
@@ -579,6 +579,7 @@ out: | |||
579 | * it returns -enospc | 579 | * it returns -enospc |
580 | */ | 580 | */ |
581 | int btrfs_find_space_cluster(struct btrfs_trans_handle *trans, | 581 | int btrfs_find_space_cluster(struct btrfs_trans_handle *trans, |
582 | struct btrfs_root *root, | ||
582 | struct btrfs_block_group_cache *block_group, | 583 | struct btrfs_block_group_cache *block_group, |
583 | struct btrfs_free_cluster *cluster, | 584 | struct btrfs_free_cluster *cluster, |
584 | u64 offset, u64 bytes, u64 empty_size) | 585 | u64 offset, u64 bytes, u64 empty_size) |
@@ -595,7 +596,9 @@ int btrfs_find_space_cluster(struct btrfs_trans_handle *trans, | |||
595 | int ret; | 596 | int ret; |
596 | 597 | ||
597 | /* for metadata, allow allocates with more holes */ | 598 | /* for metadata, allow allocates with more holes */ |
598 | if (block_group->flags & BTRFS_BLOCK_GROUP_METADATA) { | 599 | if (btrfs_test_opt(root, SSD_SPREAD)) { |
600 | min_bytes = bytes + empty_size; | ||
601 | } else if (block_group->flags & BTRFS_BLOCK_GROUP_METADATA) { | ||
599 | /* | 602 | /* |
600 | * we want to do larger allocations when we are | 603 | * we want to do larger allocations when we are |
601 | * flushing out the delayed refs, it helps prevent | 604 | * flushing out the delayed refs, it helps prevent |