diff options
author | Frederic Weisbecker <fweisbec@gmail.com> | 2010-02-27 10:18:46 -0500 |
---|---|---|
committer | Frederic Weisbecker <fweisbec@gmail.com> | 2010-02-27 10:18:46 -0500 |
commit | 018cbffe6819f6f8db20a0a3acd9bab9bfd667e4 (patch) | |
tree | fadde2521591998dc653fa094c636e8a547e620d /fs/btrfs | |
parent | 1dd2980d990068e20045b90c424518cc7f3657ff (diff) | |
parent | 60b341b778cc2929df16c0a504c91621b3c6a4ad (diff) |
Merge commit 'v2.6.33' into perf/core
Merge reason:
__percpu annotations need the corresponding sparse address
space definition upstream.
Conflicts:
tools/perf/util/probe-event.c (trivial)
Diffstat (limited to 'fs/btrfs')
-rw-r--r-- | fs/btrfs/acl.c | 1 | ||||
-rw-r--r-- | fs/btrfs/ctree.h | 1 | ||||
-rw-r--r-- | fs/btrfs/disk-io.c | 13 | ||||
-rw-r--r-- | fs/btrfs/extent-tree.c | 8 | ||||
-rw-r--r-- | fs/btrfs/extent_io.c | 3 | ||||
-rw-r--r-- | fs/btrfs/extent_map.c | 14 | ||||
-rw-r--r-- | fs/btrfs/file.c | 8 | ||||
-rw-r--r-- | fs/btrfs/inode.c | 72 | ||||
-rw-r--r-- | fs/btrfs/relocation.c | 3 | ||||
-rw-r--r-- | fs/btrfs/super.c | 9 | ||||
-rw-r--r-- | fs/btrfs/volumes.c | 13 |
11 files changed, 59 insertions, 86 deletions
diff --git a/fs/btrfs/acl.c b/fs/btrfs/acl.c index 54f4798ab46a..6df6d6ed74fd 100644 --- a/fs/btrfs/acl.c +++ b/fs/btrfs/acl.c | |||
@@ -244,6 +244,7 @@ int btrfs_init_acl(struct btrfs_trans_handle *trans, | |||
244 | ACL_TYPE_ACCESS); | 244 | ACL_TYPE_ACCESS); |
245 | } | 245 | } |
246 | } | 246 | } |
247 | posix_acl_release(clone); | ||
247 | } | 248 | } |
248 | failed: | 249 | failed: |
249 | posix_acl_release(acl); | 250 | posix_acl_release(acl); |
diff --git a/fs/btrfs/ctree.h b/fs/btrfs/ctree.h index 9f806dd04c27..2aa8ec6a0981 100644 --- a/fs/btrfs/ctree.h +++ b/fs/btrfs/ctree.h | |||
@@ -1161,6 +1161,7 @@ struct btrfs_root { | |||
1161 | #define BTRFS_MOUNT_SSD_SPREAD (1 << 8) | 1161 | #define BTRFS_MOUNT_SSD_SPREAD (1 << 8) |
1162 | #define BTRFS_MOUNT_NOSSD (1 << 9) | 1162 | #define BTRFS_MOUNT_NOSSD (1 << 9) |
1163 | #define BTRFS_MOUNT_DISCARD (1 << 10) | 1163 | #define BTRFS_MOUNT_DISCARD (1 << 10) |
1164 | #define BTRFS_MOUNT_FORCE_COMPRESS (1 << 11) | ||
1164 | 1165 | ||
1165 | #define btrfs_clear_opt(o, opt) ((o) &= ~BTRFS_MOUNT_##opt) | 1166 | #define btrfs_clear_opt(o, opt) ((o) &= ~BTRFS_MOUNT_##opt) |
1166 | #define btrfs_set_opt(o, opt) ((o) |= BTRFS_MOUNT_##opt) | 1167 | #define btrfs_set_opt(o, opt) ((o) |= BTRFS_MOUNT_##opt) |
diff --git a/fs/btrfs/disk-io.c b/fs/btrfs/disk-io.c index 009e3bd18f23..2b59201b955c 100644 --- a/fs/btrfs/disk-io.c +++ b/fs/btrfs/disk-io.c | |||
@@ -1982,7 +1982,12 @@ struct btrfs_root *open_ctree(struct super_block *sb, | |||
1982 | 1982 | ||
1983 | if (!(sb->s_flags & MS_RDONLY)) { | 1983 | if (!(sb->s_flags & MS_RDONLY)) { |
1984 | ret = btrfs_recover_relocation(tree_root); | 1984 | ret = btrfs_recover_relocation(tree_root); |
1985 | BUG_ON(ret); | 1985 | if (ret < 0) { |
1986 | printk(KERN_WARNING | ||
1987 | "btrfs: failed to recover relocation\n"); | ||
1988 | err = -EINVAL; | ||
1989 | goto fail_trans_kthread; | ||
1990 | } | ||
1986 | } | 1991 | } |
1987 | 1992 | ||
1988 | location.objectid = BTRFS_FS_TREE_OBJECTID; | 1993 | location.objectid = BTRFS_FS_TREE_OBJECTID; |
@@ -1993,6 +1998,12 @@ struct btrfs_root *open_ctree(struct super_block *sb, | |||
1993 | if (!fs_info->fs_root) | 1998 | if (!fs_info->fs_root) |
1994 | goto fail_trans_kthread; | 1999 | goto fail_trans_kthread; |
1995 | 2000 | ||
2001 | if (!(sb->s_flags & MS_RDONLY)) { | ||
2002 | down_read(&fs_info->cleanup_work_sem); | ||
2003 | btrfs_orphan_cleanup(fs_info->fs_root); | ||
2004 | up_read(&fs_info->cleanup_work_sem); | ||
2005 | } | ||
2006 | |||
1996 | return tree_root; | 2007 | return tree_root; |
1997 | 2008 | ||
1998 | fail_trans_kthread: | 2009 | fail_trans_kthread: |
diff --git a/fs/btrfs/extent-tree.c b/fs/btrfs/extent-tree.c index 432a2da4641e..559f72489b3b 100644 --- a/fs/btrfs/extent-tree.c +++ b/fs/btrfs/extent-tree.c | |||
@@ -5402,10 +5402,6 @@ static noinline int walk_down_tree(struct btrfs_trans_handle *trans, | |||
5402 | int ret; | 5402 | int ret; |
5403 | 5403 | ||
5404 | while (level >= 0) { | 5404 | while (level >= 0) { |
5405 | if (path->slots[level] >= | ||
5406 | btrfs_header_nritems(path->nodes[level])) | ||
5407 | break; | ||
5408 | |||
5409 | ret = walk_down_proc(trans, root, path, wc, lookup_info); | 5405 | ret = walk_down_proc(trans, root, path, wc, lookup_info); |
5410 | if (ret > 0) | 5406 | if (ret > 0) |
5411 | break; | 5407 | break; |
@@ -5413,6 +5409,10 @@ static noinline int walk_down_tree(struct btrfs_trans_handle *trans, | |||
5413 | if (level == 0) | 5409 | if (level == 0) |
5414 | break; | 5410 | break; |
5415 | 5411 | ||
5412 | if (path->slots[level] >= | ||
5413 | btrfs_header_nritems(path->nodes[level])) | ||
5414 | break; | ||
5415 | |||
5416 | ret = do_walk_down(trans, root, path, wc, &lookup_info); | 5416 | ret = do_walk_down(trans, root, path, wc, &lookup_info); |
5417 | if (ret > 0) { | 5417 | if (ret > 0) { |
5418 | path->slots[level]++; | 5418 | path->slots[level]++; |
diff --git a/fs/btrfs/extent_io.c b/fs/btrfs/extent_io.c index 96577e8bf9fd..b177ed319612 100644 --- a/fs/btrfs/extent_io.c +++ b/fs/btrfs/extent_io.c | |||
@@ -3165,10 +3165,9 @@ struct extent_buffer *alloc_extent_buffer(struct extent_io_tree *tree, | |||
3165 | spin_unlock(&tree->buffer_lock); | 3165 | spin_unlock(&tree->buffer_lock); |
3166 | goto free_eb; | 3166 | goto free_eb; |
3167 | } | 3167 | } |
3168 | spin_unlock(&tree->buffer_lock); | ||
3169 | |||
3170 | /* add one reference for the tree */ | 3168 | /* add one reference for the tree */ |
3171 | atomic_inc(&eb->refs); | 3169 | atomic_inc(&eb->refs); |
3170 | spin_unlock(&tree->buffer_lock); | ||
3172 | return eb; | 3171 | return eb; |
3173 | 3172 | ||
3174 | free_eb: | 3173 | free_eb: |
diff --git a/fs/btrfs/extent_map.c b/fs/btrfs/extent_map.c index 46bea0f4dc7b..428fcac45f90 100644 --- a/fs/btrfs/extent_map.c +++ b/fs/btrfs/extent_map.c | |||
@@ -155,20 +155,6 @@ static struct rb_node *__tree_search(struct rb_root *root, u64 offset, | |||
155 | return NULL; | 155 | return NULL; |
156 | } | 156 | } |
157 | 157 | ||
158 | /* | ||
159 | * look for an offset in the tree, and if it can't be found, return | ||
160 | * the first offset we can find smaller than 'offset'. | ||
161 | */ | ||
162 | static inline struct rb_node *tree_search(struct rb_root *root, u64 offset) | ||
163 | { | ||
164 | struct rb_node *prev; | ||
165 | struct rb_node *ret; | ||
166 | ret = __tree_search(root, offset, &prev, NULL); | ||
167 | if (!ret) | ||
168 | return prev; | ||
169 | return ret; | ||
170 | } | ||
171 | |||
172 | /* check to see if two extent_map structs are adjacent and safe to merge */ | 158 | /* check to see if two extent_map structs are adjacent and safe to merge */ |
173 | static int mergable_maps(struct extent_map *prev, struct extent_map *next) | 159 | static int mergable_maps(struct extent_map *prev, struct extent_map *next) |
174 | { | 160 | { |
diff --git a/fs/btrfs/file.c b/fs/btrfs/file.c index c02033596f02..6ed434ac037f 100644 --- a/fs/btrfs/file.c +++ b/fs/btrfs/file.c | |||
@@ -720,13 +720,15 @@ again: | |||
720 | inode->i_ino, orig_offset); | 720 | inode->i_ino, orig_offset); |
721 | BUG_ON(ret); | 721 | BUG_ON(ret); |
722 | } | 722 | } |
723 | fi = btrfs_item_ptr(leaf, path->slots[0], | ||
724 | struct btrfs_file_extent_item); | ||
725 | if (del_nr == 0) { | 723 | if (del_nr == 0) { |
724 | fi = btrfs_item_ptr(leaf, path->slots[0], | ||
725 | struct btrfs_file_extent_item); | ||
726 | btrfs_set_file_extent_type(leaf, fi, | 726 | btrfs_set_file_extent_type(leaf, fi, |
727 | BTRFS_FILE_EXTENT_REG); | 727 | BTRFS_FILE_EXTENT_REG); |
728 | btrfs_mark_buffer_dirty(leaf); | 728 | btrfs_mark_buffer_dirty(leaf); |
729 | } else { | 729 | } else { |
730 | fi = btrfs_item_ptr(leaf, del_slot - 1, | ||
731 | struct btrfs_file_extent_item); | ||
730 | btrfs_set_file_extent_type(leaf, fi, | 732 | btrfs_set_file_extent_type(leaf, fi, |
731 | BTRFS_FILE_EXTENT_REG); | 733 | BTRFS_FILE_EXTENT_REG); |
732 | btrfs_set_file_extent_num_bytes(leaf, fi, | 734 | btrfs_set_file_extent_num_bytes(leaf, fi, |
@@ -1133,7 +1135,7 @@ int btrfs_sync_file(struct file *file, struct dentry *dentry, int datasync) | |||
1133 | } | 1135 | } |
1134 | mutex_lock(&dentry->d_inode->i_mutex); | 1136 | mutex_lock(&dentry->d_inode->i_mutex); |
1135 | out: | 1137 | out: |
1136 | return ret > 0 ? EIO : ret; | 1138 | return ret > 0 ? -EIO : ret; |
1137 | } | 1139 | } |
1138 | 1140 | ||
1139 | static const struct vm_operations_struct btrfs_file_vm_ops = { | 1141 | static const struct vm_operations_struct btrfs_file_vm_ops = { |
diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c index b330e27c2d8b..4deb280f8969 100644 --- a/fs/btrfs/inode.c +++ b/fs/btrfs/inode.c | |||
@@ -483,7 +483,8 @@ again: | |||
483 | nr_pages_ret = 0; | 483 | nr_pages_ret = 0; |
484 | 484 | ||
485 | /* flag the file so we don't compress in the future */ | 485 | /* flag the file so we don't compress in the future */ |
486 | BTRFS_I(inode)->flags |= BTRFS_INODE_NOCOMPRESS; | 486 | if (!btrfs_test_opt(root, FORCE_COMPRESS)) |
487 | BTRFS_I(inode)->flags |= BTRFS_INODE_NOCOMPRESS; | ||
487 | } | 488 | } |
488 | if (will_compress) { | 489 | if (will_compress) { |
489 | *num_added += 1; | 490 | *num_added += 1; |
@@ -1680,24 +1681,6 @@ static int insert_reserved_file_extent(struct btrfs_trans_handle *trans, | |||
1680 | * before we start the transaction. It limits the amount of btree | 1681 | * before we start the transaction. It limits the amount of btree |
1681 | * reads required while inside the transaction. | 1682 | * reads required while inside the transaction. |
1682 | */ | 1683 | */ |
1683 | static noinline void reada_csum(struct btrfs_root *root, | ||
1684 | struct btrfs_path *path, | ||
1685 | struct btrfs_ordered_extent *ordered_extent) | ||
1686 | { | ||
1687 | struct btrfs_ordered_sum *sum; | ||
1688 | u64 bytenr; | ||
1689 | |||
1690 | sum = list_entry(ordered_extent->list.next, struct btrfs_ordered_sum, | ||
1691 | list); | ||
1692 | bytenr = sum->sums[0].bytenr; | ||
1693 | |||
1694 | /* | ||
1695 | * we don't care about the results, the point of this search is | ||
1696 | * just to get the btree leaves into ram | ||
1697 | */ | ||
1698 | btrfs_lookup_csum(NULL, root->fs_info->csum_root, path, bytenr, 0); | ||
1699 | } | ||
1700 | |||
1701 | /* as ordered data IO finishes, this gets called so we can finish | 1684 | /* as ordered data IO finishes, this gets called so we can finish |
1702 | * an ordered extent if the range of bytes in the file it covers are | 1685 | * an ordered extent if the range of bytes in the file it covers are |
1703 | * fully written. | 1686 | * fully written. |
@@ -1708,7 +1691,6 @@ static int btrfs_finish_ordered_io(struct inode *inode, u64 start, u64 end) | |||
1708 | struct btrfs_trans_handle *trans; | 1691 | struct btrfs_trans_handle *trans; |
1709 | struct btrfs_ordered_extent *ordered_extent = NULL; | 1692 | struct btrfs_ordered_extent *ordered_extent = NULL; |
1710 | struct extent_io_tree *io_tree = &BTRFS_I(inode)->io_tree; | 1693 | struct extent_io_tree *io_tree = &BTRFS_I(inode)->io_tree; |
1711 | struct btrfs_path *path; | ||
1712 | int compressed = 0; | 1694 | int compressed = 0; |
1713 | int ret; | 1695 | int ret; |
1714 | 1696 | ||
@@ -1716,32 +1698,9 @@ static int btrfs_finish_ordered_io(struct inode *inode, u64 start, u64 end) | |||
1716 | if (!ret) | 1698 | if (!ret) |
1717 | return 0; | 1699 | return 0; |
1718 | 1700 | ||
1719 | /* | 1701 | ordered_extent = btrfs_lookup_ordered_extent(inode, start); |
1720 | * before we join the transaction, try to do some of our IO. | ||
1721 | * This will limit the amount of IO that we have to do with | ||
1722 | * the transaction running. We're unlikely to need to do any | ||
1723 | * IO if the file extents are new, the disk_i_size checks | ||
1724 | * covers the most common case. | ||
1725 | */ | ||
1726 | if (start < BTRFS_I(inode)->disk_i_size) { | ||
1727 | path = btrfs_alloc_path(); | ||
1728 | if (path) { | ||
1729 | ret = btrfs_lookup_file_extent(NULL, root, path, | ||
1730 | inode->i_ino, | ||
1731 | start, 0); | ||
1732 | ordered_extent = btrfs_lookup_ordered_extent(inode, | ||
1733 | start); | ||
1734 | if (!list_empty(&ordered_extent->list)) { | ||
1735 | btrfs_release_path(root, path); | ||
1736 | reada_csum(root, path, ordered_extent); | ||
1737 | } | ||
1738 | btrfs_free_path(path); | ||
1739 | } | ||
1740 | } | ||
1741 | |||
1742 | if (!ordered_extent) | ||
1743 | ordered_extent = btrfs_lookup_ordered_extent(inode, start); | ||
1744 | BUG_ON(!ordered_extent); | 1702 | BUG_ON(!ordered_extent); |
1703 | |||
1745 | if (test_bit(BTRFS_ORDERED_NOCOW, &ordered_extent->flags)) { | 1704 | if (test_bit(BTRFS_ORDERED_NOCOW, &ordered_extent->flags)) { |
1746 | BUG_ON(!list_empty(&ordered_extent->list)); | 1705 | BUG_ON(!list_empty(&ordered_extent->list)); |
1747 | ret = btrfs_ordered_update_i_size(inode, 0, ordered_extent); | 1706 | ret = btrfs_ordered_update_i_size(inode, 0, ordered_extent); |
@@ -3796,12 +3755,6 @@ struct inode *btrfs_lookup_dentry(struct inode *dir, struct dentry *dentry) | |||
3796 | 3755 | ||
3797 | if (location.type == BTRFS_INODE_ITEM_KEY) { | 3756 | if (location.type == BTRFS_INODE_ITEM_KEY) { |
3798 | inode = btrfs_iget(dir->i_sb, &location, root); | 3757 | inode = btrfs_iget(dir->i_sb, &location, root); |
3799 | if (unlikely(root->clean_orphans) && | ||
3800 | !(inode->i_sb->s_flags & MS_RDONLY)) { | ||
3801 | down_read(&root->fs_info->cleanup_work_sem); | ||
3802 | btrfs_orphan_cleanup(root); | ||
3803 | up_read(&root->fs_info->cleanup_work_sem); | ||
3804 | } | ||
3805 | return inode; | 3758 | return inode; |
3806 | } | 3759 | } |
3807 | 3760 | ||
@@ -5799,7 +5752,7 @@ out_fail: | |||
5799 | } | 5752 | } |
5800 | 5753 | ||
5801 | static int prealloc_file_range(struct inode *inode, u64 start, u64 end, | 5754 | static int prealloc_file_range(struct inode *inode, u64 start, u64 end, |
5802 | u64 alloc_hint, int mode) | 5755 | u64 alloc_hint, int mode, loff_t actual_len) |
5803 | { | 5756 | { |
5804 | struct btrfs_trans_handle *trans; | 5757 | struct btrfs_trans_handle *trans; |
5805 | struct btrfs_root *root = BTRFS_I(inode)->root; | 5758 | struct btrfs_root *root = BTRFS_I(inode)->root; |
@@ -5808,6 +5761,7 @@ static int prealloc_file_range(struct inode *inode, u64 start, u64 end, | |||
5808 | u64 cur_offset = start; | 5761 | u64 cur_offset = start; |
5809 | u64 num_bytes = end - start; | 5762 | u64 num_bytes = end - start; |
5810 | int ret = 0; | 5763 | int ret = 0; |
5764 | u64 i_size; | ||
5811 | 5765 | ||
5812 | while (num_bytes > 0) { | 5766 | while (num_bytes > 0) { |
5813 | alloc_size = min(num_bytes, root->fs_info->max_extent); | 5767 | alloc_size = min(num_bytes, root->fs_info->max_extent); |
@@ -5845,9 +5799,15 @@ static int prealloc_file_range(struct inode *inode, u64 start, u64 end, | |||
5845 | inode->i_ctime = CURRENT_TIME; | 5799 | inode->i_ctime = CURRENT_TIME; |
5846 | BTRFS_I(inode)->flags |= BTRFS_INODE_PREALLOC; | 5800 | BTRFS_I(inode)->flags |= BTRFS_INODE_PREALLOC; |
5847 | if (!(mode & FALLOC_FL_KEEP_SIZE) && | 5801 | if (!(mode & FALLOC_FL_KEEP_SIZE) && |
5848 | cur_offset > inode->i_size) { | 5802 | (actual_len > inode->i_size) && |
5849 | i_size_write(inode, cur_offset); | 5803 | (cur_offset > inode->i_size)) { |
5850 | btrfs_ordered_update_i_size(inode, cur_offset, NULL); | 5804 | |
5805 | if (cur_offset > actual_len) | ||
5806 | i_size = actual_len; | ||
5807 | else | ||
5808 | i_size = cur_offset; | ||
5809 | i_size_write(inode, i_size); | ||
5810 | btrfs_ordered_update_i_size(inode, i_size, NULL); | ||
5851 | } | 5811 | } |
5852 | 5812 | ||
5853 | ret = btrfs_update_inode(trans, root, inode); | 5813 | ret = btrfs_update_inode(trans, root, inode); |
@@ -5940,7 +5900,7 @@ static long btrfs_fallocate(struct inode *inode, int mode, | |||
5940 | !test_bit(EXTENT_FLAG_PREALLOC, &em->flags))) { | 5900 | !test_bit(EXTENT_FLAG_PREALLOC, &em->flags))) { |
5941 | ret = prealloc_file_range(inode, | 5901 | ret = prealloc_file_range(inode, |
5942 | cur_offset, last_byte, | 5902 | cur_offset, last_byte, |
5943 | alloc_hint, mode); | 5903 | alloc_hint, mode, offset+len); |
5944 | if (ret < 0) { | 5904 | if (ret < 0) { |
5945 | free_extent_map(em); | 5905 | free_extent_map(em); |
5946 | break; | 5906 | break; |
diff --git a/fs/btrfs/relocation.c b/fs/btrfs/relocation.c index ed3e4a2ec2c8..ab7ab5318745 100644 --- a/fs/btrfs/relocation.c +++ b/fs/btrfs/relocation.c | |||
@@ -3764,7 +3764,8 @@ out: | |||
3764 | BTRFS_DATA_RELOC_TREE_OBJECTID); | 3764 | BTRFS_DATA_RELOC_TREE_OBJECTID); |
3765 | if (IS_ERR(fs_root)) | 3765 | if (IS_ERR(fs_root)) |
3766 | err = PTR_ERR(fs_root); | 3766 | err = PTR_ERR(fs_root); |
3767 | btrfs_orphan_cleanup(fs_root); | 3767 | else |
3768 | btrfs_orphan_cleanup(fs_root); | ||
3768 | } | 3769 | } |
3769 | return err; | 3770 | return err; |
3770 | } | 3771 | } |
diff --git a/fs/btrfs/super.c b/fs/btrfs/super.c index 3f9b45704fcd..8a1ea6e64575 100644 --- a/fs/btrfs/super.c +++ b/fs/btrfs/super.c | |||
@@ -66,7 +66,8 @@ enum { | |||
66 | Opt_degraded, Opt_subvol, Opt_device, Opt_nodatasum, Opt_nodatacow, | 66 | Opt_degraded, Opt_subvol, Opt_device, Opt_nodatasum, Opt_nodatacow, |
67 | Opt_max_extent, Opt_max_inline, Opt_alloc_start, Opt_nobarrier, | 67 | Opt_max_extent, Opt_max_inline, Opt_alloc_start, Opt_nobarrier, |
68 | Opt_ssd, Opt_nossd, Opt_ssd_spread, Opt_thread_pool, Opt_noacl, | 68 | Opt_ssd, Opt_nossd, Opt_ssd_spread, Opt_thread_pool, Opt_noacl, |
69 | Opt_compress, Opt_notreelog, Opt_ratio, Opt_flushoncommit, | 69 | Opt_compress, Opt_compress_force, Opt_notreelog, Opt_ratio, |
70 | Opt_flushoncommit, | ||
70 | Opt_discard, Opt_err, | 71 | Opt_discard, Opt_err, |
71 | }; | 72 | }; |
72 | 73 | ||
@@ -82,6 +83,7 @@ static match_table_t tokens = { | |||
82 | {Opt_alloc_start, "alloc_start=%s"}, | 83 | {Opt_alloc_start, "alloc_start=%s"}, |
83 | {Opt_thread_pool, "thread_pool=%d"}, | 84 | {Opt_thread_pool, "thread_pool=%d"}, |
84 | {Opt_compress, "compress"}, | 85 | {Opt_compress, "compress"}, |
86 | {Opt_compress_force, "compress-force"}, | ||
85 | {Opt_ssd, "ssd"}, | 87 | {Opt_ssd, "ssd"}, |
86 | {Opt_ssd_spread, "ssd_spread"}, | 88 | {Opt_ssd_spread, "ssd_spread"}, |
87 | {Opt_nossd, "nossd"}, | 89 | {Opt_nossd, "nossd"}, |
@@ -173,6 +175,11 @@ int btrfs_parse_options(struct btrfs_root *root, char *options) | |||
173 | printk(KERN_INFO "btrfs: use compression\n"); | 175 | printk(KERN_INFO "btrfs: use compression\n"); |
174 | btrfs_set_opt(info->mount_opt, COMPRESS); | 176 | btrfs_set_opt(info->mount_opt, COMPRESS); |
175 | break; | 177 | break; |
178 | case Opt_compress_force: | ||
179 | printk(KERN_INFO "btrfs: forcing compression\n"); | ||
180 | btrfs_set_opt(info->mount_opt, FORCE_COMPRESS); | ||
181 | btrfs_set_opt(info->mount_opt, COMPRESS); | ||
182 | break; | ||
176 | case Opt_ssd: | 183 | case Opt_ssd: |
177 | printk(KERN_INFO "btrfs: use ssd allocation scheme\n"); | 184 | printk(KERN_INFO "btrfs: use ssd allocation scheme\n"); |
178 | btrfs_set_opt(info->mount_opt, SSD); | 185 | btrfs_set_opt(info->mount_opt, SSD); |
diff --git a/fs/btrfs/volumes.c b/fs/btrfs/volumes.c index 220dad5db017..41ecbb2347f2 100644 --- a/fs/btrfs/volumes.c +++ b/fs/btrfs/volumes.c | |||
@@ -1135,7 +1135,7 @@ int btrfs_rm_device(struct btrfs_root *root, char *device_path) | |||
1135 | root->fs_info->avail_metadata_alloc_bits; | 1135 | root->fs_info->avail_metadata_alloc_bits; |
1136 | 1136 | ||
1137 | if ((all_avail & BTRFS_BLOCK_GROUP_RAID10) && | 1137 | if ((all_avail & BTRFS_BLOCK_GROUP_RAID10) && |
1138 | root->fs_info->fs_devices->rw_devices <= 4) { | 1138 | root->fs_info->fs_devices->num_devices <= 4) { |
1139 | printk(KERN_ERR "btrfs: unable to go below four devices " | 1139 | printk(KERN_ERR "btrfs: unable to go below four devices " |
1140 | "on raid10\n"); | 1140 | "on raid10\n"); |
1141 | ret = -EINVAL; | 1141 | ret = -EINVAL; |
@@ -1143,7 +1143,7 @@ int btrfs_rm_device(struct btrfs_root *root, char *device_path) | |||
1143 | } | 1143 | } |
1144 | 1144 | ||
1145 | if ((all_avail & BTRFS_BLOCK_GROUP_RAID1) && | 1145 | if ((all_avail & BTRFS_BLOCK_GROUP_RAID1) && |
1146 | root->fs_info->fs_devices->rw_devices <= 2) { | 1146 | root->fs_info->fs_devices->num_devices <= 2) { |
1147 | printk(KERN_ERR "btrfs: unable to go below two " | 1147 | printk(KERN_ERR "btrfs: unable to go below two " |
1148 | "devices on raid1\n"); | 1148 | "devices on raid1\n"); |
1149 | ret = -EINVAL; | 1149 | ret = -EINVAL; |
@@ -1434,8 +1434,8 @@ int btrfs_init_new_device(struct btrfs_root *root, char *device_path) | |||
1434 | return -EINVAL; | 1434 | return -EINVAL; |
1435 | 1435 | ||
1436 | bdev = open_bdev_exclusive(device_path, 0, root->fs_info->bdev_holder); | 1436 | bdev = open_bdev_exclusive(device_path, 0, root->fs_info->bdev_holder); |
1437 | if (!bdev) | 1437 | if (IS_ERR(bdev)) |
1438 | return -EIO; | 1438 | return PTR_ERR(bdev); |
1439 | 1439 | ||
1440 | if (root->fs_info->fs_devices->seeding) { | 1440 | if (root->fs_info->fs_devices->seeding) { |
1441 | seeding_dev = 1; | 1441 | seeding_dev = 1; |
@@ -2538,6 +2538,11 @@ int btrfs_chunk_readonly(struct btrfs_root *root, u64 chunk_offset) | |||
2538 | if (!em) | 2538 | if (!em) |
2539 | return 1; | 2539 | return 1; |
2540 | 2540 | ||
2541 | if (btrfs_test_opt(root, DEGRADED)) { | ||
2542 | free_extent_map(em); | ||
2543 | return 0; | ||
2544 | } | ||
2545 | |||
2541 | map = (struct map_lookup *)em->bdev; | 2546 | map = (struct map_lookup *)em->bdev; |
2542 | for (i = 0; i < map->num_stripes; i++) { | 2547 | for (i = 0; i < map->num_stripes; i++) { |
2543 | if (!map->stripes[i].dev->writeable) { | 2548 | if (!map->stripes[i].dev->writeable) { |