aboutsummaryrefslogtreecommitdiffstats
path: root/fs/ext3
diff options
context:
space:
mode:
Diffstat (limited to 'fs/ext3')
-rw-r--r--fs/ext3/balloc.c30
-rw-r--r--fs/ext3/ext3_jbd.c12
-rw-r--r--fs/ext3/fsync.c3
-rw-r--r--fs/ext3/ialloc.c6
-rw-r--r--fs/ext3/inode.c29
-rw-r--r--fs/ext3/namei.c37
-rw-r--r--fs/ext3/resize.c71
-rw-r--r--fs/ext3/super.c53
-rw-r--r--fs/ext3/xattr.c24
-rw-r--r--fs/ext3/xattr.h7
10 files changed, 138 insertions, 134 deletions
diff --git a/fs/ext3/balloc.c b/fs/ext3/balloc.c
index da0cb2c0e437..92fd0338a6eb 100644
--- a/fs/ext3/balloc.c
+++ b/fs/ext3/balloc.c
@@ -117,7 +117,7 @@ static int ext3_valid_block_bitmap(struct super_block *sb,
117 return 1; 117 return 1;
118 118
119err_out: 119err_out:
120 ext3_error(sb, __FUNCTION__, 120 ext3_error(sb, __func__,
121 "Invalid block bitmap - " 121 "Invalid block bitmap - "
122 "block_group = %d, block = %lu", 122 "block_group = %d, block = %lu",
123 block_group, bitmap_blk); 123 block_group, bitmap_blk);
@@ -147,7 +147,7 @@ read_block_bitmap(struct super_block *sb, unsigned int block_group)
147 bitmap_blk = le32_to_cpu(desc->bg_block_bitmap); 147 bitmap_blk = le32_to_cpu(desc->bg_block_bitmap);
148 bh = sb_getblk(sb, bitmap_blk); 148 bh = sb_getblk(sb, bitmap_blk);
149 if (unlikely(!bh)) { 149 if (unlikely(!bh)) {
150 ext3_error(sb, __FUNCTION__, 150 ext3_error(sb, __func__,
151 "Cannot read block bitmap - " 151 "Cannot read block bitmap - "
152 "block_group = %d, block_bitmap = %u", 152 "block_group = %d, block_bitmap = %u",
153 block_group, le32_to_cpu(desc->bg_block_bitmap)); 153 block_group, le32_to_cpu(desc->bg_block_bitmap));
@@ -158,16 +158,17 @@ read_block_bitmap(struct super_block *sb, unsigned int block_group)
158 158
159 if (bh_submit_read(bh) < 0) { 159 if (bh_submit_read(bh) < 0) {
160 brelse(bh); 160 brelse(bh);
161 ext3_error(sb, __FUNCTION__, 161 ext3_error(sb, __func__,
162 "Cannot read block bitmap - " 162 "Cannot read block bitmap - "
163 "block_group = %d, block_bitmap = %u", 163 "block_group = %d, block_bitmap = %u",
164 block_group, le32_to_cpu(desc->bg_block_bitmap)); 164 block_group, le32_to_cpu(desc->bg_block_bitmap));
165 return NULL; 165 return NULL;
166 } 166 }
167 if (!ext3_valid_block_bitmap(sb, desc, block_group, bh)) { 167 ext3_valid_block_bitmap(sb, desc, block_group, bh);
168 brelse(bh); 168 /*
169 return NULL; 169 * file system mounted not to panic on error, continue with corrupt
170 } 170 * bitmap
171 */
171 return bh; 172 return bh;
172} 173}
173/* 174/*
@@ -232,11 +233,10 @@ restart:
232 prev = rsv; 233 prev = rsv;
233 } 234 }
234 printk("Window map complete.\n"); 235 printk("Window map complete.\n");
235 if (bad) 236 BUG_ON(bad);
236 BUG();
237} 237}
238#define rsv_window_dump(root, verbose) \ 238#define rsv_window_dump(root, verbose) \
239 __rsv_window_dump((root), (verbose), __FUNCTION__) 239 __rsv_window_dump((root), (verbose), __func__)
240#else 240#else
241#define rsv_window_dump(root, verbose) do {} while (0) 241#define rsv_window_dump(root, verbose) do {} while (0)
242#endif 242#endif
@@ -618,7 +618,7 @@ do_more:
618 if (!ext3_clear_bit_atomic(sb_bgl_lock(sbi, block_group), 618 if (!ext3_clear_bit_atomic(sb_bgl_lock(sbi, block_group),
619 bit + i, bitmap_bh->b_data)) { 619 bit + i, bitmap_bh->b_data)) {
620 jbd_unlock_bh_state(bitmap_bh); 620 jbd_unlock_bh_state(bitmap_bh);
621 ext3_error(sb, __FUNCTION__, 621 ext3_error(sb, __func__,
622 "bit already cleared for block "E3FSBLK, 622 "bit already cleared for block "E3FSBLK,
623 block + i); 623 block + i);
624 jbd_lock_bh_state(bitmap_bh); 624 jbd_lock_bh_state(bitmap_bh);
@@ -1642,7 +1642,11 @@ allocated:
1642 "Allocating block in system zone - " 1642 "Allocating block in system zone - "
1643 "blocks from "E3FSBLK", length %lu", 1643 "blocks from "E3FSBLK", length %lu",
1644 ret_block, num); 1644 ret_block, num);
1645 goto out; 1645 /*
1646 * claim_block() marked the blocks we allocated as in use. So we
1647 * may want to selectively mark some of the blocks as free.
1648 */
1649 goto retry_alloc;
1646 } 1650 }
1647 1651
1648 performed_allocation = 1; 1652 performed_allocation = 1;
@@ -1668,7 +1672,7 @@ allocated:
1668 if (ext3_test_bit(grp_alloc_blk+i, 1672 if (ext3_test_bit(grp_alloc_blk+i,
1669 bh2jh(bitmap_bh)->b_committed_data)) { 1673 bh2jh(bitmap_bh)->b_committed_data)) {
1670 printk("%s: block was unexpectedly set in " 1674 printk("%s: block was unexpectedly set in "
1671 "b_committed_data\n", __FUNCTION__); 1675 "b_committed_data\n", __func__);
1672 } 1676 }
1673 } 1677 }
1674 } 1678 }
diff --git a/fs/ext3/ext3_jbd.c b/fs/ext3/ext3_jbd.c
index e1f91fd26a93..d401f148d74d 100644
--- a/fs/ext3/ext3_jbd.c
+++ b/fs/ext3/ext3_jbd.c
@@ -9,7 +9,7 @@ int __ext3_journal_get_undo_access(const char *where, handle_t *handle,
9{ 9{
10 int err = journal_get_undo_access(handle, bh); 10 int err = journal_get_undo_access(handle, bh);
11 if (err) 11 if (err)
12 ext3_journal_abort_handle(where, __FUNCTION__, bh, handle,err); 12 ext3_journal_abort_handle(where, __func__, bh, handle,err);
13 return err; 13 return err;
14} 14}
15 15
@@ -18,7 +18,7 @@ int __ext3_journal_get_write_access(const char *where, handle_t *handle,
18{ 18{
19 int err = journal_get_write_access(handle, bh); 19 int err = journal_get_write_access(handle, bh);
20 if (err) 20 if (err)
21 ext3_journal_abort_handle(where, __FUNCTION__, bh, handle,err); 21 ext3_journal_abort_handle(where, __func__, bh, handle,err);
22 return err; 22 return err;
23} 23}
24 24
@@ -27,7 +27,7 @@ int __ext3_journal_forget(const char *where, handle_t *handle,
27{ 27{
28 int err = journal_forget(handle, bh); 28 int err = journal_forget(handle, bh);
29 if (err) 29 if (err)
30 ext3_journal_abort_handle(where, __FUNCTION__, bh, handle,err); 30 ext3_journal_abort_handle(where, __func__, bh, handle,err);
31 return err; 31 return err;
32} 32}
33 33
@@ -36,7 +36,7 @@ int __ext3_journal_revoke(const char *where, handle_t *handle,
36{ 36{
37 int err = journal_revoke(handle, blocknr, bh); 37 int err = journal_revoke(handle, blocknr, bh);
38 if (err) 38 if (err)
39 ext3_journal_abort_handle(where, __FUNCTION__, bh, handle,err); 39 ext3_journal_abort_handle(where, __func__, bh, handle,err);
40 return err; 40 return err;
41} 41}
42 42
@@ -45,7 +45,7 @@ int __ext3_journal_get_create_access(const char *where,
45{ 45{
46 int err = journal_get_create_access(handle, bh); 46 int err = journal_get_create_access(handle, bh);
47 if (err) 47 if (err)
48 ext3_journal_abort_handle(where, __FUNCTION__, bh, handle,err); 48 ext3_journal_abort_handle(where, __func__, bh, handle,err);
49 return err; 49 return err;
50} 50}
51 51
@@ -54,6 +54,6 @@ int __ext3_journal_dirty_metadata(const char *where,
54{ 54{
55 int err = journal_dirty_metadata(handle, bh); 55 int err = journal_dirty_metadata(handle, bh);
56 if (err) 56 if (err)
57 ext3_journal_abort_handle(where, __FUNCTION__, bh, handle,err); 57 ext3_journal_abort_handle(where, __func__, bh, handle,err);
58 return err; 58 return err;
59} 59}
diff --git a/fs/ext3/fsync.c b/fs/ext3/fsync.c
index a588e23841d4..d33634119e17 100644
--- a/fs/ext3/fsync.c
+++ b/fs/ext3/fsync.c
@@ -72,6 +72,9 @@ int ext3_sync_file(struct file * file, struct dentry *dentry, int datasync)
72 goto out; 72 goto out;
73 } 73 }
74 74
75 if (datasync && !(inode->i_state & I_DIRTY_DATASYNC))
76 goto out;
77
75 /* 78 /*
76 * The VFS has written the file data. If the inode is unaltered 79 * The VFS has written the file data. If the inode is unaltered
77 * then we need not start a commit. 80 * then we need not start a commit.
diff --git a/fs/ext3/ialloc.c b/fs/ext3/ialloc.c
index 96dd5573e49b..77126821b2e9 100644
--- a/fs/ext3/ialloc.c
+++ b/fs/ext3/ialloc.c
@@ -644,7 +644,7 @@ struct inode *ext3_orphan_get(struct super_block *sb, unsigned long ino)
644 644
645 /* Error cases - e2fsck has already cleaned up for us */ 645 /* Error cases - e2fsck has already cleaned up for us */
646 if (ino > max_ino) { 646 if (ino > max_ino) {
647 ext3_warning(sb, __FUNCTION__, 647 ext3_warning(sb, __func__,
648 "bad orphan ino %lu! e2fsck was run?", ino); 648 "bad orphan ino %lu! e2fsck was run?", ino);
649 goto error; 649 goto error;
650 } 650 }
@@ -653,7 +653,7 @@ struct inode *ext3_orphan_get(struct super_block *sb, unsigned long ino)
653 bit = (ino - 1) % EXT3_INODES_PER_GROUP(sb); 653 bit = (ino - 1) % EXT3_INODES_PER_GROUP(sb);
654 bitmap_bh = read_inode_bitmap(sb, block_group); 654 bitmap_bh = read_inode_bitmap(sb, block_group);
655 if (!bitmap_bh) { 655 if (!bitmap_bh) {
656 ext3_warning(sb, __FUNCTION__, 656 ext3_warning(sb, __func__,
657 "inode bitmap error for orphan %lu", ino); 657 "inode bitmap error for orphan %lu", ino);
658 goto error; 658 goto error;
659 } 659 }
@@ -678,7 +678,7 @@ iget_failed:
678 err = PTR_ERR(inode); 678 err = PTR_ERR(inode);
679 inode = NULL; 679 inode = NULL;
680bad_orphan: 680bad_orphan:
681 ext3_warning(sb, __FUNCTION__, 681 ext3_warning(sb, __func__,
682 "bad orphan inode %lu! e2fsck was run?", ino); 682 "bad orphan inode %lu! e2fsck was run?", ino);
683 printk(KERN_NOTICE "ext3_test_bit(bit=%d, block=%llu) = %d\n", 683 printk(KERN_NOTICE "ext3_test_bit(bit=%d, block=%llu) = %d\n",
684 bit, (unsigned long long)bitmap_bh->b_blocknr, 684 bit, (unsigned long long)bitmap_bh->b_blocknr,
diff --git a/fs/ext3/inode.c b/fs/ext3/inode.c
index c683609b0e3a..cc47b76091bf 100644
--- a/fs/ext3/inode.c
+++ b/fs/ext3/inode.c
@@ -95,7 +95,7 @@ int ext3_forget(handle_t *handle, int is_metadata, struct inode *inode,
95 BUFFER_TRACE(bh, "call ext3_journal_revoke"); 95 BUFFER_TRACE(bh, "call ext3_journal_revoke");
96 err = ext3_journal_revoke(handle, blocknr, bh); 96 err = ext3_journal_revoke(handle, blocknr, bh);
97 if (err) 97 if (err)
98 ext3_abort(inode->i_sb, __FUNCTION__, 98 ext3_abort(inode->i_sb, __func__,
99 "error %d when attempting revoke", err); 99 "error %d when attempting revoke", err);
100 BUFFER_TRACE(bh, "exit"); 100 BUFFER_TRACE(bh, "exit");
101 return err; 101 return err;
@@ -1190,7 +1190,7 @@ int ext3_journal_dirty_data(handle_t *handle, struct buffer_head *bh)
1190{ 1190{
1191 int err = journal_dirty_data(handle, bh); 1191 int err = journal_dirty_data(handle, bh);
1192 if (err) 1192 if (err)
1193 ext3_journal_abort_handle(__FUNCTION__, __FUNCTION__, 1193 ext3_journal_abort_handle(__func__, __func__,
1194 bh, handle, err); 1194 bh, handle, err);
1195 return err; 1195 return err;
1196} 1196}
@@ -2454,11 +2454,10 @@ out_stop:
2454static ext3_fsblk_t ext3_get_inode_block(struct super_block *sb, 2454static ext3_fsblk_t ext3_get_inode_block(struct super_block *sb,
2455 unsigned long ino, struct ext3_iloc *iloc) 2455 unsigned long ino, struct ext3_iloc *iloc)
2456{ 2456{
2457 unsigned long desc, group_desc, block_group; 2457 unsigned long block_group;
2458 unsigned long offset; 2458 unsigned long offset;
2459 ext3_fsblk_t block; 2459 ext3_fsblk_t block;
2460 struct buffer_head *bh; 2460 struct ext3_group_desc *gdp;
2461 struct ext3_group_desc * gdp;
2462 2461
2463 if (!ext3_valid_inum(sb, ino)) { 2462 if (!ext3_valid_inum(sb, ino)) {
2464 /* 2463 /*
@@ -2470,27 +2469,15 @@ static ext3_fsblk_t ext3_get_inode_block(struct super_block *sb,
2470 } 2469 }
2471 2470
2472 block_group = (ino - 1) / EXT3_INODES_PER_GROUP(sb); 2471 block_group = (ino - 1) / EXT3_INODES_PER_GROUP(sb);
2473 if (block_group >= EXT3_SB(sb)->s_groups_count) { 2472 gdp = ext3_get_group_desc(sb, block_group, NULL);
2474 ext3_error(sb,"ext3_get_inode_block","group >= groups count"); 2473 if (!gdp)
2475 return 0;
2476 }
2477 smp_rmb();
2478 group_desc = block_group >> EXT3_DESC_PER_BLOCK_BITS(sb);
2479 desc = block_group & (EXT3_DESC_PER_BLOCK(sb) - 1);
2480 bh = EXT3_SB(sb)->s_group_desc[group_desc];
2481 if (!bh) {
2482 ext3_error (sb, "ext3_get_inode_block",
2483 "Descriptor not loaded");
2484 return 0; 2474 return 0;
2485 }
2486
2487 gdp = (struct ext3_group_desc *)bh->b_data;
2488 /* 2475 /*
2489 * Figure out the offset within the block group inode table 2476 * Figure out the offset within the block group inode table
2490 */ 2477 */
2491 offset = ((ino - 1) % EXT3_INODES_PER_GROUP(sb)) * 2478 offset = ((ino - 1) % EXT3_INODES_PER_GROUP(sb)) *
2492 EXT3_INODE_SIZE(sb); 2479 EXT3_INODE_SIZE(sb);
2493 block = le32_to_cpu(gdp[desc].bg_inode_table) + 2480 block = le32_to_cpu(gdp->bg_inode_table) +
2494 (offset >> EXT3_BLOCK_SIZE_BITS(sb)); 2481 (offset >> EXT3_BLOCK_SIZE_BITS(sb));
2495 2482
2496 iloc->block_group = block_group; 2483 iloc->block_group = block_group;
@@ -3214,7 +3201,7 @@ void ext3_dirty_inode(struct inode *inode)
3214 current_handle->h_transaction != handle->h_transaction) { 3201 current_handle->h_transaction != handle->h_transaction) {
3215 /* This task has a transaction open against a different fs */ 3202 /* This task has a transaction open against a different fs */
3216 printk(KERN_EMERG "%s: transactions do not match!\n", 3203 printk(KERN_EMERG "%s: transactions do not match!\n",
3217 __FUNCTION__); 3204 __func__);
3218 } else { 3205 } else {
3219 jbd_debug(5, "marking dirty. outer handle=%p\n", 3206 jbd_debug(5, "marking dirty. outer handle=%p\n",
3220 current_handle); 3207 current_handle);
diff --git a/fs/ext3/namei.c b/fs/ext3/namei.c
index dec3e0d88ab1..0b8cf80154f1 100644
--- a/fs/ext3/namei.c
+++ b/fs/ext3/namei.c
@@ -57,10 +57,15 @@ static struct buffer_head *ext3_append(handle_t *handle,
57 57
58 *block = inode->i_size >> inode->i_sb->s_blocksize_bits; 58 *block = inode->i_size >> inode->i_sb->s_blocksize_bits;
59 59
60 if ((bh = ext3_bread(handle, inode, *block, 1, err))) { 60 bh = ext3_bread(handle, inode, *block, 1, err);
61 if (bh) {
61 inode->i_size += inode->i_sb->s_blocksize; 62 inode->i_size += inode->i_sb->s_blocksize;
62 EXT3_I(inode)->i_disksize = inode->i_size; 63 EXT3_I(inode)->i_disksize = inode->i_size;
63 ext3_journal_get_write_access(handle,bh); 64 *err = ext3_journal_get_write_access(handle, bh);
65 if (*err) {
66 brelse(bh);
67 bh = NULL;
68 }
64 } 69 }
65 return bh; 70 return bh;
66} 71}
@@ -356,7 +361,7 @@ dx_probe(struct dentry *dentry, struct inode *dir,
356 if (root->info.hash_version != DX_HASH_TEA && 361 if (root->info.hash_version != DX_HASH_TEA &&
357 root->info.hash_version != DX_HASH_HALF_MD4 && 362 root->info.hash_version != DX_HASH_HALF_MD4 &&
358 root->info.hash_version != DX_HASH_LEGACY) { 363 root->info.hash_version != DX_HASH_LEGACY) {
359 ext3_warning(dir->i_sb, __FUNCTION__, 364 ext3_warning(dir->i_sb, __func__,
360 "Unrecognised inode hash code %d", 365 "Unrecognised inode hash code %d",
361 root->info.hash_version); 366 root->info.hash_version);
362 brelse(bh); 367 brelse(bh);
@@ -370,7 +375,7 @@ dx_probe(struct dentry *dentry, struct inode *dir,
370 hash = hinfo->hash; 375 hash = hinfo->hash;
371 376
372 if (root->info.unused_flags & 1) { 377 if (root->info.unused_flags & 1) {
373 ext3_warning(dir->i_sb, __FUNCTION__, 378 ext3_warning(dir->i_sb, __func__,
374 "Unimplemented inode hash flags: %#06x", 379 "Unimplemented inode hash flags: %#06x",
375 root->info.unused_flags); 380 root->info.unused_flags);
376 brelse(bh); 381 brelse(bh);
@@ -379,7 +384,7 @@ dx_probe(struct dentry *dentry, struct inode *dir,
379 } 384 }
380 385
381 if ((indirect = root->info.indirect_levels) > 1) { 386 if ((indirect = root->info.indirect_levels) > 1) {
382 ext3_warning(dir->i_sb, __FUNCTION__, 387 ext3_warning(dir->i_sb, __func__,
383 "Unimplemented inode hash depth: %#06x", 388 "Unimplemented inode hash depth: %#06x",
384 root->info.indirect_levels); 389 root->info.indirect_levels);
385 brelse(bh); 390 brelse(bh);
@@ -392,7 +397,7 @@ dx_probe(struct dentry *dentry, struct inode *dir,
392 397
393 if (dx_get_limit(entries) != dx_root_limit(dir, 398 if (dx_get_limit(entries) != dx_root_limit(dir,
394 root->info.info_length)) { 399 root->info.info_length)) {
395 ext3_warning(dir->i_sb, __FUNCTION__, 400 ext3_warning(dir->i_sb, __func__,
396 "dx entry: limit != root limit"); 401 "dx entry: limit != root limit");
397 brelse(bh); 402 brelse(bh);
398 *err = ERR_BAD_DX_DIR; 403 *err = ERR_BAD_DX_DIR;
@@ -404,7 +409,7 @@ dx_probe(struct dentry *dentry, struct inode *dir,
404 { 409 {
405 count = dx_get_count(entries); 410 count = dx_get_count(entries);
406 if (!count || count > dx_get_limit(entries)) { 411 if (!count || count > dx_get_limit(entries)) {
407 ext3_warning(dir->i_sb, __FUNCTION__, 412 ext3_warning(dir->i_sb, __func__,
408 "dx entry: no count or count > limit"); 413 "dx entry: no count or count > limit");
409 brelse(bh); 414 brelse(bh);
410 *err = ERR_BAD_DX_DIR; 415 *err = ERR_BAD_DX_DIR;
@@ -449,7 +454,7 @@ dx_probe(struct dentry *dentry, struct inode *dir,
449 goto fail2; 454 goto fail2;
450 at = entries = ((struct dx_node *) bh->b_data)->entries; 455 at = entries = ((struct dx_node *) bh->b_data)->entries;
451 if (dx_get_limit(entries) != dx_node_limit (dir)) { 456 if (dx_get_limit(entries) != dx_node_limit (dir)) {
452 ext3_warning(dir->i_sb, __FUNCTION__, 457 ext3_warning(dir->i_sb, __func__,
453 "dx entry: limit != node limit"); 458 "dx entry: limit != node limit");
454 brelse(bh); 459 brelse(bh);
455 *err = ERR_BAD_DX_DIR; 460 *err = ERR_BAD_DX_DIR;
@@ -465,7 +470,7 @@ fail2:
465 } 470 }
466fail: 471fail:
467 if (*err == ERR_BAD_DX_DIR) 472 if (*err == ERR_BAD_DX_DIR)
468 ext3_warning(dir->i_sb, __FUNCTION__, 473 ext3_warning(dir->i_sb, __func__,
469 "Corrupt dir inode %ld, running e2fsck is " 474 "Corrupt dir inode %ld, running e2fsck is "
470 "recommended.", dir->i_ino); 475 "recommended.", dir->i_ino);
471 return NULL; 476 return NULL;
@@ -913,7 +918,7 @@ restart:
913 wait_on_buffer(bh); 918 wait_on_buffer(bh);
914 if (!buffer_uptodate(bh)) { 919 if (!buffer_uptodate(bh)) {
915 /* read error, skip block & hope for the best */ 920 /* read error, skip block & hope for the best */
916 ext3_error(sb, __FUNCTION__, "reading directory #%lu " 921 ext3_error(sb, __func__, "reading directory #%lu "
917 "offset %lu", dir->i_ino, block); 922 "offset %lu", dir->i_ino, block);
918 brelse(bh); 923 brelse(bh);
919 goto next; 924 goto next;
@@ -1005,7 +1010,7 @@ static struct buffer_head * ext3_dx_find_entry(struct dentry *dentry,
1005 retval = ext3_htree_next_block(dir, hash, frame, 1010 retval = ext3_htree_next_block(dir, hash, frame,
1006 frames, NULL); 1011 frames, NULL);
1007 if (retval < 0) { 1012 if (retval < 0) {
1008 ext3_warning(sb, __FUNCTION__, 1013 ext3_warning(sb, __func__,
1009 "error reading index page in directory #%lu", 1014 "error reading index page in directory #%lu",
1010 dir->i_ino); 1015 dir->i_ino);
1011 *err = retval; 1016 *err = retval;
@@ -1530,7 +1535,7 @@ static int ext3_dx_add_entry(handle_t *handle, struct dentry *dentry,
1530 1535
1531 if (levels && (dx_get_count(frames->entries) == 1536 if (levels && (dx_get_count(frames->entries) ==
1532 dx_get_limit(frames->entries))) { 1537 dx_get_limit(frames->entries))) {
1533 ext3_warning(sb, __FUNCTION__, 1538 ext3_warning(sb, __func__,
1534 "Directory index full!"); 1539 "Directory index full!");
1535 err = -ENOSPC; 1540 err = -ENOSPC;
1536 goto cleanup; 1541 goto cleanup;
@@ -1832,11 +1837,11 @@ static int empty_dir (struct inode * inode)
1832 if (inode->i_size < EXT3_DIR_REC_LEN(1) + EXT3_DIR_REC_LEN(2) || 1837 if (inode->i_size < EXT3_DIR_REC_LEN(1) + EXT3_DIR_REC_LEN(2) ||
1833 !(bh = ext3_bread (NULL, inode, 0, 0, &err))) { 1838 !(bh = ext3_bread (NULL, inode, 0, 0, &err))) {
1834 if (err) 1839 if (err)
1835 ext3_error(inode->i_sb, __FUNCTION__, 1840 ext3_error(inode->i_sb, __func__,
1836 "error %d reading directory #%lu offset 0", 1841 "error %d reading directory #%lu offset 0",
1837 err, inode->i_ino); 1842 err, inode->i_ino);
1838 else 1843 else
1839 ext3_warning(inode->i_sb, __FUNCTION__, 1844 ext3_warning(inode->i_sb, __func__,
1840 "bad directory (dir #%lu) - no data block", 1845 "bad directory (dir #%lu) - no data block",
1841 inode->i_ino); 1846 inode->i_ino);
1842 return 1; 1847 return 1;
@@ -1865,7 +1870,7 @@ static int empty_dir (struct inode * inode)
1865 offset >> EXT3_BLOCK_SIZE_BITS(sb), 0, &err); 1870 offset >> EXT3_BLOCK_SIZE_BITS(sb), 0, &err);
1866 if (!bh) { 1871 if (!bh) {
1867 if (err) 1872 if (err)
1868 ext3_error(sb, __FUNCTION__, 1873 ext3_error(sb, __func__,
1869 "error %d reading directory" 1874 "error %d reading directory"
1870 " #%lu offset %lu", 1875 " #%lu offset %lu",
1871 err, inode->i_ino, offset); 1876 err, inode->i_ino, offset);
@@ -2318,6 +2323,8 @@ static int ext3_rename (struct inode * old_dir, struct dentry *old_dentry,
2318 EXT3_FEATURE_INCOMPAT_FILETYPE)) 2323 EXT3_FEATURE_INCOMPAT_FILETYPE))
2319 new_de->file_type = old_de->file_type; 2324 new_de->file_type = old_de->file_type;
2320 new_dir->i_version++; 2325 new_dir->i_version++;
2326 new_dir->i_ctime = new_dir->i_mtime = CURRENT_TIME_SEC;
2327 ext3_mark_inode_dirty(handle, new_dir);
2321 BUFFER_TRACE(new_bh, "call ext3_journal_dirty_metadata"); 2328 BUFFER_TRACE(new_bh, "call ext3_journal_dirty_metadata");
2322 ext3_journal_dirty_metadata(handle, new_bh); 2329 ext3_journal_dirty_metadata(handle, new_bh);
2323 brelse(new_bh); 2330 brelse(new_bh);
diff --git a/fs/ext3/resize.c b/fs/ext3/resize.c
index 0e97b6e07cb0..28cfd0b40527 100644
--- a/fs/ext3/resize.c
+++ b/fs/ext3/resize.c
@@ -48,60 +48,60 @@ static int verify_group_input(struct super_block *sb,
48 free_blocks_count, input->reserved_blocks); 48 free_blocks_count, input->reserved_blocks);
49 49
50 if (group != sbi->s_groups_count) 50 if (group != sbi->s_groups_count)
51 ext3_warning(sb, __FUNCTION__, 51 ext3_warning(sb, __func__,
52 "Cannot add at group %u (only %lu groups)", 52 "Cannot add at group %u (only %lu groups)",
53 input->group, sbi->s_groups_count); 53 input->group, sbi->s_groups_count);
54 else if ((start - le32_to_cpu(es->s_first_data_block)) % 54 else if ((start - le32_to_cpu(es->s_first_data_block)) %
55 EXT3_BLOCKS_PER_GROUP(sb)) 55 EXT3_BLOCKS_PER_GROUP(sb))
56 ext3_warning(sb, __FUNCTION__, "Last group not full"); 56 ext3_warning(sb, __func__, "Last group not full");
57 else if (input->reserved_blocks > input->blocks_count / 5) 57 else if (input->reserved_blocks > input->blocks_count / 5)
58 ext3_warning(sb, __FUNCTION__, "Reserved blocks too high (%u)", 58 ext3_warning(sb, __func__, "Reserved blocks too high (%u)",
59 input->reserved_blocks); 59 input->reserved_blocks);
60 else if (free_blocks_count < 0) 60 else if (free_blocks_count < 0)
61 ext3_warning(sb, __FUNCTION__, "Bad blocks count %u", 61 ext3_warning(sb, __func__, "Bad blocks count %u",
62 input->blocks_count); 62 input->blocks_count);
63 else if (!(bh = sb_bread(sb, end - 1))) 63 else if (!(bh = sb_bread(sb, end - 1)))
64 ext3_warning(sb, __FUNCTION__, 64 ext3_warning(sb, __func__,
65 "Cannot read last block ("E3FSBLK")", 65 "Cannot read last block ("E3FSBLK")",
66 end - 1); 66 end - 1);
67 else if (outside(input->block_bitmap, start, end)) 67 else if (outside(input->block_bitmap, start, end))
68 ext3_warning(sb, __FUNCTION__, 68 ext3_warning(sb, __func__,
69 "Block bitmap not in group (block %u)", 69 "Block bitmap not in group (block %u)",
70 input->block_bitmap); 70 input->block_bitmap);
71 else if (outside(input->inode_bitmap, start, end)) 71 else if (outside(input->inode_bitmap, start, end))
72 ext3_warning(sb, __FUNCTION__, 72 ext3_warning(sb, __func__,
73 "Inode bitmap not in group (block %u)", 73 "Inode bitmap not in group (block %u)",
74 input->inode_bitmap); 74 input->inode_bitmap);
75 else if (outside(input->inode_table, start, end) || 75 else if (outside(input->inode_table, start, end) ||
76 outside(itend - 1, start, end)) 76 outside(itend - 1, start, end))
77 ext3_warning(sb, __FUNCTION__, 77 ext3_warning(sb, __func__,
78 "Inode table not in group (blocks %u-"E3FSBLK")", 78 "Inode table not in group (blocks %u-"E3FSBLK")",
79 input->inode_table, itend - 1); 79 input->inode_table, itend - 1);
80 else if (input->inode_bitmap == input->block_bitmap) 80 else if (input->inode_bitmap == input->block_bitmap)
81 ext3_warning(sb, __FUNCTION__, 81 ext3_warning(sb, __func__,
82 "Block bitmap same as inode bitmap (%u)", 82 "Block bitmap same as inode bitmap (%u)",
83 input->block_bitmap); 83 input->block_bitmap);
84 else if (inside(input->block_bitmap, input->inode_table, itend)) 84 else if (inside(input->block_bitmap, input->inode_table, itend))
85 ext3_warning(sb, __FUNCTION__, 85 ext3_warning(sb, __func__,
86 "Block bitmap (%u) in inode table (%u-"E3FSBLK")", 86 "Block bitmap (%u) in inode table (%u-"E3FSBLK")",
87 input->block_bitmap, input->inode_table, itend-1); 87 input->block_bitmap, input->inode_table, itend-1);
88 else if (inside(input->inode_bitmap, input->inode_table, itend)) 88 else if (inside(input->inode_bitmap, input->inode_table, itend))
89 ext3_warning(sb, __FUNCTION__, 89 ext3_warning(sb, __func__,
90 "Inode bitmap (%u) in inode table (%u-"E3FSBLK")", 90 "Inode bitmap (%u) in inode table (%u-"E3FSBLK")",
91 input->inode_bitmap, input->inode_table, itend-1); 91 input->inode_bitmap, input->inode_table, itend-1);
92 else if (inside(input->block_bitmap, start, metaend)) 92 else if (inside(input->block_bitmap, start, metaend))
93 ext3_warning(sb, __FUNCTION__, 93 ext3_warning(sb, __func__,
94 "Block bitmap (%u) in GDT table" 94 "Block bitmap (%u) in GDT table"
95 " ("E3FSBLK"-"E3FSBLK")", 95 " ("E3FSBLK"-"E3FSBLK")",
96 input->block_bitmap, start, metaend - 1); 96 input->block_bitmap, start, metaend - 1);
97 else if (inside(input->inode_bitmap, start, metaend)) 97 else if (inside(input->inode_bitmap, start, metaend))
98 ext3_warning(sb, __FUNCTION__, 98 ext3_warning(sb, __func__,
99 "Inode bitmap (%u) in GDT table" 99 "Inode bitmap (%u) in GDT table"
100 " ("E3FSBLK"-"E3FSBLK")", 100 " ("E3FSBLK"-"E3FSBLK")",
101 input->inode_bitmap, start, metaend - 1); 101 input->inode_bitmap, start, metaend - 1);
102 else if (inside(input->inode_table, start, metaend) || 102 else if (inside(input->inode_table, start, metaend) ||
103 inside(itend - 1, start, metaend)) 103 inside(itend - 1, start, metaend))
104 ext3_warning(sb, __FUNCTION__, 104 ext3_warning(sb, __func__,
105 "Inode table (%u-"E3FSBLK") overlaps" 105 "Inode table (%u-"E3FSBLK") overlaps"
106 "GDT table ("E3FSBLK"-"E3FSBLK")", 106 "GDT table ("E3FSBLK"-"E3FSBLK")",
107 input->inode_table, itend - 1, start, metaend - 1); 107 input->inode_table, itend - 1, start, metaend - 1);
@@ -386,7 +386,7 @@ static int verify_reserved_gdb(struct super_block *sb,
386 386
387 while ((grp = ext3_list_backups(sb, &three, &five, &seven)) < end) { 387 while ((grp = ext3_list_backups(sb, &three, &five, &seven)) < end) {
388 if (le32_to_cpu(*p++) != grp * EXT3_BLOCKS_PER_GROUP(sb) + blk){ 388 if (le32_to_cpu(*p++) != grp * EXT3_BLOCKS_PER_GROUP(sb) + blk){
389 ext3_warning(sb, __FUNCTION__, 389 ext3_warning(sb, __func__,
390 "reserved GDT "E3FSBLK 390 "reserved GDT "E3FSBLK
391 " missing grp %d ("E3FSBLK")", 391 " missing grp %d ("E3FSBLK")",
392 blk, grp, 392 blk, grp,
@@ -440,7 +440,7 @@ static int add_new_gdb(handle_t *handle, struct inode *inode,
440 */ 440 */
441 if (EXT3_SB(sb)->s_sbh->b_blocknr != 441 if (EXT3_SB(sb)->s_sbh->b_blocknr !=
442 le32_to_cpu(EXT3_SB(sb)->s_es->s_first_data_block)) { 442 le32_to_cpu(EXT3_SB(sb)->s_es->s_first_data_block)) {
443 ext3_warning(sb, __FUNCTION__, 443 ext3_warning(sb, __func__,
444 "won't resize using backup superblock at %llu", 444 "won't resize using backup superblock at %llu",
445 (unsigned long long)EXT3_SB(sb)->s_sbh->b_blocknr); 445 (unsigned long long)EXT3_SB(sb)->s_sbh->b_blocknr);
446 return -EPERM; 446 return -EPERM;
@@ -464,7 +464,7 @@ static int add_new_gdb(handle_t *handle, struct inode *inode,
464 464
465 data = (__le32 *)dind->b_data; 465 data = (__le32 *)dind->b_data;
466 if (le32_to_cpu(data[gdb_num % EXT3_ADDR_PER_BLOCK(sb)]) != gdblock) { 466 if (le32_to_cpu(data[gdb_num % EXT3_ADDR_PER_BLOCK(sb)]) != gdblock) {
467 ext3_warning(sb, __FUNCTION__, 467 ext3_warning(sb, __func__,
468 "new group %u GDT block "E3FSBLK" not reserved", 468 "new group %u GDT block "E3FSBLK" not reserved",
469 input->group, gdblock); 469 input->group, gdblock);
470 err = -EINVAL; 470 err = -EINVAL;
@@ -488,7 +488,7 @@ static int add_new_gdb(handle_t *handle, struct inode *inode,
488 GFP_NOFS); 488 GFP_NOFS);
489 if (!n_group_desc) { 489 if (!n_group_desc) {
490 err = -ENOMEM; 490 err = -ENOMEM;
491 ext3_warning (sb, __FUNCTION__, 491 ext3_warning (sb, __func__,
492 "not enough memory for %lu groups", gdb_num + 1); 492 "not enough memory for %lu groups", gdb_num + 1);
493 goto exit_inode; 493 goto exit_inode;
494 } 494 }
@@ -586,7 +586,7 @@ static int reserve_backup_gdb(handle_t *handle, struct inode *inode,
586 /* Get each reserved primary GDT block and verify it holds backups */ 586 /* Get each reserved primary GDT block and verify it holds backups */
587 for (res = 0; res < reserved_gdb; res++, blk++) { 587 for (res = 0; res < reserved_gdb; res++, blk++) {
588 if (le32_to_cpu(*data) != blk) { 588 if (le32_to_cpu(*data) != blk) {
589 ext3_warning(sb, __FUNCTION__, 589 ext3_warning(sb, __func__,
590 "reserved block "E3FSBLK 590 "reserved block "E3FSBLK
591 " not at offset %ld", 591 " not at offset %ld",
592 blk, 592 blk,
@@ -730,7 +730,7 @@ static void update_backups(struct super_block *sb,
730 */ 730 */
731exit_err: 731exit_err:
732 if (err) { 732 if (err) {
733 ext3_warning(sb, __FUNCTION__, 733 ext3_warning(sb, __func__,
734 "can't update backup for group %d (err %d), " 734 "can't update backup for group %d (err %d), "
735 "forcing fsck on next reboot", group, err); 735 "forcing fsck on next reboot", group, err);
736 sbi->s_mount_state &= ~EXT3_VALID_FS; 736 sbi->s_mount_state &= ~EXT3_VALID_FS;
@@ -770,33 +770,33 @@ int ext3_group_add(struct super_block *sb, struct ext3_new_group_data *input)
770 770
771 if (gdb_off == 0 && !EXT3_HAS_RO_COMPAT_FEATURE(sb, 771 if (gdb_off == 0 && !EXT3_HAS_RO_COMPAT_FEATURE(sb,
772 EXT3_FEATURE_RO_COMPAT_SPARSE_SUPER)) { 772 EXT3_FEATURE_RO_COMPAT_SPARSE_SUPER)) {
773 ext3_warning(sb, __FUNCTION__, 773 ext3_warning(sb, __func__,
774 "Can't resize non-sparse filesystem further"); 774 "Can't resize non-sparse filesystem further");
775 return -EPERM; 775 return -EPERM;
776 } 776 }
777 777
778 if (le32_to_cpu(es->s_blocks_count) + input->blocks_count < 778 if (le32_to_cpu(es->s_blocks_count) + input->blocks_count <
779 le32_to_cpu(es->s_blocks_count)) { 779 le32_to_cpu(es->s_blocks_count)) {
780 ext3_warning(sb, __FUNCTION__, "blocks_count overflow\n"); 780 ext3_warning(sb, __func__, "blocks_count overflow\n");
781 return -EINVAL; 781 return -EINVAL;
782 } 782 }
783 783
784 if (le32_to_cpu(es->s_inodes_count) + EXT3_INODES_PER_GROUP(sb) < 784 if (le32_to_cpu(es->s_inodes_count) + EXT3_INODES_PER_GROUP(sb) <
785 le32_to_cpu(es->s_inodes_count)) { 785 le32_to_cpu(es->s_inodes_count)) {
786 ext3_warning(sb, __FUNCTION__, "inodes_count overflow\n"); 786 ext3_warning(sb, __func__, "inodes_count overflow\n");
787 return -EINVAL; 787 return -EINVAL;
788 } 788 }
789 789
790 if (reserved_gdb || gdb_off == 0) { 790 if (reserved_gdb || gdb_off == 0) {
791 if (!EXT3_HAS_COMPAT_FEATURE(sb, 791 if (!EXT3_HAS_COMPAT_FEATURE(sb,
792 EXT3_FEATURE_COMPAT_RESIZE_INODE)){ 792 EXT3_FEATURE_COMPAT_RESIZE_INODE)){
793 ext3_warning(sb, __FUNCTION__, 793 ext3_warning(sb, __func__,
794 "No reserved GDT blocks, can't resize"); 794 "No reserved GDT blocks, can't resize");
795 return -EPERM; 795 return -EPERM;
796 } 796 }
797 inode = ext3_iget(sb, EXT3_RESIZE_INO); 797 inode = ext3_iget(sb, EXT3_RESIZE_INO);
798 if (IS_ERR(inode)) { 798 if (IS_ERR(inode)) {
799 ext3_warning(sb, __FUNCTION__, 799 ext3_warning(sb, __func__,
800 "Error opening resize inode"); 800 "Error opening resize inode");
801 return PTR_ERR(inode); 801 return PTR_ERR(inode);
802 } 802 }
@@ -825,7 +825,7 @@ int ext3_group_add(struct super_block *sb, struct ext3_new_group_data *input)
825 825
826 lock_super(sb); 826 lock_super(sb);
827 if (input->group != sbi->s_groups_count) { 827 if (input->group != sbi->s_groups_count) {
828 ext3_warning(sb, __FUNCTION__, 828 ext3_warning(sb, __func__,
829 "multiple resizers run on filesystem!"); 829 "multiple resizers run on filesystem!");
830 err = -EBUSY; 830 err = -EBUSY;
831 goto exit_journal; 831 goto exit_journal;
@@ -988,13 +988,13 @@ int ext3_group_extend(struct super_block *sb, struct ext3_super_block *es,
988 " too large to resize to %lu blocks safely\n", 988 " too large to resize to %lu blocks safely\n",
989 sb->s_id, n_blocks_count); 989 sb->s_id, n_blocks_count);
990 if (sizeof(sector_t) < 8) 990 if (sizeof(sector_t) < 8)
991 ext3_warning(sb, __FUNCTION__, 991 ext3_warning(sb, __func__,
992 "CONFIG_LBD not enabled\n"); 992 "CONFIG_LBD not enabled\n");
993 return -EINVAL; 993 return -EINVAL;
994 } 994 }
995 995
996 if (n_blocks_count < o_blocks_count) { 996 if (n_blocks_count < o_blocks_count) {
997 ext3_warning(sb, __FUNCTION__, 997 ext3_warning(sb, __func__,
998 "can't shrink FS - resize aborted"); 998 "can't shrink FS - resize aborted");
999 return -EBUSY; 999 return -EBUSY;
1000 } 1000 }
@@ -1004,7 +1004,7 @@ int ext3_group_extend(struct super_block *sb, struct ext3_super_block *es,
1004 EXT3_BLOCKS_PER_GROUP(sb); 1004 EXT3_BLOCKS_PER_GROUP(sb);
1005 1005
1006 if (last == 0) { 1006 if (last == 0) {
1007 ext3_warning(sb, __FUNCTION__, 1007 ext3_warning(sb, __func__,
1008 "need to use ext2online to resize further"); 1008 "need to use ext2online to resize further");
1009 return -EPERM; 1009 return -EPERM;
1010 } 1010 }
@@ -1012,7 +1012,7 @@ int ext3_group_extend(struct super_block *sb, struct ext3_super_block *es,
1012 add = EXT3_BLOCKS_PER_GROUP(sb) - last; 1012 add = EXT3_BLOCKS_PER_GROUP(sb) - last;
1013 1013
1014 if (o_blocks_count + add < o_blocks_count) { 1014 if (o_blocks_count + add < o_blocks_count) {
1015 ext3_warning(sb, __FUNCTION__, "blocks_count overflow"); 1015 ext3_warning(sb, __func__, "blocks_count overflow");
1016 return -EINVAL; 1016 return -EINVAL;
1017 } 1017 }
1018 1018
@@ -1020,7 +1020,7 @@ int ext3_group_extend(struct super_block *sb, struct ext3_super_block *es,
1020 add = n_blocks_count - o_blocks_count; 1020 add = n_blocks_count - o_blocks_count;
1021 1021
1022 if (o_blocks_count + add < n_blocks_count) 1022 if (o_blocks_count + add < n_blocks_count)
1023 ext3_warning(sb, __FUNCTION__, 1023 ext3_warning(sb, __func__,
1024 "will only finish group ("E3FSBLK 1024 "will only finish group ("E3FSBLK
1025 " blocks, %u new)", 1025 " blocks, %u new)",
1026 o_blocks_count + add, add); 1026 o_blocks_count + add, add);
@@ -1028,7 +1028,7 @@ int ext3_group_extend(struct super_block *sb, struct ext3_super_block *es,
1028 /* See if the device is actually as big as what was requested */ 1028 /* See if the device is actually as big as what was requested */
1029 bh = sb_bread(sb, o_blocks_count + add -1); 1029 bh = sb_bread(sb, o_blocks_count + add -1);
1030 if (!bh) { 1030 if (!bh) {
1031 ext3_warning(sb, __FUNCTION__, 1031 ext3_warning(sb, __func__,
1032 "can't read last block, resize aborted"); 1032 "can't read last block, resize aborted");
1033 return -ENOSPC; 1033 return -ENOSPC;
1034 } 1034 }
@@ -1040,22 +1040,23 @@ int ext3_group_extend(struct super_block *sb, struct ext3_super_block *es,
1040 handle = ext3_journal_start_sb(sb, 3); 1040 handle = ext3_journal_start_sb(sb, 3);
1041 if (IS_ERR(handle)) { 1041 if (IS_ERR(handle)) {
1042 err = PTR_ERR(handle); 1042 err = PTR_ERR(handle);
1043 ext3_warning(sb, __FUNCTION__, "error %d on journal start",err); 1043 ext3_warning(sb, __func__, "error %d on journal start",err);
1044 goto exit_put; 1044 goto exit_put;
1045 } 1045 }
1046 1046
1047 lock_super(sb); 1047 lock_super(sb);
1048 if (o_blocks_count != le32_to_cpu(es->s_blocks_count)) { 1048 if (o_blocks_count != le32_to_cpu(es->s_blocks_count)) {
1049 ext3_warning(sb, __FUNCTION__, 1049 ext3_warning(sb, __func__,
1050 "multiple resizers run on filesystem!"); 1050 "multiple resizers run on filesystem!");
1051 unlock_super(sb); 1051 unlock_super(sb);
1052 ext3_journal_stop(handle);
1052 err = -EBUSY; 1053 err = -EBUSY;
1053 goto exit_put; 1054 goto exit_put;
1054 } 1055 }
1055 1056
1056 if ((err = ext3_journal_get_write_access(handle, 1057 if ((err = ext3_journal_get_write_access(handle,
1057 EXT3_SB(sb)->s_sbh))) { 1058 EXT3_SB(sb)->s_sbh))) {
1058 ext3_warning(sb, __FUNCTION__, 1059 ext3_warning(sb, __func__,
1059 "error %d on journal write access", err); 1060 "error %d on journal write access", err);
1060 unlock_super(sb); 1061 unlock_super(sb);
1061 ext3_journal_stop(handle); 1062 ext3_journal_stop(handle);
diff --git a/fs/ext3/super.c b/fs/ext3/super.c
index ad5360664082..fe3119a71ada 100644
--- a/fs/ext3/super.c
+++ b/fs/ext3/super.c
@@ -84,7 +84,7 @@ handle_t *ext3_journal_start_sb(struct super_block *sb, int nblocks)
84 * take the FS itself readonly cleanly. */ 84 * take the FS itself readonly cleanly. */
85 journal = EXT3_SB(sb)->s_journal; 85 journal = EXT3_SB(sb)->s_journal;
86 if (is_journal_aborted(journal)) { 86 if (is_journal_aborted(journal)) {
87 ext3_abort(sb, __FUNCTION__, 87 ext3_abort(sb, __func__,
88 "Detected aborted journal"); 88 "Detected aborted journal");
89 return ERR_PTR(-EROFS); 89 return ERR_PTR(-EROFS);
90 } 90 }
@@ -304,7 +304,7 @@ void ext3_update_dynamic_rev(struct super_block *sb)
304 if (le32_to_cpu(es->s_rev_level) > EXT3_GOOD_OLD_REV) 304 if (le32_to_cpu(es->s_rev_level) > EXT3_GOOD_OLD_REV)
305 return; 305 return;
306 306
307 ext3_warning(sb, __FUNCTION__, 307 ext3_warning(sb, __func__,
308 "updating to rev %d because of new feature flag, " 308 "updating to rev %d because of new feature flag, "
309 "running e2fsck is recommended", 309 "running e2fsck is recommended",
310 EXT3_DYNAMIC_REV); 310 EXT3_DYNAMIC_REV);
@@ -685,7 +685,8 @@ static int ext3_acquire_dquot(struct dquot *dquot);
685static int ext3_release_dquot(struct dquot *dquot); 685static int ext3_release_dquot(struct dquot *dquot);
686static int ext3_mark_dquot_dirty(struct dquot *dquot); 686static int ext3_mark_dquot_dirty(struct dquot *dquot);
687static int ext3_write_info(struct super_block *sb, int type); 687static int ext3_write_info(struct super_block *sb, int type);
688static int ext3_quota_on(struct super_block *sb, int type, int format_id, char *path); 688static int ext3_quota_on(struct super_block *sb, int type, int format_id,
689 char *path, int remount);
689static int ext3_quota_on_mount(struct super_block *sb, int type); 690static int ext3_quota_on_mount(struct super_block *sb, int type);
690static ssize_t ext3_quota_read(struct super_block *sb, int type, char *data, 691static ssize_t ext3_quota_read(struct super_block *sb, int type, char *data,
691 size_t len, loff_t off); 692 size_t len, loff_t off);
@@ -1096,6 +1097,9 @@ clear_qf_name:
1096 case Opt_quota: 1097 case Opt_quota:
1097 case Opt_usrquota: 1098 case Opt_usrquota:
1098 case Opt_grpquota: 1099 case Opt_grpquota:
1100 printk(KERN_ERR
1101 "EXT3-fs: quota options not supported.\n");
1102 break;
1099 case Opt_usrjquota: 1103 case Opt_usrjquota:
1100 case Opt_grpjquota: 1104 case Opt_grpjquota:
1101 case Opt_offusrjquota: 1105 case Opt_offusrjquota:
@@ -1103,7 +1107,7 @@ clear_qf_name:
1103 case Opt_jqfmt_vfsold: 1107 case Opt_jqfmt_vfsold:
1104 case Opt_jqfmt_vfsv0: 1108 case Opt_jqfmt_vfsv0:
1105 printk(KERN_ERR 1109 printk(KERN_ERR
1106 "EXT3-fs: journalled quota options not " 1110 "EXT3-fs: journaled quota options not "
1107 "supported.\n"); 1111 "supported.\n");
1108 break; 1112 break;
1109 case Opt_noquota: 1113 case Opt_noquota:
@@ -1218,7 +1222,7 @@ static int ext3_setup_super(struct super_block *sb, struct ext3_super_block *es,
1218 inconsistencies, to force a fsck at reboot. But for 1222 inconsistencies, to force a fsck at reboot. But for
1219 a plain journaled filesystem we can keep it set as 1223 a plain journaled filesystem we can keep it set as
1220 valid forever! :) */ 1224 valid forever! :) */
1221 es->s_state = cpu_to_le16(le16_to_cpu(es->s_state) & ~EXT3_VALID_FS); 1225 es->s_state &= cpu_to_le16(~EXT3_VALID_FS);
1222#endif 1226#endif
1223 if (!(__s16) le16_to_cpu(es->s_max_mnt_count)) 1227 if (!(__s16) le16_to_cpu(es->s_max_mnt_count))
1224 es->s_max_mnt_count = cpu_to_le16(EXT3_DFL_MAX_MNT_COUNT); 1228 es->s_max_mnt_count = cpu_to_le16(EXT3_DFL_MAX_MNT_COUNT);
@@ -1253,14 +1257,14 @@ static int ext3_setup_super(struct super_block *sb, struct ext3_super_block *es,
1253static int ext3_check_descriptors(struct super_block *sb) 1257static int ext3_check_descriptors(struct super_block *sb)
1254{ 1258{
1255 struct ext3_sb_info *sbi = EXT3_SB(sb); 1259 struct ext3_sb_info *sbi = EXT3_SB(sb);
1256 ext3_fsblk_t first_block = le32_to_cpu(sbi->s_es->s_first_data_block);
1257 ext3_fsblk_t last_block;
1258 int i; 1260 int i;
1259 1261
1260 ext3_debug ("Checking group descriptors"); 1262 ext3_debug ("Checking group descriptors");
1261 1263
1262 for (i = 0; i < sbi->s_groups_count; i++) { 1264 for (i = 0; i < sbi->s_groups_count; i++) {
1263 struct ext3_group_desc *gdp = ext3_get_group_desc(sb, i, NULL); 1265 struct ext3_group_desc *gdp = ext3_get_group_desc(sb, i, NULL);
1266 ext3_fsblk_t first_block = ext3_group_first_block_no(sb, i);
1267 ext3_fsblk_t last_block;
1264 1268
1265 if (i == sbi->s_groups_count - 1) 1269 if (i == sbi->s_groups_count - 1)
1266 last_block = le32_to_cpu(sbi->s_es->s_blocks_count) - 1; 1270 last_block = le32_to_cpu(sbi->s_es->s_blocks_count) - 1;
@@ -1299,7 +1303,6 @@ static int ext3_check_descriptors(struct super_block *sb)
1299 le32_to_cpu(gdp->bg_inode_table)); 1303 le32_to_cpu(gdp->bg_inode_table));
1300 return 0; 1304 return 0;
1301 } 1305 }
1302 first_block += EXT3_BLOCKS_PER_GROUP(sb);
1303 } 1306 }
1304 1307
1305 sbi->s_es->s_free_blocks_count=cpu_to_le32(ext3_count_free_blocks(sb)); 1308 sbi->s_es->s_free_blocks_count=cpu_to_le32(ext3_count_free_blocks(sb));
@@ -1387,7 +1390,7 @@ static void ext3_orphan_cleanup (struct super_block * sb,
1387 if (inode->i_nlink) { 1390 if (inode->i_nlink) {
1388 printk(KERN_DEBUG 1391 printk(KERN_DEBUG
1389 "%s: truncating inode %lu to %Ld bytes\n", 1392 "%s: truncating inode %lu to %Ld bytes\n",
1390 __FUNCTION__, inode->i_ino, inode->i_size); 1393 __func__, inode->i_ino, inode->i_size);
1391 jbd_debug(2, "truncating inode %lu to %Ld bytes\n", 1394 jbd_debug(2, "truncating inode %lu to %Ld bytes\n",
1392 inode->i_ino, inode->i_size); 1395 inode->i_ino, inode->i_size);
1393 ext3_truncate(inode); 1396 ext3_truncate(inode);
@@ -1395,7 +1398,7 @@ static void ext3_orphan_cleanup (struct super_block * sb,
1395 } else { 1398 } else {
1396 printk(KERN_DEBUG 1399 printk(KERN_DEBUG
1397 "%s: deleting unreferenced inode %lu\n", 1400 "%s: deleting unreferenced inode %lu\n",
1398 __FUNCTION__, inode->i_ino); 1401 __func__, inode->i_ino);
1399 jbd_debug(2, "deleting unreferenced inode %lu\n", 1402 jbd_debug(2, "deleting unreferenced inode %lu\n",
1400 inode->i_ino); 1403 inode->i_ino);
1401 nr_orphans++; 1404 nr_orphans++;
@@ -1415,7 +1418,7 @@ static void ext3_orphan_cleanup (struct super_block * sb,
1415 /* Turn quotas off */ 1418 /* Turn quotas off */
1416 for (i = 0; i < MAXQUOTAS; i++) { 1419 for (i = 0; i < MAXQUOTAS; i++) {
1417 if (sb_dqopt(sb)->files[i]) 1420 if (sb_dqopt(sb)->files[i])
1418 vfs_quota_off(sb, i); 1421 vfs_quota_off(sb, i, 0);
1419 } 1422 }
1420#endif 1423#endif
1421 sb->s_flags = s_flags; /* Restore MS_RDONLY status */ 1424 sb->s_flags = s_flags; /* Restore MS_RDONLY status */
@@ -2298,9 +2301,9 @@ static void ext3_clear_journal_err(struct super_block * sb,
2298 char nbuf[16]; 2301 char nbuf[16];
2299 2302
2300 errstr = ext3_decode_error(sb, j_errno, nbuf); 2303 errstr = ext3_decode_error(sb, j_errno, nbuf);
2301 ext3_warning(sb, __FUNCTION__, "Filesystem error recorded " 2304 ext3_warning(sb, __func__, "Filesystem error recorded "
2302 "from previous mount: %s", errstr); 2305 "from previous mount: %s", errstr);
2303 ext3_warning(sb, __FUNCTION__, "Marking fs in need of " 2306 ext3_warning(sb, __func__, "Marking fs in need of "
2304 "filesystem check."); 2307 "filesystem check.");
2305 2308
2306 EXT3_SB(sb)->s_mount_state |= EXT3_ERROR_FS; 2309 EXT3_SB(sb)->s_mount_state |= EXT3_ERROR_FS;
@@ -2427,7 +2430,7 @@ static int ext3_remount (struct super_block * sb, int * flags, char * data)
2427 } 2430 }
2428 2431
2429 if (sbi->s_mount_opt & EXT3_MOUNT_ABORT) 2432 if (sbi->s_mount_opt & EXT3_MOUNT_ABORT)
2430 ext3_abort(sb, __FUNCTION__, "Abort forced by user"); 2433 ext3_abort(sb, __func__, "Abort forced by user");
2431 2434
2432 sb->s_flags = (sb->s_flags & ~MS_POSIXACL) | 2435 sb->s_flags = (sb->s_flags & ~MS_POSIXACL) |
2433 ((sbi->s_mount_opt & EXT3_MOUNT_POSIX_ACL) ? MS_POSIXACL : 0); 2436 ((sbi->s_mount_opt & EXT3_MOUNT_POSIX_ACL) ? MS_POSIXACL : 0);
@@ -2639,8 +2642,14 @@ static int ext3_dquot_drop(struct inode *inode)
2639 2642
2640 /* We may delete quota structure so we need to reserve enough blocks */ 2643 /* We may delete quota structure so we need to reserve enough blocks */
2641 handle = ext3_journal_start(inode, 2*EXT3_QUOTA_DEL_BLOCKS(inode->i_sb)); 2644 handle = ext3_journal_start(inode, 2*EXT3_QUOTA_DEL_BLOCKS(inode->i_sb));
2642 if (IS_ERR(handle)) 2645 if (IS_ERR(handle)) {
2646 /*
2647 * We call dquot_drop() anyway to at least release references
2648 * to quota structures so that umount does not hang.
2649 */
2650 dquot_drop(inode);
2643 return PTR_ERR(handle); 2651 return PTR_ERR(handle);
2652 }
2644 ret = dquot_drop(inode); 2653 ret = dquot_drop(inode);
2645 err = ext3_journal_stop(handle); 2654 err = ext3_journal_stop(handle);
2646 if (!ret) 2655 if (!ret)
@@ -2743,17 +2752,17 @@ static int ext3_quota_on_mount(struct super_block *sb, int type)
2743 * Standard function to be called on quota_on 2752 * Standard function to be called on quota_on
2744 */ 2753 */
2745static int ext3_quota_on(struct super_block *sb, int type, int format_id, 2754static int ext3_quota_on(struct super_block *sb, int type, int format_id,
2746 char *path) 2755 char *path, int remount)
2747{ 2756{
2748 int err; 2757 int err;
2749 struct nameidata nd; 2758 struct nameidata nd;
2750 2759
2751 if (!test_opt(sb, QUOTA)) 2760 if (!test_opt(sb, QUOTA))
2752 return -EINVAL; 2761 return -EINVAL;
2753 /* Not journalling quota? */ 2762 /* Not journalling quota or remount? */
2754 if (!EXT3_SB(sb)->s_qf_names[USRQUOTA] && 2763 if ((!EXT3_SB(sb)->s_qf_names[USRQUOTA] &&
2755 !EXT3_SB(sb)->s_qf_names[GRPQUOTA]) 2764 !EXT3_SB(sb)->s_qf_names[GRPQUOTA]) || remount)
2756 return vfs_quota_on(sb, type, format_id, path); 2765 return vfs_quota_on(sb, type, format_id, path, remount);
2757 err = path_lookup(path, LOOKUP_FOLLOW, &nd); 2766 err = path_lookup(path, LOOKUP_FOLLOW, &nd);
2758 if (err) 2767 if (err)
2759 return err; 2768 return err;
@@ -2762,13 +2771,13 @@ static int ext3_quota_on(struct super_block *sb, int type, int format_id,
2762 path_put(&nd.path); 2771 path_put(&nd.path);
2763 return -EXDEV; 2772 return -EXDEV;
2764 } 2773 }
2765 /* Quotafile not of fs root? */ 2774 /* Quotafile not in fs root? */
2766 if (nd.path.dentry->d_parent->d_inode != sb->s_root->d_inode) 2775 if (nd.path.dentry->d_parent->d_inode != sb->s_root->d_inode)
2767 printk(KERN_WARNING 2776 printk(KERN_WARNING
2768 "EXT3-fs: Quota file not on filesystem root. " 2777 "EXT3-fs: Quota file not on filesystem root. "
2769 "Journalled quota will not work.\n"); 2778 "Journalled quota will not work.\n");
2770 path_put(&nd.path); 2779 path_put(&nd.path);
2771 return vfs_quota_on(sb, type, format_id, path); 2780 return vfs_quota_on(sb, type, format_id, path, remount);
2772} 2781}
2773 2782
2774/* Read data from quotafile - avoid pagecache and such because we cannot afford 2783/* Read data from quotafile - avoid pagecache and such because we cannot afford
diff --git a/fs/ext3/xattr.c b/fs/ext3/xattr.c
index 42856541e9a5..d4a4f0e9ff69 100644
--- a/fs/ext3/xattr.c
+++ b/fs/ext3/xattr.c
@@ -99,6 +99,8 @@ static struct buffer_head *ext3_xattr_cache_find(struct inode *,
99 struct mb_cache_entry **); 99 struct mb_cache_entry **);
100static void ext3_xattr_rehash(struct ext3_xattr_header *, 100static void ext3_xattr_rehash(struct ext3_xattr_header *,
101 struct ext3_xattr_entry *); 101 struct ext3_xattr_entry *);
102static int ext3_xattr_list(struct inode *inode, char *buffer,
103 size_t buffer_size);
102 104
103static struct mb_cache *ext3_xattr_cache; 105static struct mb_cache *ext3_xattr_cache;
104 106
@@ -232,7 +234,7 @@ ext3_xattr_block_get(struct inode *inode, int name_index, const char *name,
232 ea_bdebug(bh, "b_count=%d, refcount=%d", 234 ea_bdebug(bh, "b_count=%d, refcount=%d",
233 atomic_read(&(bh->b_count)), le32_to_cpu(BHDR(bh)->h_refcount)); 235 atomic_read(&(bh->b_count)), le32_to_cpu(BHDR(bh)->h_refcount));
234 if (ext3_xattr_check_block(bh)) { 236 if (ext3_xattr_check_block(bh)) {
235bad_block: ext3_error(inode->i_sb, __FUNCTION__, 237bad_block: ext3_error(inode->i_sb, __func__,
236 "inode %lu: bad block "E3FSBLK, inode->i_ino, 238 "inode %lu: bad block "E3FSBLK, inode->i_ino,
237 EXT3_I(inode)->i_file_acl); 239 EXT3_I(inode)->i_file_acl);
238 error = -EIO; 240 error = -EIO;
@@ -374,7 +376,7 @@ ext3_xattr_block_list(struct inode *inode, char *buffer, size_t buffer_size)
374 ea_bdebug(bh, "b_count=%d, refcount=%d", 376 ea_bdebug(bh, "b_count=%d, refcount=%d",
375 atomic_read(&(bh->b_count)), le32_to_cpu(BHDR(bh)->h_refcount)); 377 atomic_read(&(bh->b_count)), le32_to_cpu(BHDR(bh)->h_refcount));
376 if (ext3_xattr_check_block(bh)) { 378 if (ext3_xattr_check_block(bh)) {
377 ext3_error(inode->i_sb, __FUNCTION__, 379 ext3_error(inode->i_sb, __func__,
378 "inode %lu: bad block "E3FSBLK, inode->i_ino, 380 "inode %lu: bad block "E3FSBLK, inode->i_ino,
379 EXT3_I(inode)->i_file_acl); 381 EXT3_I(inode)->i_file_acl);
380 error = -EIO; 382 error = -EIO;
@@ -427,7 +429,7 @@ cleanup:
427 * Returns a negative error number on failure, or the number of bytes 429 * Returns a negative error number on failure, or the number of bytes
428 * used / required on success. 430 * used / required on success.
429 */ 431 */
430int 432static int
431ext3_xattr_list(struct inode *inode, char *buffer, size_t buffer_size) 433ext3_xattr_list(struct inode *inode, char *buffer, size_t buffer_size)
432{ 434{
433 int i_error, b_error; 435 int i_error, b_error;
@@ -649,7 +651,7 @@ ext3_xattr_block_find(struct inode *inode, struct ext3_xattr_info *i,
649 atomic_read(&(bs->bh->b_count)), 651 atomic_read(&(bs->bh->b_count)),
650 le32_to_cpu(BHDR(bs->bh)->h_refcount)); 652 le32_to_cpu(BHDR(bs->bh)->h_refcount));
651 if (ext3_xattr_check_block(bs->bh)) { 653 if (ext3_xattr_check_block(bs->bh)) {
652 ext3_error(sb, __FUNCTION__, 654 ext3_error(sb, __func__,
653 "inode %lu: bad block "E3FSBLK, inode->i_ino, 655 "inode %lu: bad block "E3FSBLK, inode->i_ino,
654 EXT3_I(inode)->i_file_acl); 656 EXT3_I(inode)->i_file_acl);
655 error = -EIO; 657 error = -EIO;
@@ -797,10 +799,8 @@ inserted:
797 get_bh(new_bh); 799 get_bh(new_bh);
798 } else { 800 } else {
799 /* We need to allocate a new block */ 801 /* We need to allocate a new block */
800 ext3_fsblk_t goal = le32_to_cpu( 802 ext3_fsblk_t goal = ext3_group_first_block_no(sb,
801 EXT3_SB(sb)->s_es->s_first_data_block) + 803 EXT3_I(inode)->i_block_group);
802 (ext3_fsblk_t)EXT3_I(inode)->i_block_group *
803 EXT3_BLOCKS_PER_GROUP(sb);
804 ext3_fsblk_t block = ext3_new_block(handle, inode, 804 ext3_fsblk_t block = ext3_new_block(handle, inode,
805 goal, &error); 805 goal, &error);
806 if (error) 806 if (error)
@@ -852,7 +852,7 @@ cleanup_dquot:
852 goto cleanup; 852 goto cleanup;
853 853
854bad_block: 854bad_block:
855 ext3_error(inode->i_sb, __FUNCTION__, 855 ext3_error(inode->i_sb, __func__,
856 "inode %lu: bad block "E3FSBLK, inode->i_ino, 856 "inode %lu: bad block "E3FSBLK, inode->i_ino,
857 EXT3_I(inode)->i_file_acl); 857 EXT3_I(inode)->i_file_acl);
858 goto cleanup; 858 goto cleanup;
@@ -1081,14 +1081,14 @@ ext3_xattr_delete_inode(handle_t *handle, struct inode *inode)
1081 goto cleanup; 1081 goto cleanup;
1082 bh = sb_bread(inode->i_sb, EXT3_I(inode)->i_file_acl); 1082 bh = sb_bread(inode->i_sb, EXT3_I(inode)->i_file_acl);
1083 if (!bh) { 1083 if (!bh) {
1084 ext3_error(inode->i_sb, __FUNCTION__, 1084 ext3_error(inode->i_sb, __func__,
1085 "inode %lu: block "E3FSBLK" read error", inode->i_ino, 1085 "inode %lu: block "E3FSBLK" read error", inode->i_ino,
1086 EXT3_I(inode)->i_file_acl); 1086 EXT3_I(inode)->i_file_acl);
1087 goto cleanup; 1087 goto cleanup;
1088 } 1088 }
1089 if (BHDR(bh)->h_magic != cpu_to_le32(EXT3_XATTR_MAGIC) || 1089 if (BHDR(bh)->h_magic != cpu_to_le32(EXT3_XATTR_MAGIC) ||
1090 BHDR(bh)->h_blocks != cpu_to_le32(1)) { 1090 BHDR(bh)->h_blocks != cpu_to_le32(1)) {
1091 ext3_error(inode->i_sb, __FUNCTION__, 1091 ext3_error(inode->i_sb, __func__,
1092 "inode %lu: bad block "E3FSBLK, inode->i_ino, 1092 "inode %lu: bad block "E3FSBLK, inode->i_ino,
1093 EXT3_I(inode)->i_file_acl); 1093 EXT3_I(inode)->i_file_acl);
1094 goto cleanup; 1094 goto cleanup;
@@ -1215,7 +1215,7 @@ again:
1215 } 1215 }
1216 bh = sb_bread(inode->i_sb, ce->e_block); 1216 bh = sb_bread(inode->i_sb, ce->e_block);
1217 if (!bh) { 1217 if (!bh) {
1218 ext3_error(inode->i_sb, __FUNCTION__, 1218 ext3_error(inode->i_sb, __func__,
1219 "inode %lu: block %lu read error", 1219 "inode %lu: block %lu read error",
1220 inode->i_ino, (unsigned long) ce->e_block); 1220 inode->i_ino, (unsigned long) ce->e_block);
1221 } else if (le32_to_cpu(BHDR(bh)->h_refcount) >= 1221 } else if (le32_to_cpu(BHDR(bh)->h_refcount) >=
diff --git a/fs/ext3/xattr.h b/fs/ext3/xattr.h
index 6b1ae1c6182c..148a4dfc82ab 100644
--- a/fs/ext3/xattr.h
+++ b/fs/ext3/xattr.h
@@ -67,7 +67,6 @@ extern struct xattr_handler ext3_xattr_security_handler;
67extern ssize_t ext3_listxattr(struct dentry *, char *, size_t); 67extern ssize_t ext3_listxattr(struct dentry *, char *, size_t);
68 68
69extern int ext3_xattr_get(struct inode *, int, const char *, void *, size_t); 69extern int ext3_xattr_get(struct inode *, int, const char *, void *, size_t);
70extern int ext3_xattr_list(struct inode *, char *, size_t);
71extern int ext3_xattr_set(struct inode *, int, const char *, const void *, size_t, int); 70extern int ext3_xattr_set(struct inode *, int, const char *, const void *, size_t, int);
72extern int ext3_xattr_set_handle(handle_t *, struct inode *, int, const char *, const void *, size_t, int); 71extern int ext3_xattr_set_handle(handle_t *, struct inode *, int, const char *, const void *, size_t, int);
73 72
@@ -89,12 +88,6 @@ ext3_xattr_get(struct inode *inode, int name_index, const char *name,
89} 88}
90 89
91static inline int 90static inline int
92ext3_xattr_list(struct inode *inode, void *buffer, size_t size)
93{
94 return -EOPNOTSUPP;
95}
96
97static inline int
98ext3_xattr_set(struct inode *inode, int name_index, const char *name, 91ext3_xattr_set(struct inode *inode, int name_index, const char *name,
99 const void *value, size_t size, int flags) 92 const void *value, size_t size, int flags)
100{ 93{