Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

Merge git://git.kernel.org/pub/scm/linux/kernel/git/mason/btrfs-unstable

* git://git.kernel.org/pub/scm/linux/kernel/git/mason/btrfs-unstable:
Btrfs: check total number of devices when removing missing
Btrfs: check return value of open_bdev_exclusive properly
Btrfs: do not mark the chunk as readonly if in degraded mode
Btrfs: run orphan cleanup on default fs root
Btrfs: fix a memory leak in btrfs_init_acl
Btrfs: Use correct values when updating inode i_size on fallocate
Btrfs: remove tree_search() in extent_map.c
Btrfs: Add mount -o compress-force

+36 -30
+1
fs/btrfs/acl.c
··· 244 244 ACL_TYPE_ACCESS); 245 245 } 246 246 } 247 + posix_acl_release(clone); 247 248 } 248 249 failed: 249 250 posix_acl_release(acl);
+1
fs/btrfs/ctree.h
··· 1161 1161 #define BTRFS_MOUNT_SSD_SPREAD (1 << 8) 1162 1162 #define BTRFS_MOUNT_NOSSD (1 << 9) 1163 1163 #define BTRFS_MOUNT_DISCARD (1 << 10) 1164 + #define BTRFS_MOUNT_FORCE_COMPRESS (1 << 11) 1164 1165 1165 1166 #define btrfs_clear_opt(o, opt) ((o) &= ~BTRFS_MOUNT_##opt) 1166 1167 #define btrfs_set_opt(o, opt) ((o) |= BTRFS_MOUNT_##opt)
+6
fs/btrfs/disk-io.c
··· 1993 1993 if (!fs_info->fs_root) 1994 1994 goto fail_trans_kthread; 1995 1995 1996 + if (!(sb->s_flags & MS_RDONLY)) { 1997 + down_read(&fs_info->cleanup_work_sem); 1998 + btrfs_orphan_cleanup(fs_info->fs_root); 1999 + up_read(&fs_info->cleanup_work_sem); 2000 + } 2001 + 1996 2002 return tree_root; 1997 2003 1998 2004 fail_trans_kthread:
-14
fs/btrfs/extent_map.c
··· 155 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 158 /* check to see if two extent_map structs are adjacent and safe to merge */ 173 159 static int mergable_maps(struct extent_map *prev, struct extent_map *next) 174 160 {
+11 -11
fs/btrfs/inode.c
··· 483 483 nr_pages_ret = 0; 484 484 485 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 489 if (will_compress) { 489 490 *num_added += 1; ··· 3797 3796 3798 3797 if (location.type == BTRFS_INODE_ITEM_KEY) { 3799 3798 inode = btrfs_iget(dir->i_sb, &location, root); 3800 - if (unlikely(root->clean_orphans) && 3801 - !(inode->i_sb->s_flags & MS_RDONLY)) { 3802 - down_read(&root->fs_info->cleanup_work_sem); 3803 - btrfs_orphan_cleanup(root); 3804 - up_read(&root->fs_info->cleanup_work_sem); 3805 - } 3806 3799 return inode; 3807 3800 } 3808 3801 ··· 5794 5799 } 5795 5800 5796 5801 static int prealloc_file_range(struct inode *inode, u64 start, u64 end, 5797 - u64 alloc_hint, int mode) 5802 + u64 alloc_hint, int mode, loff_t actual_len) 5798 5803 { 5799 5804 struct btrfs_trans_handle *trans; 5800 5805 struct btrfs_root *root = BTRFS_I(inode)->root; ··· 5803 5808 u64 cur_offset = start; 5804 5809 u64 num_bytes = end - start; 5805 5810 int ret = 0; 5811 + u64 i_size; 5806 5812 5807 5813 while (num_bytes > 0) { 5808 5814 alloc_size = min(num_bytes, root->fs_info->max_extent); ··· 5842 5846 BTRFS_I(inode)->flags |= BTRFS_INODE_PREALLOC; 5843 5847 if (!(mode & FALLOC_FL_KEEP_SIZE) && 5844 5848 cur_offset > inode->i_size) { 5845 - i_size_write(inode, cur_offset); 5846 - btrfs_ordered_update_i_size(inode, cur_offset, NULL); 5849 + if (cur_offset > actual_len) 5850 + i_size = actual_len; 5851 + else 5852 + i_size = cur_offset; 5853 + i_size_write(inode, i_size); 5854 + btrfs_ordered_update_i_size(inode, i_size, NULL); 5847 5855 } 5848 5856 5849 5857 ret = btrfs_update_inode(trans, root, inode); ··· 5940 5940 !test_bit(EXTENT_FLAG_PREALLOC, &em->flags))) { 5941 5941 ret = prealloc_file_range(inode, 5942 5942 cur_offset, last_byte, 5943 - alloc_hint, mode); 5943 + alloc_hint, mode, offset+len); 5944 5944 if (ret < 0) { 5945 5945 free_extent_map(em); 5946 5946 break;
+8 -1
fs/btrfs/super.c
··· 66 66 Opt_degraded, Opt_subvol, Opt_device, Opt_nodatasum, Opt_nodatacow, 67 67 Opt_max_extent, Opt_max_inline, Opt_alloc_start, Opt_nobarrier, 68 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 71 Opt_discard, Opt_err, 71 72 }; 72 73 ··· 83 82 {Opt_alloc_start, "alloc_start=%s"}, 84 83 {Opt_thread_pool, "thread_pool=%d"}, 85 84 {Opt_compress, "compress"}, 85 + {Opt_compress_force, "compress-force"}, 86 86 {Opt_ssd, "ssd"}, 87 87 {Opt_ssd_spread, "ssd_spread"}, 88 88 {Opt_nossd, "nossd"}, ··· 173 171 break; 174 172 case Opt_compress: 175 173 printk(KERN_INFO "btrfs: use compression\n"); 174 + btrfs_set_opt(info->mount_opt, COMPRESS); 175 + break; 176 + case Opt_compress_force: 177 + printk(KERN_INFO "btrfs: forcing compression\n"); 178 + btrfs_set_opt(info->mount_opt, FORCE_COMPRESS); 176 179 btrfs_set_opt(info->mount_opt, COMPRESS); 177 180 break; 178 181 case Opt_ssd:
+9 -4
fs/btrfs/volumes.c
··· 1135 1135 root->fs_info->avail_metadata_alloc_bits; 1136 1136 1137 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 1139 printk(KERN_ERR "btrfs: unable to go below four devices " 1140 1140 "on raid10\n"); 1141 1141 ret = -EINVAL; ··· 1143 1143 } 1144 1144 1145 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 1147 printk(KERN_ERR "btrfs: unable to go below two " 1148 1148 "devices on raid1\n"); 1149 1149 ret = -EINVAL; ··· 1434 1434 return -EINVAL; 1435 1435 1436 1436 bdev = open_bdev_exclusive(device_path, 0, root->fs_info->bdev_holder); 1437 - if (!bdev) 1438 - return -EIO; 1437 + if (IS_ERR(bdev)) 1438 + return PTR_ERR(bdev); 1439 1439 1440 1440 if (root->fs_info->fs_devices->seeding) { 1441 1441 seeding_dev = 1; ··· 2537 2537 read_unlock(&map_tree->map_tree.lock); 2538 2538 if (!em) 2539 2539 return 1; 2540 + 2541 + if (btrfs_test_opt(root, DEGRADED)) { 2542 + free_extent_map(em); 2543 + return 0; 2544 + } 2540 2545 2541 2546 map = (struct map_lookup *)em->bdev; 2542 2547 for (i = 0; i < map->num_stripes; i++) {