aboutsummaryrefslogtreecommitdiffstats
path: root/fs/btrfs/inode.c
diff options
context:
space:
mode:
authorChris Mason <chris.mason@oracle.com>2008-03-24 15:01:56 -0400
committerChris Mason <chris.mason@oracle.com>2008-09-25 11:04:00 -0400
commit0b86a832a1f38abec695864ec2eaedc9d2383f1b (patch)
tree8ec0db0b55f77eb6a23fe7db3c1064d298db55c1 /fs/btrfs/inode.c
parent7f93bf8d27653726e3721c01fefc523487ecf2af (diff)
Btrfs: Add support for multiple devices per filesystem
Signed-off-by: Chris Mason <chris.mason@oracle.com>
Diffstat (limited to 'fs/btrfs/inode.c')
-rw-r--r--fs/btrfs/inode.c26
1 files changed, 15 insertions, 11 deletions
diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c
index 315dd550d560..17063cd2cb73 100644
--- a/fs/btrfs/inode.c
+++ b/fs/btrfs/inode.c
@@ -40,6 +40,7 @@
40#include "btrfs_inode.h" 40#include "btrfs_inode.h"
41#include "ioctl.h" 41#include "ioctl.h"
42#include "print-tree.h" 42#include "print-tree.h"
43#include "volumes.h"
43 44
44struct btrfs_iget_args { 45struct btrfs_iget_args {
45 u64 ino; 46 u64 ino;
@@ -295,20 +296,20 @@ int btrfs_clear_bit_hook(struct inode *inode, u64 start, u64 end,
295 return 0; 296 return 0;
296} 297}
297 298
298int btrfs_submit_bio_hook(int rw, struct bio *bio) 299int btrfs_submit_bio_hook(struct inode *inode, int rw, struct bio *bio)
299{ 300{
300 struct bio_vec *bvec = bio->bi_io_vec;
301 struct inode *inode = bvec->bv_page->mapping->host;
302 struct btrfs_root *root = BTRFS_I(inode)->root; 301 struct btrfs_root *root = BTRFS_I(inode)->root;
303 struct btrfs_trans_handle *trans; 302 struct btrfs_trans_handle *trans;
304 int ret = 0; 303 int ret = 0;
305 304
306 if (rw != WRITE) 305 if (rw != WRITE) {
307 return 0; 306 goto mapit;
307 }
308 308
309 if (btrfs_test_opt(root, NODATASUM) || 309 if (btrfs_test_opt(root, NODATASUM) ||
310 btrfs_test_flag(inode, NODATASUM)) 310 btrfs_test_flag(inode, NODATASUM)) {
311 return 0; 311 goto mapit;
312 }
312 313
313 mutex_lock(&root->fs_info->fs_mutex); 314 mutex_lock(&root->fs_info->fs_mutex);
314 trans = btrfs_start_transaction(root, 1); 315 trans = btrfs_start_transaction(root, 1);
@@ -317,7 +318,8 @@ int btrfs_submit_bio_hook(int rw, struct bio *bio)
317 ret = btrfs_end_transaction(trans, root); 318 ret = btrfs_end_transaction(trans, root);
318 BUG_ON(ret); 319 BUG_ON(ret);
319 mutex_unlock(&root->fs_info->fs_mutex); 320 mutex_unlock(&root->fs_info->fs_mutex);
320 return ret; 321mapit:
322 return btrfs_map_bio(root, rw, bio);
321} 323}
322 324
323int btrfs_readpage_io_hook(struct page *page, u64 start, u64 end) 325int btrfs_readpage_io_hook(struct page *page, u64 start, u64 end)
@@ -406,7 +408,7 @@ void btrfs_read_locked_inode(struct inode *inode)
406 struct btrfs_path *path; 408 struct btrfs_path *path;
407 struct extent_buffer *leaf; 409 struct extent_buffer *leaf;
408 struct btrfs_inode_item *inode_item; 410 struct btrfs_inode_item *inode_item;
409 struct btrfs_inode_timespec *tspec; 411 struct btrfs_timespec *tspec;
410 struct btrfs_root *root = BTRFS_I(inode)->root; 412 struct btrfs_root *root = BTRFS_I(inode)->root;
411 struct btrfs_key location; 413 struct btrfs_key location;
412 u64 alloc_group_block; 414 u64 alloc_group_block;
@@ -455,7 +457,8 @@ void btrfs_read_locked_inode(struct inode *inode)
455 BTRFS_I(inode)->flags = btrfs_inode_flags(leaf, inode_item); 457 BTRFS_I(inode)->flags = btrfs_inode_flags(leaf, inode_item);
456 if (!BTRFS_I(inode)->block_group) { 458 if (!BTRFS_I(inode)->block_group) {
457 BTRFS_I(inode)->block_group = btrfs_find_block_group(root, 459 BTRFS_I(inode)->block_group = btrfs_find_block_group(root,
458 NULL, 0, 0, 0); 460 NULL, 0,
461 BTRFS_BLOCK_GROUP_METADATA, 0);
459 } 462 }
460 btrfs_free_path(path); 463 btrfs_free_path(path);
461 inode_item = NULL; 464 inode_item = NULL;
@@ -1550,7 +1553,8 @@ static struct inode *btrfs_new_inode(struct btrfs_trans_handle *trans,
1550 owner = 0; 1553 owner = 0;
1551 else 1554 else
1552 owner = 1; 1555 owner = 1;
1553 group = btrfs_find_block_group(root, group, 0, 0, owner); 1556 group = btrfs_find_block_group(root, group, 0,
1557 BTRFS_BLOCK_GROUP_METADATA, owner);
1554 BTRFS_I(inode)->block_group = group; 1558 BTRFS_I(inode)->block_group = group;
1555 BTRFS_I(inode)->flags = 0; 1559 BTRFS_I(inode)->flags = 0;
1556 1560