super.c (c09c9dd2e9c732658c744a802101d5c34fedde22) | super.c (7c55ee0c4afba4434d973117234577ae6ff77a1c) |
---|---|
1/* 2 * Copyright (C) 2007 Oracle. All rights reserved. 3 * 4 * This program is free software; you can redistribute it and/or 5 * modify it under the terms of the GNU General Public 6 * License v2 as published by the Free Software Foundation. 7 * 8 * This program is distributed in the hope that it will be useful, --- 116 unchanged lines hidden (view full) --- 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 */ 130 } 131} 132 | 1/* 2 * Copyright (C) 2007 Oracle. All rights reserved. 3 * 4 * This program is free software; you can redistribute it and/or 5 * modify it under the terms of the GNU General Public 6 * License v2 as published by the Free Software Foundation. 7 * 8 * This program is distributed in the hope that it will be useful, --- 116 unchanged lines hidden (view full) --- 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 */ 130 } 131} 132 |
133#ifdef CONFIG_PRINTK |
|
133/* 134 * __btrfs_std_error decodes expected errors from the caller and 135 * invokes the approciate error response. 136 */ 137__cold 138void __btrfs_std_error(struct btrfs_fs_info *fs_info, const char *function, 139 unsigned int line, int errno, const char *fmt, ...) 140{ 141 struct super_block *sb = fs_info->sb; | 134/* 135 * __btrfs_std_error decodes expected errors from the caller and 136 * invokes the approciate error response. 137 */ 138__cold 139void __btrfs_std_error(struct btrfs_fs_info *fs_info, const char *function, 140 unsigned int line, int errno, const char *fmt, ...) 141{ 142 struct super_block *sb = fs_info->sb; |
142#ifdef CONFIG_PRINTK | |
143 const char *errstr; | 143 const char *errstr; |
144#endif | |
145 146 /* 147 * Special case: if the error is EROFS, and we're already 148 * under MS_RDONLY, then it is safe here. 149 */ 150 if (errno == -EROFS && (sb->s_flags & MS_RDONLY)) 151 return; 152 | 144 145 /* 146 * Special case: if the error is EROFS, and we're already 147 * under MS_RDONLY, then it is safe here. 148 */ 149 if (errno == -EROFS && (sb->s_flags & MS_RDONLY)) 150 return; 151 |
153#ifdef CONFIG_PRINTK | |
154 errstr = btrfs_decode_error(errno); 155 if (fmt) { 156 struct va_format vaf; 157 va_list args; 158 159 va_start(args, fmt); 160 vaf.fmt = fmt; 161 vaf.va = &args; 162 163 printk(KERN_CRIT 164 "BTRFS: error (device %s) in %s:%d: errno=%d %s (%pV)\n", 165 sb->s_id, function, line, errno, errstr, &vaf); 166 va_end(args); 167 } else { 168 printk(KERN_CRIT "BTRFS: error (device %s) in %s:%d: errno=%d %s\n", 169 sb->s_id, function, line, errno, errstr); 170 } | 152 errstr = btrfs_decode_error(errno); 153 if (fmt) { 154 struct va_format vaf; 155 va_list args; 156 157 va_start(args, fmt); 158 vaf.fmt = fmt; 159 vaf.va = &args; 160 161 printk(KERN_CRIT 162 "BTRFS: error (device %s) in %s:%d: errno=%d %s (%pV)\n", 163 sb->s_id, function, line, errno, errstr, &vaf); 164 va_end(args); 165 } else { 166 printk(KERN_CRIT "BTRFS: error (device %s) in %s:%d: errno=%d %s\n", 167 sb->s_id, function, line, errno, errstr); 168 } |
171#endif | |
172 173 /* Don't go through full error handling during mount */ 174 save_error_info(fs_info); 175 if (sb->s_flags & MS_BORN) 176 btrfs_handle_error(fs_info); 177} 178 | 169 170 /* Don't go through full error handling during mount */ 171 save_error_info(fs_info); 172 if (sb->s_flags & MS_BORN) 173 btrfs_handle_error(fs_info); 174} 175 |
179#ifdef CONFIG_PRINTK | |
180static const char * const logtypes[] = { 181 "emergency", 182 "alert", 183 "critical", 184 "error", 185 "warning", 186 "notice", 187 "info", --- 23 unchanged lines hidden (view full) --- 211 212 vaf.fmt = fmt; 213 vaf.va = &args; 214 215 printk("%sBTRFS %s (device %s): %pV\n", lvl, type, sb->s_id, &vaf); 216 217 va_end(args); 218} | 176static const char * const logtypes[] = { 177 "emergency", 178 "alert", 179 "critical", 180 "error", 181 "warning", 182 "notice", 183 "info", --- 23 unchanged lines hidden (view full) --- 207 208 vaf.fmt = fmt; 209 vaf.va = &args; 210 211 printk("%sBTRFS %s (device %s): %pV\n", lvl, type, sb->s_id, &vaf); 212 213 va_end(args); 214} |
215 216#else 217 218void __btrfs_std_error(struct btrfs_fs_info *fs_info, const char *function, 219 unsigned int line, int errno, const char *fmt, ...) 220{ 221 struct super_block *sb = fs_info->sb; 222 223 /* 224 * Special case: if the error is EROFS, and we're already 225 * under MS_RDONLY, then it is safe here. 226 */ 227 if (errno == -EROFS && (sb->s_flags & MS_RDONLY)) 228 return; 229 230 /* Don't go through full error handling during mount */ 231 if (sb->s_flags & MS_BORN) { 232 save_error_info(fs_info); 233 btrfs_handle_error(fs_info); 234 } 235} |
|
219#endif 220 221/* 222 * We only mark the transaction aborted and then set the file system read-only. 223 * This will prevent new transactions from starting or trying to join this 224 * one. 225 * 226 * This means that error recovery at the call site is limited to freeing --- 71 unchanged lines hidden (view full) --- 298 Opt_space_cache, Opt_clear_cache, Opt_user_subvol_rm_allowed, 299 Opt_enospc_debug, Opt_subvolrootid, Opt_defrag, Opt_inode_cache, 300 Opt_no_space_cache, Opt_recovery, Opt_skip_balance, 301 Opt_check_integrity, Opt_check_integrity_including_extent_data, 302 Opt_check_integrity_print_mask, Opt_fatal_errors, Opt_rescan_uuid_tree, 303 Opt_commit_interval, Opt_barrier, Opt_nodefrag, Opt_nodiscard, 304 Opt_noenospc_debug, Opt_noflushoncommit, Opt_acl, Opt_datacow, 305 Opt_datasum, Opt_treelog, Opt_noinode_cache, | 236#endif 237 238/* 239 * We only mark the transaction aborted and then set the file system read-only. 240 * This will prevent new transactions from starting or trying to join this 241 * one. 242 * 243 * This means that error recovery at the call site is limited to freeing --- 71 unchanged lines hidden (view full) --- 315 Opt_space_cache, Opt_clear_cache, Opt_user_subvol_rm_allowed, 316 Opt_enospc_debug, Opt_subvolrootid, Opt_defrag, Opt_inode_cache, 317 Opt_no_space_cache, Opt_recovery, Opt_skip_balance, 318 Opt_check_integrity, Opt_check_integrity_including_extent_data, 319 Opt_check_integrity_print_mask, Opt_fatal_errors, Opt_rescan_uuid_tree, 320 Opt_commit_interval, Opt_barrier, Opt_nodefrag, Opt_nodiscard, 321 Opt_noenospc_debug, Opt_noflushoncommit, Opt_acl, Opt_datacow, 322 Opt_datasum, Opt_treelog, Opt_noinode_cache, |
306#ifdef CONFIG_BTRFS_DEBUG 307 Opt_fragment_data, Opt_fragment_metadata, Opt_fragment_all, 308#endif | |
309 Opt_err, 310}; 311 312static match_table_t tokens = { 313 {Opt_degraded, "degraded"}, 314 {Opt_subvol, "subvol=%s"}, 315 {Opt_subvolid, "subvolid=%s"}, 316 {Opt_device, "device=%s"}, --- 36 unchanged lines hidden (view full) --- 353 {Opt_recovery, "recovery"}, 354 {Opt_skip_balance, "skip_balance"}, 355 {Opt_check_integrity, "check_int"}, 356 {Opt_check_integrity_including_extent_data, "check_int_data"}, 357 {Opt_check_integrity_print_mask, "check_int_print_mask=%d"}, 358 {Opt_rescan_uuid_tree, "rescan_uuid_tree"}, 359 {Opt_fatal_errors, "fatal_errors=%s"}, 360 {Opt_commit_interval, "commit=%d"}, | 323 Opt_err, 324}; 325 326static match_table_t tokens = { 327 {Opt_degraded, "degraded"}, 328 {Opt_subvol, "subvol=%s"}, 329 {Opt_subvolid, "subvolid=%s"}, 330 {Opt_device, "device=%s"}, --- 36 unchanged lines hidden (view full) --- 367 {Opt_recovery, "recovery"}, 368 {Opt_skip_balance, "skip_balance"}, 369 {Opt_check_integrity, "check_int"}, 370 {Opt_check_integrity_including_extent_data, "check_int_data"}, 371 {Opt_check_integrity_print_mask, "check_int_print_mask=%d"}, 372 {Opt_rescan_uuid_tree, "rescan_uuid_tree"}, 373 {Opt_fatal_errors, "fatal_errors=%s"}, 374 {Opt_commit_interval, "commit=%d"}, |
361#ifdef CONFIG_BTRFS_DEBUG 362 {Opt_fragment_data, "fragment=data"}, 363 {Opt_fragment_metadata, "fragment=metadata"}, 364 {Opt_fragment_all, "fragment=all"}, 365#endif | |
366 {Opt_err, NULL}, 367}; 368 369/* 370 * Regular mount options parser. Everything that is needed only when 371 * reading in a new superblock is parsed here. 372 * XXX JDM: This needs to be cleaned up for remount. 373 */ --- 350 unchanged lines hidden (view full) --- 724 } 725 info->commit_interval = intarg; 726 } else { 727 btrfs_info(root->fs_info, "using default commit interval %ds", 728 BTRFS_DEFAULT_COMMIT_INTERVAL); 729 info->commit_interval = BTRFS_DEFAULT_COMMIT_INTERVAL; 730 } 731 break; | 375 {Opt_err, NULL}, 376}; 377 378/* 379 * Regular mount options parser. Everything that is needed only when 380 * reading in a new superblock is parsed here. 381 * XXX JDM: This needs to be cleaned up for remount. 382 */ --- 350 unchanged lines hidden (view full) --- 733 } 734 info->commit_interval = intarg; 735 } else { 736 btrfs_info(root->fs_info, "using default commit interval %ds", 737 BTRFS_DEFAULT_COMMIT_INTERVAL); 738 info->commit_interval = BTRFS_DEFAULT_COMMIT_INTERVAL; 739 } 740 break; |
732#ifdef CONFIG_BTRFS_DEBUG 733 case Opt_fragment_all: 734 btrfs_info(root->fs_info, "fragmenting all space"); 735 btrfs_set_opt(info->mount_opt, FRAGMENT_DATA); 736 btrfs_set_opt(info->mount_opt, FRAGMENT_METADATA); 737 break; 738 case Opt_fragment_metadata: 739 btrfs_info(root->fs_info, "fragmenting metadata"); 740 btrfs_set_opt(info->mount_opt, 741 FRAGMENT_METADATA); 742 break; 743 case Opt_fragment_data: 744 btrfs_info(root->fs_info, "fragmenting data"); 745 btrfs_set_opt(info->mount_opt, FRAGMENT_DATA); 746 break; 747#endif | |
748 case Opt_err: 749 btrfs_info(root->fs_info, "unrecognized mount option '%s'", p); 750 ret = -EINVAL; 751 goto out; 752 default: 753 break; 754 } 755 } --- 435 unchanged lines hidden (view full) --- 1191#endif 1192 if (info->metadata_ratio) 1193 seq_printf(seq, ",metadata_ratio=%d", 1194 info->metadata_ratio); 1195 if (btrfs_test_opt(root, PANIC_ON_FATAL_ERROR)) 1196 seq_puts(seq, ",fatal_errors=panic"); 1197 if (info->commit_interval != BTRFS_DEFAULT_COMMIT_INTERVAL) 1198 seq_printf(seq, ",commit=%d", info->commit_interval); | 741 case Opt_err: 742 btrfs_info(root->fs_info, "unrecognized mount option '%s'", p); 743 ret = -EINVAL; 744 goto out; 745 default: 746 break; 747 } 748 } --- 435 unchanged lines hidden (view full) --- 1184#endif 1185 if (info->metadata_ratio) 1186 seq_printf(seq, ",metadata_ratio=%d", 1187 info->metadata_ratio); 1188 if (btrfs_test_opt(root, PANIC_ON_FATAL_ERROR)) 1189 seq_puts(seq, ",fatal_errors=panic"); 1190 if (info->commit_interval != BTRFS_DEFAULT_COMMIT_INTERVAL) 1191 seq_printf(seq, ",commit=%d", info->commit_interval); |
1199#ifdef CONFIG_BTRFS_DEBUG 1200 if (btrfs_test_opt(root, FRAGMENT_DATA)) 1201 seq_puts(seq, ",fragment=data"); 1202 if (btrfs_test_opt(root, FRAGMENT_METADATA)) 1203 seq_puts(seq, ",fragment=metadata"); 1204#endif | |
1205 seq_printf(seq, ",subvolid=%llu", 1206 BTRFS_I(d_inode(dentry))->root->root_key.objectid); 1207 seq_puts(seq, ",subvol="); 1208 seq_dentry(seq, dentry, " \t\n\\"); 1209 return 0; 1210} 1211 1212static int btrfs_test_super(struct super_block *s, void *data) --- 1007 unchanged lines hidden (view full) --- 2220 goto out; 2221 ret = btrfs_test_extent_io(); 2222 if (ret) 2223 goto out; 2224 ret = btrfs_test_inodes(); 2225 if (ret) 2226 goto out; 2227 ret = btrfs_test_qgroups(); | 1192 seq_printf(seq, ",subvolid=%llu", 1193 BTRFS_I(d_inode(dentry))->root->root_key.objectid); 1194 seq_puts(seq, ",subvol="); 1195 seq_dentry(seq, dentry, " \t\n\\"); 1196 return 0; 1197} 1198 1199static int btrfs_test_super(struct super_block *s, void *data) --- 1007 unchanged lines hidden (view full) --- 2207 goto out; 2208 ret = btrfs_test_extent_io(); 2209 if (ret) 2210 goto out; 2211 ret = btrfs_test_inodes(); 2212 if (ret) 2213 goto out; 2214 ret = btrfs_test_qgroups(); |
2215 if (ret) 2216 goto out; 2217 ret = btrfs_test_free_space_tree(); |
|
2228out: 2229 btrfs_destroy_test_fs(); 2230 return ret; 2231} 2232 2233static int __init init_btrfs_fs(void) 2234{ 2235 int err; --- 118 unchanged lines hidden --- | 2218out: 2219 btrfs_destroy_test_fs(); 2220 return ret; 2221} 2222 2223static int __init init_btrfs_fs(void) 2224{ 2225 int err; --- 118 unchanged lines hidden --- |