aboutsummaryrefslogtreecommitdiffstats
path: root/fs/ext4/ialloc.c
diff options
context:
space:
mode:
Diffstat (limited to 'fs/ext4/ialloc.c')
-rw-r--r--fs/ext4/ialloc.c24
1 files changed, 16 insertions, 8 deletions
diff --git a/fs/ext4/ialloc.c b/fs/ext4/ialloc.c
index da18a74b966a..486e46a3918d 100644
--- a/fs/ext4/ialloc.c
+++ b/fs/ext4/ialloc.c
@@ -305,7 +305,7 @@ static int find_group_dir(struct super_block *sb, struct inode *parent,
305 * it has too few free inodes left (min_inodes) or 305 * it has too few free inodes left (min_inodes) or
306 * it has too few free blocks left (min_blocks) or 306 * it has too few free blocks left (min_blocks) or
307 * it's already running too large debt (max_debt). 307 * it's already running too large debt (max_debt).
308 * Parent's group is prefered, if it doesn't satisfy these 308 * Parent's group is preferred, if it doesn't satisfy these
309 * conditions we search cyclically through the rest. If none 309 * conditions we search cyclically through the rest. If none
310 * of the groups look good we just look for a group with more 310 * of the groups look good we just look for a group with more
311 * free inodes than average (starting at parent's group). 311 * free inodes than average (starting at parent's group).
@@ -702,7 +702,12 @@ got:
702 ei->i_dir_start_lookup = 0; 702 ei->i_dir_start_lookup = 0;
703 ei->i_disksize = 0; 703 ei->i_disksize = 0;
704 704
705 ei->i_flags = EXT4_I(dir)->i_flags & ~EXT4_INDEX_FL; 705 /*
706 * Don't inherit extent flag from directory. We set extent flag on
707 * newly created directory and file only if -o extent mount option is
708 * specified
709 */
710 ei->i_flags = EXT4_I(dir)->i_flags & ~(EXT4_INDEX_FL|EXT4_EXTENTS_FL);
706 if (S_ISLNK(mode)) 711 if (S_ISLNK(mode))
707 ei->i_flags &= ~(EXT4_IMMUTABLE_FL|EXT4_APPEND_FL); 712 ei->i_flags &= ~(EXT4_IMMUTABLE_FL|EXT4_APPEND_FL);
708 /* dirsync only applies to directories */ 713 /* dirsync only applies to directories */
@@ -745,12 +750,15 @@ got:
745 goto fail_free_drop; 750 goto fail_free_drop;
746 } 751 }
747 if (test_opt(sb, EXTENTS)) { 752 if (test_opt(sb, EXTENTS)) {
748 EXT4_I(inode)->i_flags |= EXT4_EXTENTS_FL; 753 /* set extent flag only for directory and file */
749 ext4_ext_tree_init(handle, inode); 754 if (S_ISDIR(mode) || S_ISREG(mode)) {
750 err = ext4_update_incompat_feature(handle, sb, 755 EXT4_I(inode)->i_flags |= EXT4_EXTENTS_FL;
751 EXT4_FEATURE_INCOMPAT_EXTENTS); 756 ext4_ext_tree_init(handle, inode);
752 if (err) 757 err = ext4_update_incompat_feature(handle, sb,
753 goto fail; 758 EXT4_FEATURE_INCOMPAT_EXTENTS);
759 if (err)
760 goto fail;
761 }
754 } 762 }
755 763
756 ext4_debug("allocating inode %lu\n", inode->i_ino); 764 ext4_debug("allocating inode %lu\n", inode->i_ino);