diff options
author | Chris Mason <chris.mason@oracle.com> | 2007-12-21 16:27:24 -0500 |
---|---|---|
committer | Chris Mason <chris.mason@oracle.com> | 2008-09-25 11:03:58 -0400 |
commit | edbd8d4efe4ddaf29a175ae504e2c9a05a96ebee (patch) | |
tree | c5156fe3a75e97972186c9a933a631b258490a7e /fs/btrfs/disk-io.c | |
parent | 5d4fb734b4cb89a3902d6de309af0f6f3e63fe73 (diff) |
Btrfs: Support for online FS resize (grow and shrink)
Signed-off-by: Chris Mason <chris.mason@oracle.com>
Diffstat (limited to 'fs/btrfs/disk-io.c')
-rw-r--r-- | fs/btrfs/disk-io.c | 32 |
1 files changed, 24 insertions, 8 deletions
diff --git a/fs/btrfs/disk-io.c b/fs/btrfs/disk-io.c index eebb4fb65c61..de026d9d9b2b 100644 --- a/fs/btrfs/disk-io.c +++ b/fs/btrfs/disk-io.c | |||
@@ -471,13 +471,17 @@ insert: | |||
471 | return root; | 471 | return root; |
472 | } | 472 | } |
473 | 473 | ||
474 | struct btrfs_root *btrfs_read_fs_root(struct btrfs_fs_info *fs_info, | 474 | struct btrfs_root *btrfs_read_fs_root_no_name(struct btrfs_fs_info *fs_info, |
475 | struct btrfs_key *location, | 475 | struct btrfs_key *location) |
476 | const char *name, int namelen) | ||
477 | { | 476 | { |
478 | struct btrfs_root *root; | 477 | struct btrfs_root *root; |
479 | int ret; | 478 | int ret; |
480 | 479 | ||
480 | if (location->objectid == BTRFS_ROOT_TREE_OBJECTID) | ||
481 | return fs_info->tree_root; | ||
482 | if (location->objectid == BTRFS_EXTENT_TREE_OBJECTID) | ||
483 | return fs_info->extent_root; | ||
484 | |||
481 | root = radix_tree_lookup(&fs_info->fs_roots_radix, | 485 | root = radix_tree_lookup(&fs_info->fs_roots_radix, |
482 | (unsigned long)location->objectid); | 486 | (unsigned long)location->objectid); |
483 | if (root) | 487 | if (root) |
@@ -494,6 +498,23 @@ struct btrfs_root *btrfs_read_fs_root(struct btrfs_fs_info *fs_info, | |||
494 | kfree(root); | 498 | kfree(root); |
495 | return ERR_PTR(ret); | 499 | return ERR_PTR(ret); |
496 | } | 500 | } |
501 | ret = btrfs_find_dead_roots(fs_info->tree_root, | ||
502 | root->root_key.objectid, root); | ||
503 | BUG_ON(ret); | ||
504 | |||
505 | return root; | ||
506 | } | ||
507 | |||
508 | struct btrfs_root *btrfs_read_fs_root(struct btrfs_fs_info *fs_info, | ||
509 | struct btrfs_key *location, | ||
510 | const char *name, int namelen) | ||
511 | { | ||
512 | struct btrfs_root *root; | ||
513 | int ret; | ||
514 | |||
515 | root = btrfs_read_fs_root_no_name(fs_info, location); | ||
516 | if (!root) | ||
517 | return NULL; | ||
497 | 518 | ||
498 | ret = btrfs_set_root_name(root, name, namelen); | 519 | ret = btrfs_set_root_name(root, name, namelen); |
499 | if (ret) { | 520 | if (ret) { |
@@ -509,11 +530,6 @@ struct btrfs_root *btrfs_read_fs_root(struct btrfs_fs_info *fs_info, | |||
509 | kfree(root); | 530 | kfree(root); |
510 | return ERR_PTR(ret); | 531 | return ERR_PTR(ret); |
511 | } | 532 | } |
512 | |||
513 | ret = btrfs_find_dead_roots(fs_info->tree_root, | ||
514 | root->root_key.objectid, root); | ||
515 | BUG_ON(ret); | ||
516 | |||
517 | return root; | 533 | return root; |
518 | } | 534 | } |
519 | #if 0 | 535 | #if 0 |