diff options
author | Chris Mason <chris.mason@oracle.com> | 2008-03-24 15:02:07 -0400 |
---|---|---|
committer | Chris Mason <chris.mason@oracle.com> | 2008-09-25 11:04:01 -0400 |
commit | 239b14b32dc39232ebf9cce29ff77c4c564355fd (patch) | |
tree | f7a95d97d71ef9d0f355a71a83e2ba1f62944e04 /fs/btrfs/inode.c | |
parent | 0d81ba5dbedef0c3970d6aa318aa84920943e6e3 (diff) |
Btrfs: Bring back mount -o ssd optimizations
Signed-off-by: Chris Mason <chris.mason@oracle.com>
Diffstat (limited to 'fs/btrfs/inode.c')
-rw-r--r-- | fs/btrfs/inode.c | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c index 109576b57f69..5140d6801846 100644 --- a/fs/btrfs/inode.c +++ b/fs/btrfs/inode.c | |||
@@ -296,6 +296,34 @@ int btrfs_clear_bit_hook(struct inode *inode, u64 start, u64 end, | |||
296 | return 0; | 296 | return 0; |
297 | } | 297 | } |
298 | 298 | ||
299 | int btrfs_merge_bio_hook(struct page *page, unsigned long offset, | ||
300 | size_t size, struct bio *bio) | ||
301 | { | ||
302 | struct btrfs_root *root = BTRFS_I(page->mapping->host)->root; | ||
303 | struct btrfs_mapping_tree *map_tree; | ||
304 | struct btrfs_device *dev; | ||
305 | u64 logical = bio->bi_sector << 9; | ||
306 | u64 physical; | ||
307 | u64 length = 0; | ||
308 | u64 map_length; | ||
309 | struct bio_vec *bvec; | ||
310 | int i; | ||
311 | int ret; | ||
312 | |||
313 | bio_for_each_segment(bvec, bio, i) { | ||
314 | length += bvec->bv_len; | ||
315 | } | ||
316 | map_tree = &root->fs_info->mapping_tree; | ||
317 | map_length = length; | ||
318 | ret = btrfs_map_block(map_tree, logical, &physical, &map_length, &dev); | ||
319 | if (map_length < length + size) { | ||
320 | printk("merge bio hook logical %Lu bio len %Lu physical %Lu " | ||
321 | "len %Lu\n", logical, length, physical, map_length); | ||
322 | return 1; | ||
323 | } | ||
324 | return 0; | ||
325 | } | ||
326 | |||
299 | int btrfs_submit_bio_hook(struct inode *inode, int rw, struct bio *bio) | 327 | int btrfs_submit_bio_hook(struct inode *inode, int rw, struct bio *bio) |
300 | { | 328 | { |
301 | struct btrfs_root *root = BTRFS_I(inode)->root; | 329 | struct btrfs_root *root = BTRFS_I(inode)->root; |
@@ -3033,6 +3061,7 @@ static struct file_operations btrfs_dir_file_operations = { | |||
3033 | static struct extent_io_ops btrfs_extent_io_ops = { | 3061 | static struct extent_io_ops btrfs_extent_io_ops = { |
3034 | .fill_delalloc = run_delalloc_range, | 3062 | .fill_delalloc = run_delalloc_range, |
3035 | .submit_bio_hook = btrfs_submit_bio_hook, | 3063 | .submit_bio_hook = btrfs_submit_bio_hook, |
3064 | .merge_bio_hook = btrfs_merge_bio_hook, | ||
3036 | .readpage_io_hook = btrfs_readpage_io_hook, | 3065 | .readpage_io_hook = btrfs_readpage_io_hook, |
3037 | .readpage_end_io_hook = btrfs_readpage_end_io_hook, | 3066 | .readpage_end_io_hook = btrfs_readpage_end_io_hook, |
3038 | .set_bit_hook = btrfs_set_bit_hook, | 3067 | .set_bit_hook = btrfs_set_bit_hook, |