aboutsummaryrefslogtreecommitdiffstats
path: root/fs/ext3
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2011-03-17 20:41:19 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2011-03-17 20:41:19 -0400
commit77aa56ba09b7416764aec2e3f7b41e023cf30602 (patch)
treed4247c8ee6b7371e60dcadaf1540c943ed7a9801 /fs/ext3
parent179198373cf374f0ef793f1023c1cdd83b53674d (diff)
parent0c755de03e69619c768867d89e6d827d3afa13d9 (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: ext3: Always set dx_node's fake_dirent explicitly. ext3: Fix an overflow in ext3_trim_fs. jbd: Remove one to many n's in a word. ext3: skip orphan cleanup on rocompat fs ext2: Fix link count corruption under heavy link+rename load ext3: speed up group trim with the right free block count. ext3: Adjust trim start with first_data_block. quota: return -ENOMEM when memory allocation fails
Diffstat (limited to 'fs/ext3')
-rw-r--r--fs/ext3/balloc.c21
-rw-r--r--fs/ext3/namei.c2
-rw-r--r--fs/ext3/super.c7
3 files changed, 20 insertions, 10 deletions
diff --git a/fs/ext3/balloc.c b/fs/ext3/balloc.c
index 045995c8ce5a..153242187fce 100644
--- a/fs/ext3/balloc.c
+++ b/fs/ext3/balloc.c
@@ -1991,6 +1991,7 @@ ext3_grpblk_t ext3_trim_all_free(struct super_block *sb, unsigned int group,
1991 spin_unlock(sb_bgl_lock(sbi, group)); 1991 spin_unlock(sb_bgl_lock(sbi, group));
1992 percpu_counter_sub(&sbi->s_freeblocks_counter, next - start); 1992 percpu_counter_sub(&sbi->s_freeblocks_counter, next - start);
1993 1993
1994 free_blocks -= next - start;
1994 /* Do not issue a TRIM on extents smaller than minblocks */ 1995 /* Do not issue a TRIM on extents smaller than minblocks */
1995 if ((next - start) < minblocks) 1996 if ((next - start) < minblocks)
1996 goto free_extent; 1997 goto free_extent;
@@ -2040,7 +2041,7 @@ free_extent:
2040 cond_resched(); 2041 cond_resched();
2041 2042
2042 /* No more suitable extents */ 2043 /* No more suitable extents */
2043 if ((free_blocks - count) < minblocks) 2044 if (free_blocks < minblocks)
2044 break; 2045 break;
2045 } 2046 }
2046 2047
@@ -2090,7 +2091,8 @@ int ext3_trim_fs(struct super_block *sb, struct fstrim_range *range)
2090 ext3_fsblk_t max_blks = le32_to_cpu(es->s_blocks_count); 2091 ext3_fsblk_t max_blks = le32_to_cpu(es->s_blocks_count);
2091 int ret = 0; 2092 int ret = 0;
2092 2093
2093 start = range->start >> sb->s_blocksize_bits; 2094 start = (range->start >> sb->s_blocksize_bits) +
2095 le32_to_cpu(es->s_first_data_block);
2094 len = range->len >> sb->s_blocksize_bits; 2096 len = range->len >> sb->s_blocksize_bits;
2095 minlen = range->minlen >> sb->s_blocksize_bits; 2097 minlen = range->minlen >> sb->s_blocksize_bits;
2096 trimmed = 0; 2098 trimmed = 0;
@@ -2099,10 +2101,6 @@ int ext3_trim_fs(struct super_block *sb, struct fstrim_range *range)
2099 return -EINVAL; 2101 return -EINVAL;
2100 if (start >= max_blks) 2102 if (start >= max_blks)
2101 goto out; 2103 goto out;
2102 if (start < le32_to_cpu(es->s_first_data_block)) {
2103 len -= le32_to_cpu(es->s_first_data_block) - start;
2104 start = le32_to_cpu(es->s_first_data_block);
2105 }
2106 if (start + len > max_blks) 2104 if (start + len > max_blks)
2107 len = max_blks - start; 2105 len = max_blks - start;
2108 2106
@@ -2129,10 +2127,15 @@ int ext3_trim_fs(struct super_block *sb, struct fstrim_range *range)
2129 if (free_blocks < minlen) 2127 if (free_blocks < minlen)
2130 continue; 2128 continue;
2131 2129
2132 if (len >= EXT3_BLOCKS_PER_GROUP(sb)) 2130 /*
2133 len -= (EXT3_BLOCKS_PER_GROUP(sb) - first_block); 2131 * For all the groups except the last one, last block will
2134 else 2132 * always be EXT3_BLOCKS_PER_GROUP(sb), so we only need to
2133 * change it for the last group in which case first_block +
2134 * len < EXT3_BLOCKS_PER_GROUP(sb).
2135 */
2136 if (first_block + len < EXT3_BLOCKS_PER_GROUP(sb))
2135 last_block = first_block + len; 2137 last_block = first_block + len;
2138 len -= last_block - first_block;
2136 2139
2137 ret = ext3_trim_all_free(sb, group, first_block, 2140 ret = ext3_trim_all_free(sb, group, first_block,
2138 last_block, minlen); 2141 last_block, minlen);
diff --git a/fs/ext3/namei.c b/fs/ext3/namei.c
index 0521a007ae6d..32f3b8695859 100644
--- a/fs/ext3/namei.c
+++ b/fs/ext3/namei.c
@@ -1540,8 +1540,8 @@ static int ext3_dx_add_entry(handle_t *handle, struct dentry *dentry,
1540 goto cleanup; 1540 goto cleanup;
1541 node2 = (struct dx_node *)(bh2->b_data); 1541 node2 = (struct dx_node *)(bh2->b_data);
1542 entries2 = node2->entries; 1542 entries2 = node2->entries;
1543 memset(&node2->fake, 0, sizeof(struct fake_dirent));
1543 node2->fake.rec_len = ext3_rec_len_to_disk(sb->s_blocksize); 1544 node2->fake.rec_len = ext3_rec_len_to_disk(sb->s_blocksize);
1544 node2->fake.inode = 0;
1545 BUFFER_TRACE(frame->bh, "get_write_access"); 1545 BUFFER_TRACE(frame->bh, "get_write_access");
1546 err = ext3_journal_get_write_access(handle, frame->bh); 1546 err = ext3_journal_get_write_access(handle, frame->bh);
1547 if (err) 1547 if (err)
diff --git a/fs/ext3/super.c b/fs/ext3/super.c
index 9cc19a1dea8e..071689f86e18 100644
--- a/fs/ext3/super.c
+++ b/fs/ext3/super.c
@@ -1464,6 +1464,13 @@ static void ext3_orphan_cleanup (struct super_block * sb,
1464 return; 1464 return;
1465 } 1465 }
1466 1466
1467 /* Check if feature set allows readwrite operations */
1468 if (EXT3_HAS_RO_COMPAT_FEATURE(sb, ~EXT3_FEATURE_RO_COMPAT_SUPP)) {
1469 ext3_msg(sb, KERN_INFO, "Skipping orphan cleanup due to "
1470 "unknown ROCOMPAT features");
1471 return;
1472 }
1473
1467 if (EXT3_SB(sb)->s_mount_state & EXT3_ERROR_FS) { 1474 if (EXT3_SB(sb)->s_mount_state & EXT3_ERROR_FS) {
1468 if (es->s_last_orphan) 1475 if (es->s_last_orphan)
1469 jbd_debug(1, "Errors on filesystem, " 1476 jbd_debug(1, "Errors on filesystem, "