diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2009-12-11 18:31:13 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2009-12-11 18:31:13 -0500 |
commit | 3126c136bc30225d7a43af741778aa50e95e467a (patch) | |
tree | 71e6f0de6e1f4cde200dd632da4d2f61180289bf /fs/ext3 | |
parent | f4d544ee5720d336a8c64f9fd33efb888c302309 (diff) | |
parent | 8e0eb4011bd73d5f91b215b532f74eef478ef795 (diff) |
Merge branch 'for_linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jack/linux-fs-2.6
* 'for_linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jack/linux-fs-2.6: (21 commits)
ext3: PTR_ERR return of wrong pointer in setup_new_group_blocks()
ext3: Fix data / filesystem corruption when write fails to copy data
ext4: Support for 64-bit quota format
ext3: Support for vfsv1 quota format
quota: Implement quota format with 64-bit space and inode limits
quota: Move definition of QFMT_OCFS2 to linux/quota.h
ext2: fix comment in ext2_find_entry about return values
ext3: Unify log messages in ext3
ext2: clear uptodate flag on super block I/O error
ext2: Unify log messages in ext2
ext3: make "norecovery" an alias for "noload"
ext3: Don't update the superblock in ext3_statfs()
ext3: journal all modifications in ext3_xattr_set_handle
ext2: Explicitly assign values to on-disk enum of filetypes
quota: Fix WARN_ON in lookup_one_len
const: struct quota_format_ops
ubifs: remove manual O_SYNC handling
afs: remove manual O_SYNC handling
kill wait_on_page_writeback_range
vfs: Implement proper O_SYNC semantics
...
Diffstat (limited to 'fs/ext3')
-rw-r--r-- | fs/ext3/inode.c | 18 | ||||
-rw-r--r-- | fs/ext3/resize.c | 2 | ||||
-rw-r--r-- | fs/ext3/super.c | 468 | ||||
-rw-r--r-- | fs/ext3/xattr.c | 7 |
4 files changed, 274 insertions, 221 deletions
diff --git a/fs/ext3/inode.c b/fs/ext3/inode.c index 2db957778903..ad14227f509e 100644 --- a/fs/ext3/inode.c +++ b/fs/ext3/inode.c | |||
@@ -1151,6 +1151,16 @@ static int do_journal_get_write_access(handle_t *handle, | |||
1151 | return ext3_journal_get_write_access(handle, bh); | 1151 | return ext3_journal_get_write_access(handle, bh); |
1152 | } | 1152 | } |
1153 | 1153 | ||
1154 | /* | ||
1155 | * Truncate blocks that were not used by write. We have to truncate the | ||
1156 | * pagecache as well so that corresponding buffers get properly unmapped. | ||
1157 | */ | ||
1158 | static void ext3_truncate_failed_write(struct inode *inode) | ||
1159 | { | ||
1160 | truncate_inode_pages(inode->i_mapping, inode->i_size); | ||
1161 | ext3_truncate(inode); | ||
1162 | } | ||
1163 | |||
1154 | static int ext3_write_begin(struct file *file, struct address_space *mapping, | 1164 | static int ext3_write_begin(struct file *file, struct address_space *mapping, |
1155 | loff_t pos, unsigned len, unsigned flags, | 1165 | loff_t pos, unsigned len, unsigned flags, |
1156 | struct page **pagep, void **fsdata) | 1166 | struct page **pagep, void **fsdata) |
@@ -1209,7 +1219,7 @@ write_begin_failed: | |||
1209 | unlock_page(page); | 1219 | unlock_page(page); |
1210 | page_cache_release(page); | 1220 | page_cache_release(page); |
1211 | if (pos + len > inode->i_size) | 1221 | if (pos + len > inode->i_size) |
1212 | ext3_truncate(inode); | 1222 | ext3_truncate_failed_write(inode); |
1213 | } | 1223 | } |
1214 | if (ret == -ENOSPC && ext3_should_retry_alloc(inode->i_sb, &retries)) | 1224 | if (ret == -ENOSPC && ext3_should_retry_alloc(inode->i_sb, &retries)) |
1215 | goto retry; | 1225 | goto retry; |
@@ -1304,7 +1314,7 @@ static int ext3_ordered_write_end(struct file *file, | |||
1304 | page_cache_release(page); | 1314 | page_cache_release(page); |
1305 | 1315 | ||
1306 | if (pos + len > inode->i_size) | 1316 | if (pos + len > inode->i_size) |
1307 | ext3_truncate(inode); | 1317 | ext3_truncate_failed_write(inode); |
1308 | return ret ? ret : copied; | 1318 | return ret ? ret : copied; |
1309 | } | 1319 | } |
1310 | 1320 | ||
@@ -1330,7 +1340,7 @@ static int ext3_writeback_write_end(struct file *file, | |||
1330 | page_cache_release(page); | 1340 | page_cache_release(page); |
1331 | 1341 | ||
1332 | if (pos + len > inode->i_size) | 1342 | if (pos + len > inode->i_size) |
1333 | ext3_truncate(inode); | 1343 | ext3_truncate_failed_write(inode); |
1334 | return ret ? ret : copied; | 1344 | return ret ? ret : copied; |
1335 | } | 1345 | } |
1336 | 1346 | ||
@@ -1383,7 +1393,7 @@ static int ext3_journalled_write_end(struct file *file, | |||
1383 | page_cache_release(page); | 1393 | page_cache_release(page); |
1384 | 1394 | ||
1385 | if (pos + len > inode->i_size) | 1395 | if (pos + len > inode->i_size) |
1386 | ext3_truncate(inode); | 1396 | ext3_truncate_failed_write(inode); |
1387 | return ret ? ret : copied; | 1397 | return ret ? ret : copied; |
1388 | } | 1398 | } |
1389 | 1399 | ||
diff --git a/fs/ext3/resize.c b/fs/ext3/resize.c index 8359e7b3dc89..5f83b6179178 100644 --- a/fs/ext3/resize.c +++ b/fs/ext3/resize.c | |||
@@ -266,7 +266,7 @@ static int setup_new_group_blocks(struct super_block *sb, | |||
266 | goto exit_bh; | 266 | goto exit_bh; |
267 | 267 | ||
268 | if (IS_ERR(gdb = bclean(handle, sb, block))) { | 268 | if (IS_ERR(gdb = bclean(handle, sb, block))) { |
269 | err = PTR_ERR(bh); | 269 | err = PTR_ERR(gdb); |
270 | goto exit_bh; | 270 | goto exit_bh; |
271 | } | 271 | } |
272 | ext3_journal_dirty_metadata(handle, gdb); | 272 | ext3_journal_dirty_metadata(handle, gdb); |
diff --git a/fs/ext3/super.c b/fs/ext3/super.c index 427496c4767c..7ad1e8c30bd0 100644 --- a/fs/ext3/super.c +++ b/fs/ext3/super.c | |||
@@ -135,12 +135,24 @@ void ext3_journal_abort_handle(const char *caller, const char *err_fn, | |||
135 | if (is_handle_aborted(handle)) | 135 | if (is_handle_aborted(handle)) |
136 | return; | 136 | return; |
137 | 137 | ||
138 | printk(KERN_ERR "%s: aborting transaction: %s in %s\n", | 138 | printk(KERN_ERR "EXT3-fs: %s: aborting transaction: %s in %s\n", |
139 | caller, errstr, err_fn); | 139 | caller, errstr, err_fn); |
140 | 140 | ||
141 | journal_abort_handle(handle); | 141 | journal_abort_handle(handle); |
142 | } | 142 | } |
143 | 143 | ||
144 | void ext3_msg(struct super_block *sb, const char *prefix, | ||
145 | const char *fmt, ...) | ||
146 | { | ||
147 | va_list args; | ||
148 | |||
149 | va_start(args, fmt); | ||
150 | printk("%sEXT3-fs (%s): ", prefix, sb->s_id); | ||
151 | vprintk(fmt, args); | ||
152 | printk("\n"); | ||
153 | va_end(args); | ||
154 | } | ||
155 | |||
144 | /* Deal with the reporting of failure conditions on a filesystem such as | 156 | /* Deal with the reporting of failure conditions on a filesystem such as |
145 | * inconsistencies detected or read IO failures. | 157 | * inconsistencies detected or read IO failures. |
146 | * | 158 | * |
@@ -174,12 +186,13 @@ static void ext3_handle_error(struct super_block *sb) | |||
174 | journal_abort(journal, -EIO); | 186 | journal_abort(journal, -EIO); |
175 | } | 187 | } |
176 | if (test_opt (sb, ERRORS_RO)) { | 188 | if (test_opt (sb, ERRORS_RO)) { |
177 | printk (KERN_CRIT "Remounting filesystem read-only\n"); | 189 | ext3_msg(sb, KERN_CRIT, |
190 | "error: remounting filesystem read-only"); | ||
178 | sb->s_flags |= MS_RDONLY; | 191 | sb->s_flags |= MS_RDONLY; |
179 | } | 192 | } |
180 | ext3_commit_super(sb, es, 1); | 193 | ext3_commit_super(sb, es, 1); |
181 | if (test_opt(sb, ERRORS_PANIC)) | 194 | if (test_opt(sb, ERRORS_PANIC)) |
182 | panic("EXT3-fs (device %s): panic forced after error\n", | 195 | panic("EXT3-fs (%s): panic forced after error\n", |
183 | sb->s_id); | 196 | sb->s_id); |
184 | } | 197 | } |
185 | 198 | ||
@@ -247,8 +260,7 @@ void __ext3_std_error (struct super_block * sb, const char * function, | |||
247 | return; | 260 | return; |
248 | 261 | ||
249 | errstr = ext3_decode_error(sb, errno, nbuf); | 262 | errstr = ext3_decode_error(sb, errno, nbuf); |
250 | printk (KERN_CRIT "EXT3-fs error (device %s) in %s: %s\n", | 263 | ext3_msg(sb, KERN_CRIT, "error in %s: %s", function, errstr); |
251 | sb->s_id, function, errstr); | ||
252 | 264 | ||
253 | ext3_handle_error(sb); | 265 | ext3_handle_error(sb); |
254 | } | 266 | } |
@@ -268,21 +280,20 @@ void ext3_abort (struct super_block * sb, const char * function, | |||
268 | { | 280 | { |
269 | va_list args; | 281 | va_list args; |
270 | 282 | ||
271 | printk (KERN_CRIT "ext3_abort called.\n"); | ||
272 | |||
273 | va_start(args, fmt); | 283 | va_start(args, fmt); |
274 | printk(KERN_CRIT "EXT3-fs error (device %s): %s: ",sb->s_id, function); | 284 | printk(KERN_CRIT "EXT3-fs (%s): error: %s: ", sb->s_id, function); |
275 | vprintk(fmt, args); | 285 | vprintk(fmt, args); |
276 | printk("\n"); | 286 | printk("\n"); |
277 | va_end(args); | 287 | va_end(args); |
278 | 288 | ||
279 | if (test_opt(sb, ERRORS_PANIC)) | 289 | if (test_opt(sb, ERRORS_PANIC)) |
280 | panic("EXT3-fs panic from previous error\n"); | 290 | panic("EXT3-fs: panic from previous error\n"); |
281 | 291 | ||
282 | if (sb->s_flags & MS_RDONLY) | 292 | if (sb->s_flags & MS_RDONLY) |
283 | return; | 293 | return; |
284 | 294 | ||
285 | printk(KERN_CRIT "Remounting filesystem read-only\n"); | 295 | ext3_msg(sb, KERN_CRIT, |
296 | "error: remounting filesystem read-only"); | ||
286 | EXT3_SB(sb)->s_mount_state |= EXT3_ERROR_FS; | 297 | EXT3_SB(sb)->s_mount_state |= EXT3_ERROR_FS; |
287 | sb->s_flags |= MS_RDONLY; | 298 | sb->s_flags |= MS_RDONLY; |
288 | EXT3_SB(sb)->s_mount_opt |= EXT3_MOUNT_ABORT; | 299 | EXT3_SB(sb)->s_mount_opt |= EXT3_MOUNT_ABORT; |
@@ -296,7 +307,7 @@ void ext3_warning (struct super_block * sb, const char * function, | |||
296 | va_list args; | 307 | va_list args; |
297 | 308 | ||
298 | va_start(args, fmt); | 309 | va_start(args, fmt); |
299 | printk(KERN_WARNING "EXT3-fs warning (device %s): %s: ", | 310 | printk(KERN_WARNING "EXT3-fs (%s): warning: %s: ", |
300 | sb->s_id, function); | 311 | sb->s_id, function); |
301 | vprintk(fmt, args); | 312 | vprintk(fmt, args); |
302 | printk("\n"); | 313 | printk("\n"); |
@@ -310,10 +321,10 @@ void ext3_update_dynamic_rev(struct super_block *sb) | |||
310 | if (le32_to_cpu(es->s_rev_level) > EXT3_GOOD_OLD_REV) | 321 | if (le32_to_cpu(es->s_rev_level) > EXT3_GOOD_OLD_REV) |
311 | return; | 322 | return; |
312 | 323 | ||
313 | ext3_warning(sb, __func__, | 324 | ext3_msg(sb, KERN_WARNING, |
314 | "updating to rev %d because of new feature flag, " | 325 | "warning: updating to rev %d because of " |
315 | "running e2fsck is recommended", | 326 | "new feature flag, running e2fsck is recommended", |
316 | EXT3_DYNAMIC_REV); | 327 | EXT3_DYNAMIC_REV); |
317 | 328 | ||
318 | es->s_first_ino = cpu_to_le32(EXT3_GOOD_OLD_FIRST_INO); | 329 | es->s_first_ino = cpu_to_le32(EXT3_GOOD_OLD_FIRST_INO); |
319 | es->s_inode_size = cpu_to_le16(EXT3_GOOD_OLD_INODE_SIZE); | 330 | es->s_inode_size = cpu_to_le16(EXT3_GOOD_OLD_INODE_SIZE); |
@@ -331,7 +342,7 @@ void ext3_update_dynamic_rev(struct super_block *sb) | |||
331 | /* | 342 | /* |
332 | * Open the external journal device | 343 | * Open the external journal device |
333 | */ | 344 | */ |
334 | static struct block_device *ext3_blkdev_get(dev_t dev) | 345 | static struct block_device *ext3_blkdev_get(dev_t dev, struct super_block *sb) |
335 | { | 346 | { |
336 | struct block_device *bdev; | 347 | struct block_device *bdev; |
337 | char b[BDEVNAME_SIZE]; | 348 | char b[BDEVNAME_SIZE]; |
@@ -342,8 +353,9 @@ static struct block_device *ext3_blkdev_get(dev_t dev) | |||
342 | return bdev; | 353 | return bdev; |
343 | 354 | ||
344 | fail: | 355 | fail: |
345 | printk(KERN_ERR "EXT3: failed to open journal device %s: %ld\n", | 356 | ext3_msg(sb, "error: failed to open journal device %s: %ld", |
346 | __bdevname(dev, b), PTR_ERR(bdev)); | 357 | __bdevname(dev, b), PTR_ERR(bdev)); |
358 | |||
347 | return NULL; | 359 | return NULL; |
348 | } | 360 | } |
349 | 361 | ||
@@ -378,13 +390,13 @@ static void dump_orphan_list(struct super_block *sb, struct ext3_sb_info *sbi) | |||
378 | { | 390 | { |
379 | struct list_head *l; | 391 | struct list_head *l; |
380 | 392 | ||
381 | printk(KERN_ERR "sb orphan head is %d\n", | 393 | ext3_msg(sb, KERN_ERR, "error: sb orphan head is %d", |
382 | le32_to_cpu(sbi->s_es->s_last_orphan)); | 394 | le32_to_cpu(sbi->s_es->s_last_orphan)); |
383 | 395 | ||
384 | printk(KERN_ERR "sb_info orphan list:\n"); | 396 | ext3_msg(sb, KERN_ERR, "sb_info orphan list:"); |
385 | list_for_each(l, &sbi->s_orphan) { | 397 | list_for_each(l, &sbi->s_orphan) { |
386 | struct inode *inode = orphan_list_entry(l); | 398 | struct inode *inode = orphan_list_entry(l); |
387 | printk(KERN_ERR " " | 399 | ext3_msg(sb, KERN_ERR, " " |
388 | "inode %s:%lu at %p: mode %o, nlink %d, next %d\n", | 400 | "inode %s:%lu at %p: mode %o, nlink %d, next %d\n", |
389 | inode->i_sb->s_id, inode->i_ino, inode, | 401 | inode->i_sb->s_id, inode->i_ino, inode, |
390 | inode->i_mode, inode->i_nlink, | 402 | inode->i_mode, inode->i_nlink, |
@@ -527,9 +539,22 @@ static inline void ext3_show_quota_options(struct seq_file *seq, struct super_bl | |||
527 | #if defined(CONFIG_QUOTA) | 539 | #if defined(CONFIG_QUOTA) |
528 | struct ext3_sb_info *sbi = EXT3_SB(sb); | 540 | struct ext3_sb_info *sbi = EXT3_SB(sb); |
529 | 541 | ||
530 | if (sbi->s_jquota_fmt) | 542 | if (sbi->s_jquota_fmt) { |
531 | seq_printf(seq, ",jqfmt=%s", | 543 | char *fmtname = ""; |
532 | (sbi->s_jquota_fmt == QFMT_VFS_OLD) ? "vfsold": "vfsv0"); | 544 | |
545 | switch (sbi->s_jquota_fmt) { | ||
546 | case QFMT_VFS_OLD: | ||
547 | fmtname = "vfsold"; | ||
548 | break; | ||
549 | case QFMT_VFS_V0: | ||
550 | fmtname = "vfsv0"; | ||
551 | break; | ||
552 | case QFMT_VFS_V1: | ||
553 | fmtname = "vfsv1"; | ||
554 | break; | ||
555 | } | ||
556 | seq_printf(seq, ",jqfmt=%s", fmtname); | ||
557 | } | ||
533 | 558 | ||
534 | if (sbi->s_qf_names[USRQUOTA]) | 559 | if (sbi->s_qf_names[USRQUOTA]) |
535 | seq_printf(seq, ",usrjquota=%s", sbi->s_qf_names[USRQUOTA]); | 560 | seq_printf(seq, ",usrjquota=%s", sbi->s_qf_names[USRQUOTA]); |
@@ -636,6 +661,9 @@ static int ext3_show_options(struct seq_file *seq, struct vfsmount *vfs) | |||
636 | if (test_opt(sb, DATA_ERR_ABORT)) | 661 | if (test_opt(sb, DATA_ERR_ABORT)) |
637 | seq_puts(seq, ",data_err=abort"); | 662 | seq_puts(seq, ",data_err=abort"); |
638 | 663 | ||
664 | if (test_opt(sb, NOLOAD)) | ||
665 | seq_puts(seq, ",norecovery"); | ||
666 | |||
639 | ext3_show_quota_options(seq, sb); | 667 | ext3_show_quota_options(seq, sb); |
640 | 668 | ||
641 | return 0; | 669 | return 0; |
@@ -787,9 +815,9 @@ enum { | |||
787 | Opt_abort, Opt_data_journal, Opt_data_ordered, Opt_data_writeback, | 815 | Opt_abort, Opt_data_journal, Opt_data_ordered, Opt_data_writeback, |
788 | Opt_data_err_abort, Opt_data_err_ignore, | 816 | Opt_data_err_abort, Opt_data_err_ignore, |
789 | Opt_usrjquota, Opt_grpjquota, Opt_offusrjquota, Opt_offgrpjquota, | 817 | Opt_usrjquota, Opt_grpjquota, Opt_offusrjquota, Opt_offgrpjquota, |
790 | Opt_jqfmt_vfsold, Opt_jqfmt_vfsv0, Opt_quota, Opt_noquota, | 818 | Opt_jqfmt_vfsold, Opt_jqfmt_vfsv0, Opt_jqfmt_vfsv1, Opt_quota, |
791 | Opt_ignore, Opt_barrier, Opt_err, Opt_resize, Opt_usrquota, | 819 | Opt_noquota, Opt_ignore, Opt_barrier, Opt_err, Opt_resize, |
792 | Opt_grpquota | 820 | Opt_usrquota, Opt_grpquota |
793 | }; | 821 | }; |
794 | 822 | ||
795 | static const match_table_t tokens = { | 823 | static const match_table_t tokens = { |
@@ -818,6 +846,7 @@ static const match_table_t tokens = { | |||
818 | {Opt_reservation, "reservation"}, | 846 | {Opt_reservation, "reservation"}, |
819 | {Opt_noreservation, "noreservation"}, | 847 | {Opt_noreservation, "noreservation"}, |
820 | {Opt_noload, "noload"}, | 848 | {Opt_noload, "noload"}, |
849 | {Opt_noload, "norecovery"}, | ||
821 | {Opt_nobh, "nobh"}, | 850 | {Opt_nobh, "nobh"}, |
822 | {Opt_bh, "bh"}, | 851 | {Opt_bh, "bh"}, |
823 | {Opt_commit, "commit=%u"}, | 852 | {Opt_commit, "commit=%u"}, |
@@ -836,6 +865,7 @@ static const match_table_t tokens = { | |||
836 | {Opt_grpjquota, "grpjquota=%s"}, | 865 | {Opt_grpjquota, "grpjquota=%s"}, |
837 | {Opt_jqfmt_vfsold, "jqfmt=vfsold"}, | 866 | {Opt_jqfmt_vfsold, "jqfmt=vfsold"}, |
838 | {Opt_jqfmt_vfsv0, "jqfmt=vfsv0"}, | 867 | {Opt_jqfmt_vfsv0, "jqfmt=vfsv0"}, |
868 | {Opt_jqfmt_vfsv1, "jqfmt=vfsv1"}, | ||
839 | {Opt_grpquota, "grpquota"}, | 869 | {Opt_grpquota, "grpquota"}, |
840 | {Opt_noquota, "noquota"}, | 870 | {Opt_noquota, "noquota"}, |
841 | {Opt_quota, "quota"}, | 871 | {Opt_quota, "quota"}, |
@@ -845,7 +875,7 @@ static const match_table_t tokens = { | |||
845 | {Opt_err, NULL}, | 875 | {Opt_err, NULL}, |
846 | }; | 876 | }; |
847 | 877 | ||
848 | static ext3_fsblk_t get_sb_block(void **data) | 878 | static ext3_fsblk_t get_sb_block(void **data, struct super_block *sb) |
849 | { | 879 | { |
850 | ext3_fsblk_t sb_block; | 880 | ext3_fsblk_t sb_block; |
851 | char *options = (char *) *data; | 881 | char *options = (char *) *data; |
@@ -856,7 +886,7 @@ static ext3_fsblk_t get_sb_block(void **data) | |||
856 | /*todo: use simple_strtoll with >32bit ext3 */ | 886 | /*todo: use simple_strtoll with >32bit ext3 */ |
857 | sb_block = simple_strtoul(options, &options, 0); | 887 | sb_block = simple_strtoul(options, &options, 0); |
858 | if (*options && *options != ',') { | 888 | if (*options && *options != ',') { |
859 | printk("EXT3-fs: Invalid sb specification: %s\n", | 889 | ext3_msg(sb, "error: invalid sb specification: %s", |
860 | (char *) *data); | 890 | (char *) *data); |
861 | return 1; | 891 | return 1; |
862 | } | 892 | } |
@@ -956,7 +986,8 @@ static int parse_options (char *options, struct super_block *sb, | |||
956 | #else | 986 | #else |
957 | case Opt_user_xattr: | 987 | case Opt_user_xattr: |
958 | case Opt_nouser_xattr: | 988 | case Opt_nouser_xattr: |
959 | printk("EXT3 (no)user_xattr options not supported\n"); | 989 | ext3_msg(sb, KERN_INFO, |
990 | "(no)user_xattr options not supported"); | ||
960 | break; | 991 | break; |
961 | #endif | 992 | #endif |
962 | #ifdef CONFIG_EXT3_FS_POSIX_ACL | 993 | #ifdef CONFIG_EXT3_FS_POSIX_ACL |
@@ -969,7 +1000,8 @@ static int parse_options (char *options, struct super_block *sb, | |||
969 | #else | 1000 | #else |
970 | case Opt_acl: | 1001 | case Opt_acl: |
971 | case Opt_noacl: | 1002 | case Opt_noacl: |
972 | printk("EXT3 (no)acl options not supported\n"); | 1003 | ext3_msg(sb, KERN_INFO, |
1004 | "(no)acl options not supported"); | ||
973 | break; | 1005 | break; |
974 | #endif | 1006 | #endif |
975 | case Opt_reservation: | 1007 | case Opt_reservation: |
@@ -985,16 +1017,16 @@ static int parse_options (char *options, struct super_block *sb, | |||
985 | user to specify an existing inode to be the | 1017 | user to specify an existing inode to be the |
986 | journal file. */ | 1018 | journal file. */ |
987 | if (is_remount) { | 1019 | if (is_remount) { |
988 | printk(KERN_ERR "EXT3-fs: cannot specify " | 1020 | ext3_msg(sb, KERN_ERR, "error: cannot specify " |
989 | "journal on remount\n"); | 1021 | "journal on remount"); |
990 | return 0; | 1022 | return 0; |
991 | } | 1023 | } |
992 | set_opt (sbi->s_mount_opt, UPDATE_JOURNAL); | 1024 | set_opt (sbi->s_mount_opt, UPDATE_JOURNAL); |
993 | break; | 1025 | break; |
994 | case Opt_journal_inum: | 1026 | case Opt_journal_inum: |
995 | if (is_remount) { | 1027 | if (is_remount) { |
996 | printk(KERN_ERR "EXT3-fs: cannot specify " | 1028 | ext3_msg(sb, KERN_ERR, "error: cannot specify " |
997 | "journal on remount\n"); | 1029 | "journal on remount"); |
998 | return 0; | 1030 | return 0; |
999 | } | 1031 | } |
1000 | if (match_int(&args[0], &option)) | 1032 | if (match_int(&args[0], &option)) |
@@ -1003,8 +1035,8 @@ static int parse_options (char *options, struct super_block *sb, | |||
1003 | break; | 1035 | break; |
1004 | case Opt_journal_dev: | 1036 | case Opt_journal_dev: |
1005 | if (is_remount) { | 1037 | if (is_remount) { |
1006 | printk(KERN_ERR "EXT3-fs: cannot specify " | 1038 | ext3_msg(sb, KERN_ERR, "error: cannot specify " |
1007 | "journal on remount\n"); | 1039 | "journal on remount"); |
1008 | return 0; | 1040 | return 0; |
1009 | } | 1041 | } |
1010 | if (match_int(&args[0], &option)) | 1042 | if (match_int(&args[0], &option)) |
@@ -1036,12 +1068,11 @@ static int parse_options (char *options, struct super_block *sb, | |||
1036 | if ((sbi->s_mount_opt & EXT3_MOUNT_DATA_FLAGS) | 1068 | if ((sbi->s_mount_opt & EXT3_MOUNT_DATA_FLAGS) |
1037 | == data_opt) | 1069 | == data_opt) |
1038 | break; | 1070 | break; |
1039 | printk(KERN_ERR | 1071 | ext3_msg(sb, KERN_ERR, |
1040 | "EXT3-fs (device %s): Cannot change " | 1072 | "error: cannot change " |
1041 | "data mode on remount. The filesystem " | 1073 | "data mode on remount. The filesystem " |
1042 | "is mounted in data=%s mode and you " | 1074 | "is mounted in data=%s mode and you " |
1043 | "try to remount it in data=%s mode.\n", | 1075 | "try to remount it in data=%s mode.", |
1044 | sb->s_id, | ||
1045 | data_mode_string(sbi->s_mount_opt & | 1076 | data_mode_string(sbi->s_mount_opt & |
1046 | EXT3_MOUNT_DATA_FLAGS), | 1077 | EXT3_MOUNT_DATA_FLAGS), |
1047 | data_mode_string(data_opt)); | 1078 | data_mode_string(data_opt)); |
@@ -1066,31 +1097,31 @@ static int parse_options (char *options, struct super_block *sb, | |||
1066 | set_qf_name: | 1097 | set_qf_name: |
1067 | if (sb_any_quota_loaded(sb) && | 1098 | if (sb_any_quota_loaded(sb) && |
1068 | !sbi->s_qf_names[qtype]) { | 1099 | !sbi->s_qf_names[qtype]) { |
1069 | printk(KERN_ERR | 1100 | ext3_msg(sb, KERN_ERR, |
1070 | "EXT3-fs: Cannot change journaled " | 1101 | "error: cannot change journaled " |
1071 | "quota options when quota turned on.\n"); | 1102 | "quota options when quota turned on."); |
1072 | return 0; | 1103 | return 0; |
1073 | } | 1104 | } |
1074 | qname = match_strdup(&args[0]); | 1105 | qname = match_strdup(&args[0]); |
1075 | if (!qname) { | 1106 | if (!qname) { |
1076 | printk(KERN_ERR | 1107 | ext3_msg(sb, KERN_ERR, |
1077 | "EXT3-fs: not enough memory for " | 1108 | "error: not enough memory for " |
1078 | "storing quotafile name.\n"); | 1109 | "storing quotafile name."); |
1079 | return 0; | 1110 | return 0; |
1080 | } | 1111 | } |
1081 | if (sbi->s_qf_names[qtype] && | 1112 | if (sbi->s_qf_names[qtype] && |
1082 | strcmp(sbi->s_qf_names[qtype], qname)) { | 1113 | strcmp(sbi->s_qf_names[qtype], qname)) { |
1083 | printk(KERN_ERR | 1114 | ext3_msg(sb, KERN_ERR, |
1084 | "EXT3-fs: %s quota file already " | 1115 | "error: %s quota file already " |
1085 | "specified.\n", QTYPE2NAME(qtype)); | 1116 | "specified.", QTYPE2NAME(qtype)); |
1086 | kfree(qname); | 1117 | kfree(qname); |
1087 | return 0; | 1118 | return 0; |
1088 | } | 1119 | } |
1089 | sbi->s_qf_names[qtype] = qname; | 1120 | sbi->s_qf_names[qtype] = qname; |
1090 | if (strchr(sbi->s_qf_names[qtype], '/')) { | 1121 | if (strchr(sbi->s_qf_names[qtype], '/')) { |
1091 | printk(KERN_ERR | 1122 | ext3_msg(sb, KERN_ERR, |
1092 | "EXT3-fs: quotafile must be on " | 1123 | "error: quotafile must be on " |
1093 | "filesystem root.\n"); | 1124 | "filesystem root."); |
1094 | kfree(sbi->s_qf_names[qtype]); | 1125 | kfree(sbi->s_qf_names[qtype]); |
1095 | sbi->s_qf_names[qtype] = NULL; | 1126 | sbi->s_qf_names[qtype] = NULL; |
1096 | return 0; | 1127 | return 0; |
@@ -1105,9 +1136,9 @@ set_qf_name: | |||
1105 | clear_qf_name: | 1136 | clear_qf_name: |
1106 | if (sb_any_quota_loaded(sb) && | 1137 | if (sb_any_quota_loaded(sb) && |
1107 | sbi->s_qf_names[qtype]) { | 1138 | sbi->s_qf_names[qtype]) { |
1108 | printk(KERN_ERR "EXT3-fs: Cannot change " | 1139 | ext3_msg(sb, KERN_ERR, "error: cannot change " |
1109 | "journaled quota options when " | 1140 | "journaled quota options when " |
1110 | "quota turned on.\n"); | 1141 | "quota turned on."); |
1111 | return 0; | 1142 | return 0; |
1112 | } | 1143 | } |
1113 | /* | 1144 | /* |
@@ -1121,12 +1152,15 @@ clear_qf_name: | |||
1121 | goto set_qf_format; | 1152 | goto set_qf_format; |
1122 | case Opt_jqfmt_vfsv0: | 1153 | case Opt_jqfmt_vfsv0: |
1123 | qfmt = QFMT_VFS_V0; | 1154 | qfmt = QFMT_VFS_V0; |
1155 | goto set_qf_format; | ||
1156 | case Opt_jqfmt_vfsv1: | ||
1157 | qfmt = QFMT_VFS_V1; | ||
1124 | set_qf_format: | 1158 | set_qf_format: |
1125 | if (sb_any_quota_loaded(sb) && | 1159 | if (sb_any_quota_loaded(sb) && |
1126 | sbi->s_jquota_fmt != qfmt) { | 1160 | sbi->s_jquota_fmt != qfmt) { |
1127 | printk(KERN_ERR "EXT3-fs: Cannot change " | 1161 | ext3_msg(sb, KERN_ERR, "error: cannot change " |
1128 | "journaled quota options when " | 1162 | "journaled quota options when " |
1129 | "quota turned on.\n"); | 1163 | "quota turned on."); |
1130 | return 0; | 1164 | return 0; |
1131 | } | 1165 | } |
1132 | sbi->s_jquota_fmt = qfmt; | 1166 | sbi->s_jquota_fmt = qfmt; |
@@ -1142,8 +1176,8 @@ set_qf_format: | |||
1142 | break; | 1176 | break; |
1143 | case Opt_noquota: | 1177 | case Opt_noquota: |
1144 | if (sb_any_quota_loaded(sb)) { | 1178 | if (sb_any_quota_loaded(sb)) { |
1145 | printk(KERN_ERR "EXT3-fs: Cannot change quota " | 1179 | ext3_msg(sb, KERN_ERR, "error: cannot change " |
1146 | "options when quota turned on.\n"); | 1180 | "quota options when quota turned on."); |
1147 | return 0; | 1181 | return 0; |
1148 | } | 1182 | } |
1149 | clear_opt(sbi->s_mount_opt, QUOTA); | 1183 | clear_opt(sbi->s_mount_opt, QUOTA); |
@@ -1154,8 +1188,8 @@ set_qf_format: | |||
1154 | case Opt_quota: | 1188 | case Opt_quota: |
1155 | case Opt_usrquota: | 1189 | case Opt_usrquota: |
1156 | case Opt_grpquota: | 1190 | case Opt_grpquota: |
1157 | printk(KERN_ERR | 1191 | ext3_msg(sb, KERN_ERR, |
1158 | "EXT3-fs: quota options not supported.\n"); | 1192 | "error: quota options not supported."); |
1159 | break; | 1193 | break; |
1160 | case Opt_usrjquota: | 1194 | case Opt_usrjquota: |
1161 | case Opt_grpjquota: | 1195 | case Opt_grpjquota: |
@@ -1163,9 +1197,10 @@ set_qf_format: | |||
1163 | case Opt_offgrpjquota: | 1197 | case Opt_offgrpjquota: |
1164 | case Opt_jqfmt_vfsold: | 1198 | case Opt_jqfmt_vfsold: |
1165 | case Opt_jqfmt_vfsv0: | 1199 | case Opt_jqfmt_vfsv0: |
1166 | printk(KERN_ERR | 1200 | case Opt_jqfmt_vfsv1: |
1167 | "EXT3-fs: journaled quota options not " | 1201 | ext3_msg(sb, KERN_ERR, |
1168 | "supported.\n"); | 1202 | "error: journaled quota options not " |
1203 | "supported."); | ||
1169 | break; | 1204 | break; |
1170 | case Opt_noquota: | 1205 | case Opt_noquota: |
1171 | break; | 1206 | break; |
@@ -1185,8 +1220,9 @@ set_qf_format: | |||
1185 | break; | 1220 | break; |
1186 | case Opt_resize: | 1221 | case Opt_resize: |
1187 | if (!is_remount) { | 1222 | if (!is_remount) { |
1188 | printk("EXT3-fs: resize option only available " | 1223 | ext3_msg(sb, KERN_ERR, |
1189 | "for remount\n"); | 1224 | "error: resize option only available " |
1225 | "for remount"); | ||
1190 | return 0; | 1226 | return 0; |
1191 | } | 1227 | } |
1192 | if (match_int(&args[0], &option) != 0) | 1228 | if (match_int(&args[0], &option) != 0) |
@@ -1200,9 +1236,9 @@ set_qf_format: | |||
1200 | clear_opt(sbi->s_mount_opt, NOBH); | 1236 | clear_opt(sbi->s_mount_opt, NOBH); |
1201 | break; | 1237 | break; |
1202 | default: | 1238 | default: |
1203 | printk (KERN_ERR | 1239 | ext3_msg(sb, KERN_ERR, |
1204 | "EXT3-fs: Unrecognized mount option \"%s\" " | 1240 | "error: unrecognized mount option \"%s\" " |
1205 | "or missing value\n", p); | 1241 | "or missing value", p); |
1206 | return 0; | 1242 | return 0; |
1207 | } | 1243 | } |
1208 | } | 1244 | } |
@@ -1220,21 +1256,21 @@ set_qf_format: | |||
1220 | (sbi->s_mount_opt & EXT3_MOUNT_GRPQUOTA)) || | 1256 | (sbi->s_mount_opt & EXT3_MOUNT_GRPQUOTA)) || |
1221 | (sbi->s_qf_names[GRPQUOTA] && | 1257 | (sbi->s_qf_names[GRPQUOTA] && |
1222 | (sbi->s_mount_opt & EXT3_MOUNT_USRQUOTA))) { | 1258 | (sbi->s_mount_opt & EXT3_MOUNT_USRQUOTA))) { |
1223 | printk(KERN_ERR "EXT3-fs: old and new quota " | 1259 | ext3_msg(sb, KERN_ERR, "error: old and new quota " |
1224 | "format mixing.\n"); | 1260 | "format mixing."); |
1225 | return 0; | 1261 | return 0; |
1226 | } | 1262 | } |
1227 | 1263 | ||
1228 | if (!sbi->s_jquota_fmt) { | 1264 | if (!sbi->s_jquota_fmt) { |
1229 | printk(KERN_ERR "EXT3-fs: journaled quota format " | 1265 | ext3_msg(sb, KERN_ERR, "error: journaled quota format " |
1230 | "not specified.\n"); | 1266 | "not specified."); |
1231 | return 0; | 1267 | return 0; |
1232 | } | 1268 | } |
1233 | } else { | 1269 | } else { |
1234 | if (sbi->s_jquota_fmt) { | 1270 | if (sbi->s_jquota_fmt) { |
1235 | printk(KERN_ERR "EXT3-fs: journaled quota format " | 1271 | ext3_msg(sb, KERN_ERR, "error: journaled quota format " |
1236 | "specified with no journaling " | 1272 | "specified with no journaling " |
1237 | "enabled.\n"); | 1273 | "enabled."); |
1238 | return 0; | 1274 | return 0; |
1239 | } | 1275 | } |
1240 | } | 1276 | } |
@@ -1249,31 +1285,33 @@ static int ext3_setup_super(struct super_block *sb, struct ext3_super_block *es, | |||
1249 | int res = 0; | 1285 | int res = 0; |
1250 | 1286 | ||
1251 | if (le32_to_cpu(es->s_rev_level) > EXT3_MAX_SUPP_REV) { | 1287 | if (le32_to_cpu(es->s_rev_level) > EXT3_MAX_SUPP_REV) { |
1252 | printk (KERN_ERR "EXT3-fs warning: revision level too high, " | 1288 | ext3_msg(sb, KERN_ERR, |
1253 | "forcing read-only mode\n"); | 1289 | "error: revision level too high, " |
1290 | "forcing read-only mode"); | ||
1254 | res = MS_RDONLY; | 1291 | res = MS_RDONLY; |
1255 | } | 1292 | } |
1256 | if (read_only) | 1293 | if (read_only) |
1257 | return res; | 1294 | return res; |
1258 | if (!(sbi->s_mount_state & EXT3_VALID_FS)) | 1295 | if (!(sbi->s_mount_state & EXT3_VALID_FS)) |
1259 | printk (KERN_WARNING "EXT3-fs warning: mounting unchecked fs, " | 1296 | ext3_msg(sb, KERN_WARNING, |
1260 | "running e2fsck is recommended\n"); | 1297 | "warning: mounting unchecked fs, " |
1298 | "running e2fsck is recommended"); | ||
1261 | else if ((sbi->s_mount_state & EXT3_ERROR_FS)) | 1299 | else if ((sbi->s_mount_state & EXT3_ERROR_FS)) |
1262 | printk (KERN_WARNING | 1300 | ext3_msg(sb, KERN_WARNING, |
1263 | "EXT3-fs warning: mounting fs with errors, " | 1301 | "warning: mounting fs with errors, " |
1264 | "running e2fsck is recommended\n"); | 1302 | "running e2fsck is recommended"); |
1265 | else if ((__s16) le16_to_cpu(es->s_max_mnt_count) >= 0 && | 1303 | else if ((__s16) le16_to_cpu(es->s_max_mnt_count) >= 0 && |
1266 | le16_to_cpu(es->s_mnt_count) >= | 1304 | le16_to_cpu(es->s_mnt_count) >= |
1267 | (unsigned short) (__s16) le16_to_cpu(es->s_max_mnt_count)) | 1305 | (unsigned short) (__s16) le16_to_cpu(es->s_max_mnt_count)) |
1268 | printk (KERN_WARNING | 1306 | ext3_msg(sb, KERN_WARNING, |
1269 | "EXT3-fs warning: maximal mount count reached, " | 1307 | "warning: maximal mount count reached, " |
1270 | "running e2fsck is recommended\n"); | 1308 | "running e2fsck is recommended"); |
1271 | else if (le32_to_cpu(es->s_checkinterval) && | 1309 | else if (le32_to_cpu(es->s_checkinterval) && |
1272 | (le32_to_cpu(es->s_lastcheck) + | 1310 | (le32_to_cpu(es->s_lastcheck) + |
1273 | le32_to_cpu(es->s_checkinterval) <= get_seconds())) | 1311 | le32_to_cpu(es->s_checkinterval) <= get_seconds())) |
1274 | printk (KERN_WARNING | 1312 | ext3_msg(sb, KERN_WARNING, |
1275 | "EXT3-fs warning: checktime reached, " | 1313 | "warning: checktime reached, " |
1276 | "running e2fsck is recommended\n"); | 1314 | "running e2fsck is recommended"); |
1277 | #if 0 | 1315 | #if 0 |
1278 | /* @@@ We _will_ want to clear the valid bit if we find | 1316 | /* @@@ We _will_ want to clear the valid bit if we find |
1279 | inconsistencies, to force a fsck at reboot. But for | 1317 | inconsistencies, to force a fsck at reboot. But for |
@@ -1290,22 +1328,20 @@ static int ext3_setup_super(struct super_block *sb, struct ext3_super_block *es, | |||
1290 | 1328 | ||
1291 | ext3_commit_super(sb, es, 1); | 1329 | ext3_commit_super(sb, es, 1); |
1292 | if (test_opt(sb, DEBUG)) | 1330 | if (test_opt(sb, DEBUG)) |
1293 | printk(KERN_INFO "[EXT3 FS bs=%lu, gc=%lu, " | 1331 | ext3_msg(sb, KERN_INFO, "[bs=%lu, gc=%lu, " |
1294 | "bpg=%lu, ipg=%lu, mo=%04lx]\n", | 1332 | "bpg=%lu, ipg=%lu, mo=%04lx]", |
1295 | sb->s_blocksize, | 1333 | sb->s_blocksize, |
1296 | sbi->s_groups_count, | 1334 | sbi->s_groups_count, |
1297 | EXT3_BLOCKS_PER_GROUP(sb), | 1335 | EXT3_BLOCKS_PER_GROUP(sb), |
1298 | EXT3_INODES_PER_GROUP(sb), | 1336 | EXT3_INODES_PER_GROUP(sb), |
1299 | sbi->s_mount_opt); | 1337 | sbi->s_mount_opt); |
1300 | 1338 | ||
1301 | printk(KERN_INFO "EXT3 FS on %s, ", sb->s_id); | ||
1302 | if (EXT3_SB(sb)->s_journal->j_inode == NULL) { | 1339 | if (EXT3_SB(sb)->s_journal->j_inode == NULL) { |
1303 | char b[BDEVNAME_SIZE]; | 1340 | char b[BDEVNAME_SIZE]; |
1304 | 1341 | ext3_msg(sb, KERN_INFO, "using external journal on %s", | |
1305 | printk("external journal on %s\n", | ||
1306 | bdevname(EXT3_SB(sb)->s_journal->j_dev, b)); | 1342 | bdevname(EXT3_SB(sb)->s_journal->j_dev, b)); |
1307 | } else { | 1343 | } else { |
1308 | printk("internal journal\n"); | 1344 | ext3_msg(sb, KERN_INFO, "using internal journal"); |
1309 | } | 1345 | } |
1310 | return res; | 1346 | return res; |
1311 | } | 1347 | } |
@@ -1399,8 +1435,8 @@ static void ext3_orphan_cleanup (struct super_block * sb, | |||
1399 | } | 1435 | } |
1400 | 1436 | ||
1401 | if (bdev_read_only(sb->s_bdev)) { | 1437 | if (bdev_read_only(sb->s_bdev)) { |
1402 | printk(KERN_ERR "EXT3-fs: write access " | 1438 | ext3_msg(sb, KERN_ERR, "error: write access " |
1403 | "unavailable, skipping orphan cleanup.\n"); | 1439 | "unavailable, skipping orphan cleanup."); |
1404 | return; | 1440 | return; |
1405 | } | 1441 | } |
1406 | 1442 | ||
@@ -1414,8 +1450,7 @@ static void ext3_orphan_cleanup (struct super_block * sb, | |||
1414 | } | 1450 | } |
1415 | 1451 | ||
1416 | if (s_flags & MS_RDONLY) { | 1452 | if (s_flags & MS_RDONLY) { |
1417 | printk(KERN_INFO "EXT3-fs: %s: orphan cleanup on readonly fs\n", | 1453 | ext3_msg(sb, KERN_INFO, "orphan cleanup on readonly fs"); |
1418 | sb->s_id); | ||
1419 | sb->s_flags &= ~MS_RDONLY; | 1454 | sb->s_flags &= ~MS_RDONLY; |
1420 | } | 1455 | } |
1421 | #ifdef CONFIG_QUOTA | 1456 | #ifdef CONFIG_QUOTA |
@@ -1426,9 +1461,9 @@ static void ext3_orphan_cleanup (struct super_block * sb, | |||
1426 | if (EXT3_SB(sb)->s_qf_names[i]) { | 1461 | if (EXT3_SB(sb)->s_qf_names[i]) { |
1427 | int ret = ext3_quota_on_mount(sb, i); | 1462 | int ret = ext3_quota_on_mount(sb, i); |
1428 | if (ret < 0) | 1463 | if (ret < 0) |
1429 | printk(KERN_ERR | 1464 | ext3_msg(sb, KERN_ERR, |
1430 | "EXT3-fs: Cannot turn on journaled " | 1465 | "error: cannot turn on journaled " |
1431 | "quota: error %d\n", ret); | 1466 | "quota: %d", ret); |
1432 | } | 1467 | } |
1433 | } | 1468 | } |
1434 | #endif | 1469 | #endif |
@@ -1466,11 +1501,11 @@ static void ext3_orphan_cleanup (struct super_block * sb, | |||
1466 | #define PLURAL(x) (x), ((x)==1) ? "" : "s" | 1501 | #define PLURAL(x) (x), ((x)==1) ? "" : "s" |
1467 | 1502 | ||
1468 | if (nr_orphans) | 1503 | if (nr_orphans) |
1469 | printk(KERN_INFO "EXT3-fs: %s: %d orphan inode%s deleted\n", | 1504 | ext3_msg(sb, KERN_INFO, "%d orphan inode%s deleted", |
1470 | sb->s_id, PLURAL(nr_orphans)); | 1505 | PLURAL(nr_orphans)); |
1471 | if (nr_truncates) | 1506 | if (nr_truncates) |
1472 | printk(KERN_INFO "EXT3-fs: %s: %d truncate%s cleaned up\n", | 1507 | ext3_msg(sb, KERN_INFO, "%d truncate%s cleaned up", |
1473 | sb->s_id, PLURAL(nr_truncates)); | 1508 | PLURAL(nr_truncates)); |
1474 | #ifdef CONFIG_QUOTA | 1509 | #ifdef CONFIG_QUOTA |
1475 | /* Turn quotas off */ | 1510 | /* Turn quotas off */ |
1476 | for (i = 0; i < MAXQUOTAS; i++) { | 1511 | for (i = 0; i < MAXQUOTAS; i++) { |
@@ -1554,7 +1589,7 @@ static int ext3_fill_super (struct super_block *sb, void *data, int silent) | |||
1554 | struct ext3_super_block *es = NULL; | 1589 | struct ext3_super_block *es = NULL; |
1555 | struct ext3_sb_info *sbi; | 1590 | struct ext3_sb_info *sbi; |
1556 | ext3_fsblk_t block; | 1591 | ext3_fsblk_t block; |
1557 | ext3_fsblk_t sb_block = get_sb_block(&data); | 1592 | ext3_fsblk_t sb_block = get_sb_block(&data, sb); |
1558 | ext3_fsblk_t logic_sb_block; | 1593 | ext3_fsblk_t logic_sb_block; |
1559 | unsigned long offset = 0; | 1594 | unsigned long offset = 0; |
1560 | unsigned int journal_inum = 0; | 1595 | unsigned int journal_inum = 0; |
@@ -1590,7 +1625,7 @@ static int ext3_fill_super (struct super_block *sb, void *data, int silent) | |||
1590 | 1625 | ||
1591 | blocksize = sb_min_blocksize(sb, EXT3_MIN_BLOCK_SIZE); | 1626 | blocksize = sb_min_blocksize(sb, EXT3_MIN_BLOCK_SIZE); |
1592 | if (!blocksize) { | 1627 | if (!blocksize) { |
1593 | printk(KERN_ERR "EXT3-fs: unable to set blocksize\n"); | 1628 | ext3_msg(sb, KERN_ERR, "error: unable to set blocksize"); |
1594 | goto out_fail; | 1629 | goto out_fail; |
1595 | } | 1630 | } |
1596 | 1631 | ||
@@ -1606,7 +1641,7 @@ static int ext3_fill_super (struct super_block *sb, void *data, int silent) | |||
1606 | } | 1641 | } |
1607 | 1642 | ||
1608 | if (!(bh = sb_bread(sb, logic_sb_block))) { | 1643 | if (!(bh = sb_bread(sb, logic_sb_block))) { |
1609 | printk (KERN_ERR "EXT3-fs: unable to read superblock\n"); | 1644 | ext3_msg(sb, KERN_ERR, "error: unable to read superblock"); |
1610 | goto out_fail; | 1645 | goto out_fail; |
1611 | } | 1646 | } |
1612 | /* | 1647 | /* |
@@ -1665,9 +1700,9 @@ static int ext3_fill_super (struct super_block *sb, void *data, int silent) | |||
1665 | (EXT3_HAS_COMPAT_FEATURE(sb, ~0U) || | 1700 | (EXT3_HAS_COMPAT_FEATURE(sb, ~0U) || |
1666 | EXT3_HAS_RO_COMPAT_FEATURE(sb, ~0U) || | 1701 | EXT3_HAS_RO_COMPAT_FEATURE(sb, ~0U) || |
1667 | EXT3_HAS_INCOMPAT_FEATURE(sb, ~0U))) | 1702 | EXT3_HAS_INCOMPAT_FEATURE(sb, ~0U))) |
1668 | printk(KERN_WARNING | 1703 | ext3_msg(sb, KERN_WARNING, |
1669 | "EXT3-fs warning: feature flags set on rev 0 fs, " | 1704 | "warning: feature flags set on rev 0 fs, " |
1670 | "running e2fsck is recommended\n"); | 1705 | "running e2fsck is recommended"); |
1671 | /* | 1706 | /* |
1672 | * Check feature flags regardless of the revision level, since we | 1707 | * Check feature flags regardless of the revision level, since we |
1673 | * previously didn't change the revision level when setting the flags, | 1708 | * previously didn't change the revision level when setting the flags, |
@@ -1675,25 +1710,25 @@ static int ext3_fill_super (struct super_block *sb, void *data, int silent) | |||
1675 | */ | 1710 | */ |
1676 | features = EXT3_HAS_INCOMPAT_FEATURE(sb, ~EXT3_FEATURE_INCOMPAT_SUPP); | 1711 | features = EXT3_HAS_INCOMPAT_FEATURE(sb, ~EXT3_FEATURE_INCOMPAT_SUPP); |
1677 | if (features) { | 1712 | if (features) { |
1678 | printk(KERN_ERR "EXT3-fs: %s: couldn't mount because of " | 1713 | ext3_msg(sb, KERN_ERR, |
1679 | "unsupported optional features (%x).\n", | 1714 | "error: couldn't mount because of unsupported " |
1680 | sb->s_id, le32_to_cpu(features)); | 1715 | "optional features (%x)", le32_to_cpu(features)); |
1681 | goto failed_mount; | 1716 | goto failed_mount; |
1682 | } | 1717 | } |
1683 | features = EXT3_HAS_RO_COMPAT_FEATURE(sb, ~EXT3_FEATURE_RO_COMPAT_SUPP); | 1718 | features = EXT3_HAS_RO_COMPAT_FEATURE(sb, ~EXT3_FEATURE_RO_COMPAT_SUPP); |
1684 | if (!(sb->s_flags & MS_RDONLY) && features) { | 1719 | if (!(sb->s_flags & MS_RDONLY) && features) { |
1685 | printk(KERN_ERR "EXT3-fs: %s: couldn't mount RDWR because of " | 1720 | ext3_msg(sb, KERN_ERR, |
1686 | "unsupported optional features (%x).\n", | 1721 | "error: couldn't mount RDWR because of unsupported " |
1687 | sb->s_id, le32_to_cpu(features)); | 1722 | "optional features (%x)", le32_to_cpu(features)); |
1688 | goto failed_mount; | 1723 | goto failed_mount; |
1689 | } | 1724 | } |
1690 | blocksize = BLOCK_SIZE << le32_to_cpu(es->s_log_block_size); | 1725 | blocksize = BLOCK_SIZE << le32_to_cpu(es->s_log_block_size); |
1691 | 1726 | ||
1692 | if (blocksize < EXT3_MIN_BLOCK_SIZE || | 1727 | if (blocksize < EXT3_MIN_BLOCK_SIZE || |
1693 | blocksize > EXT3_MAX_BLOCK_SIZE) { | 1728 | blocksize > EXT3_MAX_BLOCK_SIZE) { |
1694 | printk(KERN_ERR | 1729 | ext3_msg(sb, KERN_ERR, |
1695 | "EXT3-fs: Unsupported filesystem blocksize %d on %s.\n", | 1730 | "error: couldn't mount because of unsupported " |
1696 | blocksize, sb->s_id); | 1731 | "filesystem blocksize %d", blocksize); |
1697 | goto failed_mount; | 1732 | goto failed_mount; |
1698 | } | 1733 | } |
1699 | 1734 | ||
@@ -1704,30 +1739,31 @@ static int ext3_fill_super (struct super_block *sb, void *data, int silent) | |||
1704 | * than the hardware sectorsize for the machine. | 1739 | * than the hardware sectorsize for the machine. |
1705 | */ | 1740 | */ |
1706 | if (blocksize < hblock) { | 1741 | if (blocksize < hblock) { |
1707 | printk(KERN_ERR "EXT3-fs: blocksize %d too small for " | 1742 | ext3_msg(sb, KERN_ERR, |
1708 | "device blocksize %d.\n", blocksize, hblock); | 1743 | "error: fsblocksize %d too small for " |
1744 | "hardware sectorsize %d", blocksize, hblock); | ||
1709 | goto failed_mount; | 1745 | goto failed_mount; |
1710 | } | 1746 | } |
1711 | 1747 | ||
1712 | brelse (bh); | 1748 | brelse (bh); |
1713 | if (!sb_set_blocksize(sb, blocksize)) { | 1749 | if (!sb_set_blocksize(sb, blocksize)) { |
1714 | printk(KERN_ERR "EXT3-fs: bad blocksize %d.\n", | 1750 | ext3_msg(sb, KERN_ERR, |
1715 | blocksize); | 1751 | "error: bad blocksize %d", blocksize); |
1716 | goto out_fail; | 1752 | goto out_fail; |
1717 | } | 1753 | } |
1718 | logic_sb_block = (sb_block * EXT3_MIN_BLOCK_SIZE) / blocksize; | 1754 | logic_sb_block = (sb_block * EXT3_MIN_BLOCK_SIZE) / blocksize; |
1719 | offset = (sb_block * EXT3_MIN_BLOCK_SIZE) % blocksize; | 1755 | offset = (sb_block * EXT3_MIN_BLOCK_SIZE) % blocksize; |
1720 | bh = sb_bread(sb, logic_sb_block); | 1756 | bh = sb_bread(sb, logic_sb_block); |
1721 | if (!bh) { | 1757 | if (!bh) { |
1722 | printk(KERN_ERR | 1758 | ext3_msg(sb, KERN_ERR, |
1723 | "EXT3-fs: Can't read superblock on 2nd try.\n"); | 1759 | "error: can't read superblock on 2nd try"); |
1724 | goto failed_mount; | 1760 | goto failed_mount; |
1725 | } | 1761 | } |
1726 | es = (struct ext3_super_block *)(((char *)bh->b_data) + offset); | 1762 | es = (struct ext3_super_block *)(((char *)bh->b_data) + offset); |
1727 | sbi->s_es = es; | 1763 | sbi->s_es = es; |
1728 | if (es->s_magic != cpu_to_le16(EXT3_SUPER_MAGIC)) { | 1764 | if (es->s_magic != cpu_to_le16(EXT3_SUPER_MAGIC)) { |
1729 | printk (KERN_ERR | 1765 | ext3_msg(sb, KERN_ERR, |
1730 | "EXT3-fs: Magic mismatch, very weird !\n"); | 1766 | "error: magic mismatch"); |
1731 | goto failed_mount; | 1767 | goto failed_mount; |
1732 | } | 1768 | } |
1733 | } | 1769 | } |
@@ -1743,8 +1779,8 @@ static int ext3_fill_super (struct super_block *sb, void *data, int silent) | |||
1743 | if ((sbi->s_inode_size < EXT3_GOOD_OLD_INODE_SIZE) || | 1779 | if ((sbi->s_inode_size < EXT3_GOOD_OLD_INODE_SIZE) || |
1744 | (!is_power_of_2(sbi->s_inode_size)) || | 1780 | (!is_power_of_2(sbi->s_inode_size)) || |
1745 | (sbi->s_inode_size > blocksize)) { | 1781 | (sbi->s_inode_size > blocksize)) { |
1746 | printk (KERN_ERR | 1782 | ext3_msg(sb, KERN_ERR, |
1747 | "EXT3-fs: unsupported inode size: %d\n", | 1783 | "error: unsupported inode size: %d", |
1748 | sbi->s_inode_size); | 1784 | sbi->s_inode_size); |
1749 | goto failed_mount; | 1785 | goto failed_mount; |
1750 | } | 1786 | } |
@@ -1752,8 +1788,8 @@ static int ext3_fill_super (struct super_block *sb, void *data, int silent) | |||
1752 | sbi->s_frag_size = EXT3_MIN_FRAG_SIZE << | 1788 | sbi->s_frag_size = EXT3_MIN_FRAG_SIZE << |
1753 | le32_to_cpu(es->s_log_frag_size); | 1789 | le32_to_cpu(es->s_log_frag_size); |
1754 | if (blocksize != sbi->s_frag_size) { | 1790 | if (blocksize != sbi->s_frag_size) { |
1755 | printk(KERN_ERR | 1791 | ext3_msg(sb, KERN_ERR, |
1756 | "EXT3-fs: fragsize %lu != blocksize %u (unsupported)\n", | 1792 | "error: fragsize %lu != blocksize %u (unsupported)", |
1757 | sbi->s_frag_size, blocksize); | 1793 | sbi->s_frag_size, blocksize); |
1758 | goto failed_mount; | 1794 | goto failed_mount; |
1759 | } | 1795 | } |
@@ -1789,31 +1825,31 @@ static int ext3_fill_super (struct super_block *sb, void *data, int silent) | |||
1789 | } | 1825 | } |
1790 | 1826 | ||
1791 | if (sbi->s_blocks_per_group > blocksize * 8) { | 1827 | if (sbi->s_blocks_per_group > blocksize * 8) { |
1792 | printk (KERN_ERR | 1828 | ext3_msg(sb, KERN_ERR, |
1793 | "EXT3-fs: #blocks per group too big: %lu\n", | 1829 | "#blocks per group too big: %lu", |
1794 | sbi->s_blocks_per_group); | 1830 | sbi->s_blocks_per_group); |
1795 | goto failed_mount; | 1831 | goto failed_mount; |
1796 | } | 1832 | } |
1797 | if (sbi->s_frags_per_group > blocksize * 8) { | 1833 | if (sbi->s_frags_per_group > blocksize * 8) { |
1798 | printk (KERN_ERR | 1834 | ext3_msg(sb, KERN_ERR, |
1799 | "EXT3-fs: #fragments per group too big: %lu\n", | 1835 | "error: #fragments per group too big: %lu", |
1800 | sbi->s_frags_per_group); | 1836 | sbi->s_frags_per_group); |
1801 | goto failed_mount; | 1837 | goto failed_mount; |
1802 | } | 1838 | } |
1803 | if (sbi->s_inodes_per_group > blocksize * 8) { | 1839 | if (sbi->s_inodes_per_group > blocksize * 8) { |
1804 | printk (KERN_ERR | 1840 | ext3_msg(sb, KERN_ERR, |
1805 | "EXT3-fs: #inodes per group too big: %lu\n", | 1841 | "error: #inodes per group too big: %lu", |
1806 | sbi->s_inodes_per_group); | 1842 | sbi->s_inodes_per_group); |
1807 | goto failed_mount; | 1843 | goto failed_mount; |
1808 | } | 1844 | } |
1809 | 1845 | ||
1810 | if (le32_to_cpu(es->s_blocks_count) > | 1846 | if (le32_to_cpu(es->s_blocks_count) > |
1811 | (sector_t)(~0ULL) >> (sb->s_blocksize_bits - 9)) { | 1847 | (sector_t)(~0ULL) >> (sb->s_blocksize_bits - 9)) { |
1812 | printk(KERN_ERR "EXT3-fs: filesystem on %s:" | 1848 | ext3_msg(sb, KERN_ERR, |
1813 | " too large to mount safely\n", sb->s_id); | 1849 | "error: filesystem is too large to mount safely"); |
1814 | if (sizeof(sector_t) < 8) | 1850 | if (sizeof(sector_t) < 8) |
1815 | printk(KERN_WARNING "EXT3-fs: CONFIG_LBDAF not " | 1851 | ext3_msg(sb, KERN_ERR, |
1816 | "enabled\n"); | 1852 | "error: CONFIG_LBDAF not enabled"); |
1817 | goto failed_mount; | 1853 | goto failed_mount; |
1818 | } | 1854 | } |
1819 | 1855 | ||
@@ -1827,7 +1863,8 @@ static int ext3_fill_super (struct super_block *sb, void *data, int silent) | |||
1827 | sbi->s_group_desc = kmalloc(db_count * sizeof (struct buffer_head *), | 1863 | sbi->s_group_desc = kmalloc(db_count * sizeof (struct buffer_head *), |
1828 | GFP_KERNEL); | 1864 | GFP_KERNEL); |
1829 | if (sbi->s_group_desc == NULL) { | 1865 | if (sbi->s_group_desc == NULL) { |
1830 | printk (KERN_ERR "EXT3-fs: not enough memory\n"); | 1866 | ext3_msg(sb, KERN_ERR, |
1867 | "error: not enough memory"); | ||
1831 | goto failed_mount; | 1868 | goto failed_mount; |
1832 | } | 1869 | } |
1833 | 1870 | ||
@@ -1837,14 +1874,15 @@ static int ext3_fill_super (struct super_block *sb, void *data, int silent) | |||
1837 | block = descriptor_loc(sb, logic_sb_block, i); | 1874 | block = descriptor_loc(sb, logic_sb_block, i); |
1838 | sbi->s_group_desc[i] = sb_bread(sb, block); | 1875 | sbi->s_group_desc[i] = sb_bread(sb, block); |
1839 | if (!sbi->s_group_desc[i]) { | 1876 | if (!sbi->s_group_desc[i]) { |
1840 | printk (KERN_ERR "EXT3-fs: " | 1877 | ext3_msg(sb, KERN_ERR, |
1841 | "can't read group descriptor %d\n", i); | 1878 | "error: can't read group descriptor %d", i); |
1842 | db_count = i; | 1879 | db_count = i; |
1843 | goto failed_mount2; | 1880 | goto failed_mount2; |
1844 | } | 1881 | } |
1845 | } | 1882 | } |
1846 | if (!ext3_check_descriptors (sb)) { | 1883 | if (!ext3_check_descriptors (sb)) { |
1847 | printk(KERN_ERR "EXT3-fs: group descriptors corrupted!\n"); | 1884 | ext3_msg(sb, KERN_ERR, |
1885 | "error: group descriptors corrupted"); | ||
1848 | goto failed_mount2; | 1886 | goto failed_mount2; |
1849 | } | 1887 | } |
1850 | sbi->s_gdb_count = db_count; | 1888 | sbi->s_gdb_count = db_count; |
@@ -1862,7 +1900,7 @@ static int ext3_fill_super (struct super_block *sb, void *data, int silent) | |||
1862 | ext3_count_dirs(sb)); | 1900 | ext3_count_dirs(sb)); |
1863 | } | 1901 | } |
1864 | if (err) { | 1902 | if (err) { |
1865 | printk(KERN_ERR "EXT3-fs: insufficient memory\n"); | 1903 | ext3_msg(sb, KERN_ERR, "error: insufficient memory"); |
1866 | goto failed_mount3; | 1904 | goto failed_mount3; |
1867 | } | 1905 | } |
1868 | 1906 | ||
@@ -1910,9 +1948,9 @@ static int ext3_fill_super (struct super_block *sb, void *data, int silent) | |||
1910 | goto failed_mount3; | 1948 | goto failed_mount3; |
1911 | } else { | 1949 | } else { |
1912 | if (!silent) | 1950 | if (!silent) |
1913 | printk (KERN_ERR | 1951 | ext3_msg(sb, KERN_ERR, |
1914 | "ext3: No journal on filesystem on %s\n", | 1952 | "error: no journal found. " |
1915 | sb->s_id); | 1953 | "mounting ext3 over ext2?"); |
1916 | goto failed_mount3; | 1954 | goto failed_mount3; |
1917 | } | 1955 | } |
1918 | 1956 | ||
@@ -1934,8 +1972,9 @@ static int ext3_fill_super (struct super_block *sb, void *data, int silent) | |||
1934 | case EXT3_MOUNT_WRITEBACK_DATA: | 1972 | case EXT3_MOUNT_WRITEBACK_DATA: |
1935 | if (!journal_check_available_features | 1973 | if (!journal_check_available_features |
1936 | (sbi->s_journal, 0, 0, JFS_FEATURE_INCOMPAT_REVOKE)) { | 1974 | (sbi->s_journal, 0, 0, JFS_FEATURE_INCOMPAT_REVOKE)) { |
1937 | printk(KERN_ERR "EXT3-fs: Journal does not support " | 1975 | ext3_msg(sb, KERN_ERR, |
1938 | "requested data journaling mode\n"); | 1976 | "error: journal does not support " |
1977 | "requested data journaling mode"); | ||
1939 | goto failed_mount4; | 1978 | goto failed_mount4; |
1940 | } | 1979 | } |
1941 | default: | 1980 | default: |
@@ -1944,8 +1983,9 @@ static int ext3_fill_super (struct super_block *sb, void *data, int silent) | |||
1944 | 1983 | ||
1945 | if (test_opt(sb, NOBH)) { | 1984 | if (test_opt(sb, NOBH)) { |
1946 | if (!(test_opt(sb, DATA_FLAGS) == EXT3_MOUNT_WRITEBACK_DATA)) { | 1985 | if (!(test_opt(sb, DATA_FLAGS) == EXT3_MOUNT_WRITEBACK_DATA)) { |
1947 | printk(KERN_WARNING "EXT3-fs: Ignoring nobh option - " | 1986 | ext3_msg(sb, KERN_WARNING, |
1948 | "its supported only with writeback mode\n"); | 1987 | "warning: ignoring nobh option - " |
1988 | "it is supported only with writeback mode"); | ||
1949 | clear_opt(sbi->s_mount_opt, NOBH); | 1989 | clear_opt(sbi->s_mount_opt, NOBH); |
1950 | } | 1990 | } |
1951 | } | 1991 | } |
@@ -1956,18 +1996,18 @@ static int ext3_fill_super (struct super_block *sb, void *data, int silent) | |||
1956 | 1996 | ||
1957 | root = ext3_iget(sb, EXT3_ROOT_INO); | 1997 | root = ext3_iget(sb, EXT3_ROOT_INO); |
1958 | if (IS_ERR(root)) { | 1998 | if (IS_ERR(root)) { |
1959 | printk(KERN_ERR "EXT3-fs: get root inode failed\n"); | 1999 | ext3_msg(sb, KERN_ERR, "error: get root inode failed"); |
1960 | ret = PTR_ERR(root); | 2000 | ret = PTR_ERR(root); |
1961 | goto failed_mount4; | 2001 | goto failed_mount4; |
1962 | } | 2002 | } |
1963 | if (!S_ISDIR(root->i_mode) || !root->i_blocks || !root->i_size) { | 2003 | if (!S_ISDIR(root->i_mode) || !root->i_blocks || !root->i_size) { |
1964 | iput(root); | 2004 | iput(root); |
1965 | printk(KERN_ERR "EXT3-fs: corrupt root inode, run e2fsck\n"); | 2005 | ext3_msg(sb, KERN_ERR, "error: corrupt root inode, run e2fsck"); |
1966 | goto failed_mount4; | 2006 | goto failed_mount4; |
1967 | } | 2007 | } |
1968 | sb->s_root = d_alloc_root(root); | 2008 | sb->s_root = d_alloc_root(root); |
1969 | if (!sb->s_root) { | 2009 | if (!sb->s_root) { |
1970 | printk(KERN_ERR "EXT3-fs: get root dentry failed\n"); | 2010 | ext3_msg(sb, KERN_ERR, "error: get root dentry failed"); |
1971 | iput(root); | 2011 | iput(root); |
1972 | ret = -ENOMEM; | 2012 | ret = -ENOMEM; |
1973 | goto failed_mount4; | 2013 | goto failed_mount4; |
@@ -1986,9 +2026,9 @@ static int ext3_fill_super (struct super_block *sb, void *data, int silent) | |||
1986 | ext3_orphan_cleanup(sb, es); | 2026 | ext3_orphan_cleanup(sb, es); |
1987 | EXT3_SB(sb)->s_mount_state &= ~EXT3_ORPHAN_FS; | 2027 | EXT3_SB(sb)->s_mount_state &= ~EXT3_ORPHAN_FS; |
1988 | if (needs_recovery) | 2028 | if (needs_recovery) |
1989 | printk (KERN_INFO "EXT3-fs: recovery complete.\n"); | 2029 | ext3_msg(sb, KERN_INFO, "recovery complete"); |
1990 | ext3_mark_recovery_complete(sb, es); | 2030 | ext3_mark_recovery_complete(sb, es); |
1991 | printk (KERN_INFO "EXT3-fs: mounted filesystem with %s data mode.\n", | 2031 | ext3_msg(sb, KERN_INFO, "mounted filesystem with %s data mode", |
1992 | test_opt(sb,DATA_FLAGS) == EXT3_MOUNT_JOURNAL_DATA ? "journal": | 2032 | test_opt(sb,DATA_FLAGS) == EXT3_MOUNT_JOURNAL_DATA ? "journal": |
1993 | test_opt(sb,DATA_FLAGS) == EXT3_MOUNT_ORDERED_DATA ? "ordered": | 2033 | test_opt(sb,DATA_FLAGS) == EXT3_MOUNT_ORDERED_DATA ? "ordered": |
1994 | "writeback"); | 2034 | "writeback"); |
@@ -1998,7 +2038,8 @@ static int ext3_fill_super (struct super_block *sb, void *data, int silent) | |||
1998 | 2038 | ||
1999 | cantfind_ext3: | 2039 | cantfind_ext3: |
2000 | if (!silent) | 2040 | if (!silent) |
2001 | printk(KERN_ERR "VFS: Can't find ext3 filesystem on dev %s.\n", | 2041 | ext3_msg(sb, KERN_INFO, |
2042 | "error: can't find ext3 filesystem on dev %s.", | ||
2002 | sb->s_id); | 2043 | sb->s_id); |
2003 | goto failed_mount; | 2044 | goto failed_mount; |
2004 | 2045 | ||
@@ -2066,27 +2107,27 @@ static journal_t *ext3_get_journal(struct super_block *sb, | |||
2066 | 2107 | ||
2067 | journal_inode = ext3_iget(sb, journal_inum); | 2108 | journal_inode = ext3_iget(sb, journal_inum); |
2068 | if (IS_ERR(journal_inode)) { | 2109 | if (IS_ERR(journal_inode)) { |
2069 | printk(KERN_ERR "EXT3-fs: no journal found.\n"); | 2110 | ext3_msg(sb, KERN_ERR, "error: no journal found"); |
2070 | return NULL; | 2111 | return NULL; |
2071 | } | 2112 | } |
2072 | if (!journal_inode->i_nlink) { | 2113 | if (!journal_inode->i_nlink) { |
2073 | make_bad_inode(journal_inode); | 2114 | make_bad_inode(journal_inode); |
2074 | iput(journal_inode); | 2115 | iput(journal_inode); |
2075 | printk(KERN_ERR "EXT3-fs: journal inode is deleted.\n"); | 2116 | ext3_msg(sb, KERN_ERR, "error: journal inode is deleted"); |
2076 | return NULL; | 2117 | return NULL; |
2077 | } | 2118 | } |
2078 | 2119 | ||
2079 | jbd_debug(2, "Journal inode found at %p: %Ld bytes\n", | 2120 | jbd_debug(2, "Journal inode found at %p: %Ld bytes\n", |
2080 | journal_inode, journal_inode->i_size); | 2121 | journal_inode, journal_inode->i_size); |
2081 | if (!S_ISREG(journal_inode->i_mode)) { | 2122 | if (!S_ISREG(journal_inode->i_mode)) { |
2082 | printk(KERN_ERR "EXT3-fs: invalid journal inode.\n"); | 2123 | ext3_msg(sb, KERN_ERR, "error: invalid journal inode"); |
2083 | iput(journal_inode); | 2124 | iput(journal_inode); |
2084 | return NULL; | 2125 | return NULL; |
2085 | } | 2126 | } |
2086 | 2127 | ||
2087 | journal = journal_init_inode(journal_inode); | 2128 | journal = journal_init_inode(journal_inode); |
2088 | if (!journal) { | 2129 | if (!journal) { |
2089 | printk(KERN_ERR "EXT3-fs: Could not load journal inode\n"); | 2130 | ext3_msg(sb, KERN_ERR, "error: could not load journal inode"); |
2090 | iput(journal_inode); | 2131 | iput(journal_inode); |
2091 | return NULL; | 2132 | return NULL; |
2092 | } | 2133 | } |
@@ -2108,13 +2149,13 @@ static journal_t *ext3_get_dev_journal(struct super_block *sb, | |||
2108 | struct ext3_super_block * es; | 2149 | struct ext3_super_block * es; |
2109 | struct block_device *bdev; | 2150 | struct block_device *bdev; |
2110 | 2151 | ||
2111 | bdev = ext3_blkdev_get(j_dev); | 2152 | bdev = ext3_blkdev_get(j_dev, sb); |
2112 | if (bdev == NULL) | 2153 | if (bdev == NULL) |
2113 | return NULL; | 2154 | return NULL; |
2114 | 2155 | ||
2115 | if (bd_claim(bdev, sb)) { | 2156 | if (bd_claim(bdev, sb)) { |
2116 | printk(KERN_ERR | 2157 | ext3_msg(sb, KERN_ERR, |
2117 | "EXT3: failed to claim external journal device.\n"); | 2158 | "error: failed to claim external journal device"); |
2118 | blkdev_put(bdev, FMODE_READ|FMODE_WRITE); | 2159 | blkdev_put(bdev, FMODE_READ|FMODE_WRITE); |
2119 | return NULL; | 2160 | return NULL; |
2120 | } | 2161 | } |
@@ -2122,8 +2163,8 @@ static journal_t *ext3_get_dev_journal(struct super_block *sb, | |||
2122 | blocksize = sb->s_blocksize; | 2163 | blocksize = sb->s_blocksize; |
2123 | hblock = bdev_logical_block_size(bdev); | 2164 | hblock = bdev_logical_block_size(bdev); |
2124 | if (blocksize < hblock) { | 2165 | if (blocksize < hblock) { |
2125 | printk(KERN_ERR | 2166 | ext3_msg(sb, KERN_ERR, |
2126 | "EXT3-fs: blocksize too small for journal device.\n"); | 2167 | "error: blocksize too small for journal device"); |
2127 | goto out_bdev; | 2168 | goto out_bdev; |
2128 | } | 2169 | } |
2129 | 2170 | ||
@@ -2131,8 +2172,8 @@ static journal_t *ext3_get_dev_journal(struct super_block *sb, | |||
2131 | offset = EXT3_MIN_BLOCK_SIZE % blocksize; | 2172 | offset = EXT3_MIN_BLOCK_SIZE % blocksize; |
2132 | set_blocksize(bdev, blocksize); | 2173 | set_blocksize(bdev, blocksize); |
2133 | if (!(bh = __bread(bdev, sb_block, blocksize))) { | 2174 | if (!(bh = __bread(bdev, sb_block, blocksize))) { |
2134 | printk(KERN_ERR "EXT3-fs: couldn't read superblock of " | 2175 | ext3_msg(sb, KERN_ERR, "error: couldn't read superblock of " |
2135 | "external journal\n"); | 2176 | "external journal"); |
2136 | goto out_bdev; | 2177 | goto out_bdev; |
2137 | } | 2178 | } |
2138 | 2179 | ||
@@ -2140,14 +2181,14 @@ static journal_t *ext3_get_dev_journal(struct super_block *sb, | |||
2140 | if ((le16_to_cpu(es->s_magic) != EXT3_SUPER_MAGIC) || | 2181 | if ((le16_to_cpu(es->s_magic) != EXT3_SUPER_MAGIC) || |
2141 | !(le32_to_cpu(es->s_feature_incompat) & | 2182 | !(le32_to_cpu(es->s_feature_incompat) & |
2142 | EXT3_FEATURE_INCOMPAT_JOURNAL_DEV)) { | 2183 | EXT3_FEATURE_INCOMPAT_JOURNAL_DEV)) { |
2143 | printk(KERN_ERR "EXT3-fs: external journal has " | 2184 | ext3_msg(sb, KERN_ERR, "error: external journal has " |
2144 | "bad superblock\n"); | 2185 | "bad superblock"); |
2145 | brelse(bh); | 2186 | brelse(bh); |
2146 | goto out_bdev; | 2187 | goto out_bdev; |
2147 | } | 2188 | } |
2148 | 2189 | ||
2149 | if (memcmp(EXT3_SB(sb)->s_es->s_journal_uuid, es->s_uuid, 16)) { | 2190 | if (memcmp(EXT3_SB(sb)->s_es->s_journal_uuid, es->s_uuid, 16)) { |
2150 | printk(KERN_ERR "EXT3-fs: journal UUID does not match\n"); | 2191 | ext3_msg(sb, KERN_ERR, "error: journal UUID does not match"); |
2151 | brelse(bh); | 2192 | brelse(bh); |
2152 | goto out_bdev; | 2193 | goto out_bdev; |
2153 | } | 2194 | } |
@@ -2159,19 +2200,21 @@ static journal_t *ext3_get_dev_journal(struct super_block *sb, | |||
2159 | journal = journal_init_dev(bdev, sb->s_bdev, | 2200 | journal = journal_init_dev(bdev, sb->s_bdev, |
2160 | start, len, blocksize); | 2201 | start, len, blocksize); |
2161 | if (!journal) { | 2202 | if (!journal) { |
2162 | printk(KERN_ERR "EXT3-fs: failed to create device journal\n"); | 2203 | ext3_msg(sb, KERN_ERR, |
2204 | "error: failed to create device journal"); | ||
2163 | goto out_bdev; | 2205 | goto out_bdev; |
2164 | } | 2206 | } |
2165 | journal->j_private = sb; | 2207 | journal->j_private = sb; |
2166 | ll_rw_block(READ, 1, &journal->j_sb_buffer); | 2208 | ll_rw_block(READ, 1, &journal->j_sb_buffer); |
2167 | wait_on_buffer(journal->j_sb_buffer); | 2209 | wait_on_buffer(journal->j_sb_buffer); |
2168 | if (!buffer_uptodate(journal->j_sb_buffer)) { | 2210 | if (!buffer_uptodate(journal->j_sb_buffer)) { |
2169 | printk(KERN_ERR "EXT3-fs: I/O error on journal device\n"); | 2211 | ext3_msg(sb, KERN_ERR, "I/O error on journal device"); |
2170 | goto out_journal; | 2212 | goto out_journal; |
2171 | } | 2213 | } |
2172 | if (be32_to_cpu(journal->j_superblock->s_nr_users) != 1) { | 2214 | if (be32_to_cpu(journal->j_superblock->s_nr_users) != 1) { |
2173 | printk(KERN_ERR "EXT3-fs: External journal has more than one " | 2215 | ext3_msg(sb, KERN_ERR, |
2174 | "user (unsupported) - %d\n", | 2216 | "error: external journal has more than one " |
2217 | "user (unsupported) - %d", | ||
2175 | be32_to_cpu(journal->j_superblock->s_nr_users)); | 2218 | be32_to_cpu(journal->j_superblock->s_nr_users)); |
2176 | goto out_journal; | 2219 | goto out_journal; |
2177 | } | 2220 | } |
@@ -2197,8 +2240,8 @@ static int ext3_load_journal(struct super_block *sb, | |||
2197 | 2240 | ||
2198 | if (journal_devnum && | 2241 | if (journal_devnum && |
2199 | journal_devnum != le32_to_cpu(es->s_journal_dev)) { | 2242 | journal_devnum != le32_to_cpu(es->s_journal_dev)) { |
2200 | printk(KERN_INFO "EXT3-fs: external journal device major/minor " | 2243 | ext3_msg(sb, KERN_INFO, "external journal device major/minor " |
2201 | "numbers have changed\n"); | 2244 | "numbers have changed"); |
2202 | journal_dev = new_decode_dev(journal_devnum); | 2245 | journal_dev = new_decode_dev(journal_devnum); |
2203 | } else | 2246 | } else |
2204 | journal_dev = new_decode_dev(le32_to_cpu(es->s_journal_dev)); | 2247 | journal_dev = new_decode_dev(le32_to_cpu(es->s_journal_dev)); |
@@ -2213,21 +2256,21 @@ static int ext3_load_journal(struct super_block *sb, | |||
2213 | 2256 | ||
2214 | if (EXT3_HAS_INCOMPAT_FEATURE(sb, EXT3_FEATURE_INCOMPAT_RECOVER)) { | 2257 | if (EXT3_HAS_INCOMPAT_FEATURE(sb, EXT3_FEATURE_INCOMPAT_RECOVER)) { |
2215 | if (sb->s_flags & MS_RDONLY) { | 2258 | if (sb->s_flags & MS_RDONLY) { |
2216 | printk(KERN_INFO "EXT3-fs: INFO: recovery " | 2259 | ext3_msg(sb, KERN_INFO, |
2217 | "required on readonly filesystem.\n"); | 2260 | "recovery required on readonly filesystem"); |
2218 | if (really_read_only) { | 2261 | if (really_read_only) { |
2219 | printk(KERN_ERR "EXT3-fs: write access " | 2262 | ext3_msg(sb, KERN_ERR, "error: write access " |
2220 | "unavailable, cannot proceed.\n"); | 2263 | "unavailable, cannot proceed"); |
2221 | return -EROFS; | 2264 | return -EROFS; |
2222 | } | 2265 | } |
2223 | printk (KERN_INFO "EXT3-fs: write access will " | 2266 | ext3_msg(sb, KERN_INFO, |
2224 | "be enabled during recovery.\n"); | 2267 | "write access will be enabled during recovery"); |
2225 | } | 2268 | } |
2226 | } | 2269 | } |
2227 | 2270 | ||
2228 | if (journal_inum && journal_dev) { | 2271 | if (journal_inum && journal_dev) { |
2229 | printk(KERN_ERR "EXT3-fs: filesystem has both journal " | 2272 | ext3_msg(sb, KERN_ERR, "error: filesystem has both journal " |
2230 | "and inode journals!\n"); | 2273 | "and inode journals"); |
2231 | return -EINVAL; | 2274 | return -EINVAL; |
2232 | } | 2275 | } |
2233 | 2276 | ||
@@ -2242,7 +2285,7 @@ static int ext3_load_journal(struct super_block *sb, | |||
2242 | if (!really_read_only && test_opt(sb, UPDATE_JOURNAL)) { | 2285 | if (!really_read_only && test_opt(sb, UPDATE_JOURNAL)) { |
2243 | err = journal_update_format(journal); | 2286 | err = journal_update_format(journal); |
2244 | if (err) { | 2287 | if (err) { |
2245 | printk(KERN_ERR "EXT3-fs: error updating journal.\n"); | 2288 | ext3_msg(sb, KERN_ERR, "error updating journal"); |
2246 | journal_destroy(journal); | 2289 | journal_destroy(journal); |
2247 | return err; | 2290 | return err; |
2248 | } | 2291 | } |
@@ -2254,7 +2297,7 @@ static int ext3_load_journal(struct super_block *sb, | |||
2254 | err = journal_load(journal); | 2297 | err = journal_load(journal); |
2255 | 2298 | ||
2256 | if (err) { | 2299 | if (err) { |
2257 | printk(KERN_ERR "EXT3-fs: error loading journal.\n"); | 2300 | ext3_msg(sb, KERN_ERR, "error loading journal"); |
2258 | journal_destroy(journal); | 2301 | journal_destroy(journal); |
2259 | return err; | 2302 | return err; |
2260 | } | 2303 | } |
@@ -2273,16 +2316,17 @@ static int ext3_load_journal(struct super_block *sb, | |||
2273 | return 0; | 2316 | return 0; |
2274 | } | 2317 | } |
2275 | 2318 | ||
2276 | static int ext3_create_journal(struct super_block * sb, | 2319 | static int ext3_create_journal(struct super_block *sb, |
2277 | struct ext3_super_block * es, | 2320 | struct ext3_super_block *es, |
2278 | unsigned int journal_inum) | 2321 | unsigned int journal_inum) |
2279 | { | 2322 | { |
2280 | journal_t *journal; | 2323 | journal_t *journal; |
2281 | int err; | 2324 | int err; |
2282 | 2325 | ||
2283 | if (sb->s_flags & MS_RDONLY) { | 2326 | if (sb->s_flags & MS_RDONLY) { |
2284 | printk(KERN_ERR "EXT3-fs: readonly filesystem when trying to " | 2327 | ext3_msg(sb, KERN_ERR, |
2285 | "create journal.\n"); | 2328 | "error: readonly filesystem when trying to " |
2329 | "create journal"); | ||
2286 | return -EROFS; | 2330 | return -EROFS; |
2287 | } | 2331 | } |
2288 | 2332 | ||
@@ -2290,12 +2334,12 @@ static int ext3_create_journal(struct super_block * sb, | |||
2290 | if (!journal) | 2334 | if (!journal) |
2291 | return -EINVAL; | 2335 | return -EINVAL; |
2292 | 2336 | ||
2293 | printk(KERN_INFO "EXT3-fs: creating new journal on inode %u\n", | 2337 | ext3_msg(sb, KERN_INFO, "creating new journal on inode %u", |
2294 | journal_inum); | 2338 | journal_inum); |
2295 | 2339 | ||
2296 | err = journal_create(journal); | 2340 | err = journal_create(journal); |
2297 | if (err) { | 2341 | if (err) { |
2298 | printk(KERN_ERR "EXT3-fs: error creating journal.\n"); | 2342 | ext3_msg(sb, KERN_ERR, "error creating journal"); |
2299 | journal_destroy(journal); | 2343 | journal_destroy(journal); |
2300 | return -EIO; | 2344 | return -EIO; |
2301 | } | 2345 | } |
@@ -2376,8 +2420,8 @@ out: | |||
2376 | * has recorded an error from a previous lifetime, move that error to the | 2420 | * has recorded an error from a previous lifetime, move that error to the |
2377 | * main filesystem now. | 2421 | * main filesystem now. |
2378 | */ | 2422 | */ |
2379 | static void ext3_clear_journal_err(struct super_block * sb, | 2423 | static void ext3_clear_journal_err(struct super_block *sb, |
2380 | struct ext3_super_block * es) | 2424 | struct ext3_super_block *es) |
2381 | { | 2425 | { |
2382 | journal_t *journal; | 2426 | journal_t *journal; |
2383 | int j_errno; | 2427 | int j_errno; |
@@ -2568,10 +2612,10 @@ static int ext3_remount (struct super_block * sb, int * flags, char * data) | |||
2568 | __le32 ret; | 2612 | __le32 ret; |
2569 | if ((ret = EXT3_HAS_RO_COMPAT_FEATURE(sb, | 2613 | if ((ret = EXT3_HAS_RO_COMPAT_FEATURE(sb, |
2570 | ~EXT3_FEATURE_RO_COMPAT_SUPP))) { | 2614 | ~EXT3_FEATURE_RO_COMPAT_SUPP))) { |
2571 | printk(KERN_WARNING "EXT3-fs: %s: couldn't " | 2615 | ext3_msg(sb, KERN_WARNING, |
2572 | "remount RDWR because of unsupported " | 2616 | "warning: couldn't remount RDWR " |
2573 | "optional features (%x).\n", | 2617 | "because of unsupported optional " |
2574 | sb->s_id, le32_to_cpu(ret)); | 2618 | "features (%x)", le32_to_cpu(ret)); |
2575 | err = -EROFS; | 2619 | err = -EROFS; |
2576 | goto restore_opts; | 2620 | goto restore_opts; |
2577 | } | 2621 | } |
@@ -2582,11 +2626,10 @@ static int ext3_remount (struct super_block * sb, int * flags, char * data) | |||
2582 | * require a full umount/remount for now. | 2626 | * require a full umount/remount for now. |
2583 | */ | 2627 | */ |
2584 | if (es->s_last_orphan) { | 2628 | if (es->s_last_orphan) { |
2585 | printk(KERN_WARNING "EXT3-fs: %s: couldn't " | 2629 | ext3_msg(sb, KERN_WARNING, "warning: couldn't " |
2586 | "remount RDWR because of unprocessed " | 2630 | "remount RDWR because of unprocessed " |
2587 | "orphan inode list. Please " | 2631 | "orphan inode list. Please " |
2588 | "umount/remount instead.\n", | 2632 | "umount/remount instead."); |
2589 | sb->s_id); | ||
2590 | err = -EINVAL; | 2633 | err = -EINVAL; |
2591 | goto restore_opts; | 2634 | goto restore_opts; |
2592 | } | 2635 | } |
@@ -2686,13 +2729,11 @@ static int ext3_statfs (struct dentry * dentry, struct kstatfs * buf) | |||
2686 | buf->f_bsize = sb->s_blocksize; | 2729 | buf->f_bsize = sb->s_blocksize; |
2687 | buf->f_blocks = le32_to_cpu(es->s_blocks_count) - sbi->s_overhead_last; | 2730 | buf->f_blocks = le32_to_cpu(es->s_blocks_count) - sbi->s_overhead_last; |
2688 | buf->f_bfree = percpu_counter_sum_positive(&sbi->s_freeblocks_counter); | 2731 | buf->f_bfree = percpu_counter_sum_positive(&sbi->s_freeblocks_counter); |
2689 | es->s_free_blocks_count = cpu_to_le32(buf->f_bfree); | ||
2690 | buf->f_bavail = buf->f_bfree - le32_to_cpu(es->s_r_blocks_count); | 2732 | buf->f_bavail = buf->f_bfree - le32_to_cpu(es->s_r_blocks_count); |
2691 | if (buf->f_bfree < le32_to_cpu(es->s_r_blocks_count)) | 2733 | if (buf->f_bfree < le32_to_cpu(es->s_r_blocks_count)) |
2692 | buf->f_bavail = 0; | 2734 | buf->f_bavail = 0; |
2693 | buf->f_files = le32_to_cpu(es->s_inodes_count); | 2735 | buf->f_files = le32_to_cpu(es->s_inodes_count); |
2694 | buf->f_ffree = percpu_counter_sum_positive(&sbi->s_freeinodes_counter); | 2736 | buf->f_ffree = percpu_counter_sum_positive(&sbi->s_freeinodes_counter); |
2695 | es->s_free_inodes_count = cpu_to_le32(buf->f_ffree); | ||
2696 | buf->f_namelen = EXT3_NAME_LEN; | 2737 | buf->f_namelen = EXT3_NAME_LEN; |
2697 | fsid = le64_to_cpup((void *)es->s_uuid) ^ | 2738 | fsid = le64_to_cpup((void *)es->s_uuid) ^ |
2698 | le64_to_cpup((void *)es->s_uuid + sizeof(u64)); | 2739 | le64_to_cpup((void *)es->s_uuid + sizeof(u64)); |
@@ -2837,9 +2878,9 @@ static int ext3_quota_on(struct super_block *sb, int type, int format_id, | |||
2837 | if (EXT3_SB(sb)->s_qf_names[type]) { | 2878 | if (EXT3_SB(sb)->s_qf_names[type]) { |
2838 | /* Quotafile not of fs root? */ | 2879 | /* Quotafile not of fs root? */ |
2839 | if (path.dentry->d_parent != sb->s_root) | 2880 | if (path.dentry->d_parent != sb->s_root) |
2840 | printk(KERN_WARNING | 2881 | ext3_msg(sb, KERN_WARNING, |
2841 | "EXT3-fs: Quota file not on filesystem root. " | 2882 | "warning: Quota file not on filesystem root. " |
2842 | "Journaled quota will not work.\n"); | 2883 | "Journaled quota will not work."); |
2843 | } | 2884 | } |
2844 | 2885 | ||
2845 | /* | 2886 | /* |
@@ -2921,8 +2962,9 @@ static ssize_t ext3_quota_write(struct super_block *sb, int type, | |||
2921 | handle_t *handle = journal_current_handle(); | 2962 | handle_t *handle = journal_current_handle(); |
2922 | 2963 | ||
2923 | if (!handle) { | 2964 | if (!handle) { |
2924 | printk(KERN_WARNING "EXT3-fs: Quota write (off=%Lu, len=%Lu)" | 2965 | ext3_msg(sb, KERN_WARNING, |
2925 | " cancelled because transaction is not started.\n", | 2966 | "warning: quota write (off=%llu, len=%llu)" |
2967 | " cancelled because transaction is not started.", | ||
2926 | (unsigned long long)off, (unsigned long long)len); | 2968 | (unsigned long long)off, (unsigned long long)len); |
2927 | return -EIO; | 2969 | return -EIO; |
2928 | } | 2970 | } |
diff --git a/fs/ext3/xattr.c b/fs/ext3/xattr.c index 545e37c4b91e..387d92d00b97 100644 --- a/fs/ext3/xattr.c +++ b/fs/ext3/xattr.c | |||
@@ -960,6 +960,10 @@ ext3_xattr_set_handle(handle_t *handle, struct inode *inode, int name_index, | |||
960 | if (error) | 960 | if (error) |
961 | goto cleanup; | 961 | goto cleanup; |
962 | 962 | ||
963 | error = ext3_journal_get_write_access(handle, is.iloc.bh); | ||
964 | if (error) | ||
965 | goto cleanup; | ||
966 | |||
963 | if (EXT3_I(inode)->i_state & EXT3_STATE_NEW) { | 967 | if (EXT3_I(inode)->i_state & EXT3_STATE_NEW) { |
964 | struct ext3_inode *raw_inode = ext3_raw_inode(&is.iloc); | 968 | struct ext3_inode *raw_inode = ext3_raw_inode(&is.iloc); |
965 | memset(raw_inode, 0, EXT3_SB(inode->i_sb)->s_inode_size); | 969 | memset(raw_inode, 0, EXT3_SB(inode->i_sb)->s_inode_size); |
@@ -985,9 +989,6 @@ ext3_xattr_set_handle(handle_t *handle, struct inode *inode, int name_index, | |||
985 | if (flags & XATTR_CREATE) | 989 | if (flags & XATTR_CREATE) |
986 | goto cleanup; | 990 | goto cleanup; |
987 | } | 991 | } |
988 | error = ext3_journal_get_write_access(handle, is.iloc.bh); | ||
989 | if (error) | ||
990 | goto cleanup; | ||
991 | if (!value) { | 992 | if (!value) { |
992 | if (!is.s.not_found) | 993 | if (!is.s.not_found) |
993 | error = ext3_xattr_ibody_set(handle, inode, &i, &is); | 994 | error = ext3_xattr_ibody_set(handle, inode, &i, &is); |