diff options
author | Mauro Carvalho Chehab <mchehab@redhat.com> | 2013-01-11 10:28:19 -0500 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@redhat.com> | 2013-01-11 10:28:19 -0500 |
commit | 734d1ece37fbf3d2ddfc71bc6c69e0fe35f02542 (patch) | |
tree | c4805dd7e746b1feb9e09e9849f3245d0b2c0c6b /fs/btrfs/super.c | |
parent | 216c82c6aba63eeb49d7654b448e0d47bea255bb (diff) | |
parent | 9931faca02c604c22335f5a935a501bb2ace6e20 (diff) |
Merge tag 'v3.8-rc3' into v4l_for_linus
Linux 3.8-rc3
* tag 'v3.8-rc3': (11110 commits)
Linux 3.8-rc3
mm: reinstante dropped pmd_trans_splitting() check
cred: Remove tgcred pointer from struct cred
drm/ttm: fix fence locking in ttm_buffer_object_transfer
ARM: clps711x: Fix bad merge of clockevents setup
ARM: highbank: save and restore L2 cache and GIC on suspend
ARM: highbank: add a power request clear
ARM: highbank: fix secondary boot and hotplug
ARM: highbank: fix typos with hignbank in power request functions
ARM: dts: fix highbank cpu mpidr values
ARM: dts: add device_type prop to cpu nodes on Calxeda platforms
drm/prime: drop reference on imported dma-buf come from gem
xen/netfront: improve truesize tracking
ARM: mx5: Fix MX53 flexcan2 clock
ARM: OMAP2+: am33xx-hwmod: Fix wrongly terminated am33xx_usbss_mpu_irqs array
sctp: fix Kconfig bug in default cookie hmac selection
EDAC: Cleanup device deregistering path
EDAC: Fix EDAC Kconfig menu
EDAC: Fix kernel panic on module unloading
ALSA: hda - add mute LED for HP Pavilion 17 (Realtek codec)
...
Diffstat (limited to 'fs/btrfs/super.c')
-rw-r--r-- | fs/btrfs/super.c | 48 |
1 files changed, 44 insertions, 4 deletions
diff --git a/fs/btrfs/super.c b/fs/btrfs/super.c index 915ac14c2064..99545df1b86c 100644 --- a/fs/btrfs/super.c +++ b/fs/btrfs/super.c | |||
@@ -55,6 +55,7 @@ | |||
55 | #include "export.h" | 55 | #include "export.h" |
56 | #include "compression.h" | 56 | #include "compression.h" |
57 | #include "rcu-string.h" | 57 | #include "rcu-string.h" |
58 | #include "dev-replace.h" | ||
58 | 59 | ||
59 | #define CREATE_TRACE_POINTS | 60 | #define CREATE_TRACE_POINTS |
60 | #include <trace/events/btrfs.h> | 61 | #include <trace/events/btrfs.h> |
@@ -116,7 +117,16 @@ static void btrfs_handle_error(struct btrfs_fs_info *fs_info) | |||
116 | if (fs_info->fs_state & BTRFS_SUPER_FLAG_ERROR) { | 117 | if (fs_info->fs_state & BTRFS_SUPER_FLAG_ERROR) { |
117 | sb->s_flags |= MS_RDONLY; | 118 | sb->s_flags |= MS_RDONLY; |
118 | printk(KERN_INFO "btrfs is forced readonly\n"); | 119 | printk(KERN_INFO "btrfs is forced readonly\n"); |
119 | __btrfs_scrub_cancel(fs_info); | 120 | /* |
121 | * Note that a running device replace operation is not | ||
122 | * canceled here although there is no way to update | ||
123 | * the progress. It would add the risk of a deadlock, | ||
124 | * therefore the canceling is ommited. The only penalty | ||
125 | * is that some I/O remains active until the procedure | ||
126 | * completes. The next time when the filesystem is | ||
127 | * mounted writeable again, the device replace | ||
128 | * operation continues. | ||
129 | */ | ||
120 | // WARN_ON(1); | 130 | // WARN_ON(1); |
121 | } | 131 | } |
122 | } | 132 | } |
@@ -1186,7 +1196,8 @@ static void btrfs_resize_thread_pool(struct btrfs_fs_info *fs_info, | |||
1186 | btrfs_set_max_workers(&fs_info->endio_freespace_worker, new_pool_size); | 1196 | btrfs_set_max_workers(&fs_info->endio_freespace_worker, new_pool_size); |
1187 | btrfs_set_max_workers(&fs_info->delayed_workers, new_pool_size); | 1197 | btrfs_set_max_workers(&fs_info->delayed_workers, new_pool_size); |
1188 | btrfs_set_max_workers(&fs_info->readahead_workers, new_pool_size); | 1198 | btrfs_set_max_workers(&fs_info->readahead_workers, new_pool_size); |
1189 | btrfs_set_max_workers(&fs_info->scrub_workers, new_pool_size); | 1199 | btrfs_set_max_workers(&fs_info->scrub_wr_completion_workers, |
1200 | new_pool_size); | ||
1190 | } | 1201 | } |
1191 | 1202 | ||
1192 | static int btrfs_remount(struct super_block *sb, int *flags, char *data) | 1203 | static int btrfs_remount(struct super_block *sb, int *flags, char *data) |
@@ -1215,8 +1226,15 @@ static int btrfs_remount(struct super_block *sb, int *flags, char *data) | |||
1215 | return 0; | 1226 | return 0; |
1216 | 1227 | ||
1217 | if (*flags & MS_RDONLY) { | 1228 | if (*flags & MS_RDONLY) { |
1229 | /* | ||
1230 | * this also happens on 'umount -rf' or on shutdown, when | ||
1231 | * the filesystem is busy. | ||
1232 | */ | ||
1218 | sb->s_flags |= MS_RDONLY; | 1233 | sb->s_flags |= MS_RDONLY; |
1219 | 1234 | ||
1235 | btrfs_dev_replace_suspend_for_unmount(fs_info); | ||
1236 | btrfs_scrub_cancel(fs_info); | ||
1237 | |||
1220 | ret = btrfs_commit_super(root); | 1238 | ret = btrfs_commit_super(root); |
1221 | if (ret) | 1239 | if (ret) |
1222 | goto restore; | 1240 | goto restore; |
@@ -1226,6 +1244,15 @@ static int btrfs_remount(struct super_block *sb, int *flags, char *data) | |||
1226 | goto restore; | 1244 | goto restore; |
1227 | } | 1245 | } |
1228 | 1246 | ||
1247 | if (fs_info->fs_devices->missing_devices > | ||
1248 | fs_info->num_tolerated_disk_barrier_failures && | ||
1249 | !(*flags & MS_RDONLY)) { | ||
1250 | printk(KERN_WARNING | ||
1251 | "Btrfs: too many missing devices, writeable remount is not allowed\n"); | ||
1252 | ret = -EACCES; | ||
1253 | goto restore; | ||
1254 | } | ||
1255 | |||
1229 | if (btrfs_super_log_root(fs_info->super_copy) != 0) { | 1256 | if (btrfs_super_log_root(fs_info->super_copy) != 0) { |
1230 | ret = -EINVAL; | 1257 | ret = -EINVAL; |
1231 | goto restore; | 1258 | goto restore; |
@@ -1244,6 +1271,11 @@ static int btrfs_remount(struct super_block *sb, int *flags, char *data) | |||
1244 | if (ret) | 1271 | if (ret) |
1245 | goto restore; | 1272 | goto restore; |
1246 | 1273 | ||
1274 | ret = btrfs_resume_dev_replace_async(fs_info); | ||
1275 | if (ret) { | ||
1276 | pr_warn("btrfs: failed to resume dev_replace\n"); | ||
1277 | goto restore; | ||
1278 | } | ||
1247 | sb->s_flags &= ~MS_RDONLY; | 1279 | sb->s_flags &= ~MS_RDONLY; |
1248 | } | 1280 | } |
1249 | 1281 | ||
@@ -1336,7 +1368,8 @@ static int btrfs_calc_avail_data_space(struct btrfs_root *root, u64 *free_bytes) | |||
1336 | min_stripe_size = BTRFS_STRIPE_LEN; | 1368 | min_stripe_size = BTRFS_STRIPE_LEN; |
1337 | 1369 | ||
1338 | list_for_each_entry(device, &fs_devices->devices, dev_list) { | 1370 | list_for_each_entry(device, &fs_devices->devices, dev_list) { |
1339 | if (!device->in_fs_metadata || !device->bdev) | 1371 | if (!device->in_fs_metadata || !device->bdev || |
1372 | device->is_tgtdev_for_dev_replace) | ||
1340 | continue; | 1373 | continue; |
1341 | 1374 | ||
1342 | avail_space = device->total_bytes - device->bytes_used; | 1375 | avail_space = device->total_bytes - device->bytes_used; |
@@ -1647,10 +1680,14 @@ static int __init init_btrfs_fs(void) | |||
1647 | if (err) | 1680 | if (err) |
1648 | goto free_ordered_data; | 1681 | goto free_ordered_data; |
1649 | 1682 | ||
1650 | err = btrfs_interface_init(); | 1683 | err = btrfs_auto_defrag_init(); |
1651 | if (err) | 1684 | if (err) |
1652 | goto free_delayed_inode; | 1685 | goto free_delayed_inode; |
1653 | 1686 | ||
1687 | err = btrfs_interface_init(); | ||
1688 | if (err) | ||
1689 | goto free_auto_defrag; | ||
1690 | |||
1654 | err = register_filesystem(&btrfs_fs_type); | 1691 | err = register_filesystem(&btrfs_fs_type); |
1655 | if (err) | 1692 | if (err) |
1656 | goto unregister_ioctl; | 1693 | goto unregister_ioctl; |
@@ -1662,6 +1699,8 @@ static int __init init_btrfs_fs(void) | |||
1662 | 1699 | ||
1663 | unregister_ioctl: | 1700 | unregister_ioctl: |
1664 | btrfs_interface_exit(); | 1701 | btrfs_interface_exit(); |
1702 | free_auto_defrag: | ||
1703 | btrfs_auto_defrag_exit(); | ||
1665 | free_delayed_inode: | 1704 | free_delayed_inode: |
1666 | btrfs_delayed_inode_exit(); | 1705 | btrfs_delayed_inode_exit(); |
1667 | free_ordered_data: | 1706 | free_ordered_data: |
@@ -1681,6 +1720,7 @@ free_compress: | |||
1681 | static void __exit exit_btrfs_fs(void) | 1720 | static void __exit exit_btrfs_fs(void) |
1682 | { | 1721 | { |
1683 | btrfs_destroy_cachep(); | 1722 | btrfs_destroy_cachep(); |
1723 | btrfs_auto_defrag_exit(); | ||
1684 | btrfs_delayed_inode_exit(); | 1724 | btrfs_delayed_inode_exit(); |
1685 | ordered_data_exit(); | 1725 | ordered_data_exit(); |
1686 | extent_map_exit(); | 1726 | extent_map_exit(); |