diff options
Diffstat (limited to 'fs/ext4/ialloc.c')
-rw-r--r-- | fs/ext4/ialloc.c | 29 |
1 files changed, 20 insertions, 9 deletions
diff --git a/fs/ext4/ialloc.c b/fs/ext4/ialloc.c index 3f32c8012447..32fd2b9075dd 100644 --- a/fs/ext4/ialloc.c +++ b/fs/ext4/ialloc.c | |||
@@ -634,8 +634,10 @@ static int find_group_other(struct super_block *sb, struct inode *parent, | |||
634 | * For other inodes, search forward from the parent directory's block | 634 | * For other inodes, search forward from the parent directory's block |
635 | * group to find a free inode. | 635 | * group to find a free inode. |
636 | */ | 636 | */ |
637 | struct inode *ext4_new_inode(handle_t *handle, struct inode *dir, umode_t mode, | 637 | struct inode *__ext4_new_inode(handle_t *handle, struct inode *dir, |
638 | const struct qstr *qstr, __u32 goal, uid_t *owner) | 638 | umode_t mode, const struct qstr *qstr, |
639 | __u32 goal, uid_t *owner, int handle_type, | ||
640 | unsigned int line_no, int nblocks) | ||
639 | { | 641 | { |
640 | struct super_block *sb; | 642 | struct super_block *sb; |
641 | struct buffer_head *inode_bitmap_bh = NULL; | 643 | struct buffer_head *inode_bitmap_bh = NULL; |
@@ -725,6 +727,15 @@ repeat_in_this_group: | |||
725 | "inode=%lu", ino + 1); | 727 | "inode=%lu", ino + 1); |
726 | continue; | 728 | continue; |
727 | } | 729 | } |
730 | if (!handle) { | ||
731 | BUG_ON(nblocks <= 0); | ||
732 | handle = __ext4_journal_start_sb(dir->i_sb, line_no, | ||
733 | handle_type, nblocks); | ||
734 | if (IS_ERR(handle)) { | ||
735 | err = PTR_ERR(handle); | ||
736 | goto fail; | ||
737 | } | ||
738 | } | ||
728 | BUFFER_TRACE(inode_bitmap_bh, "get_write_access"); | 739 | BUFFER_TRACE(inode_bitmap_bh, "get_write_access"); |
729 | err = ext4_journal_get_write_access(handle, inode_bitmap_bh); | 740 | err = ext4_journal_get_write_access(handle, inode_bitmap_bh); |
730 | if (err) | 741 | if (err) |
@@ -1017,17 +1028,17 @@ iget_failed: | |||
1017 | inode = NULL; | 1028 | inode = NULL; |
1018 | bad_orphan: | 1029 | bad_orphan: |
1019 | ext4_warning(sb, "bad orphan inode %lu! e2fsck was run?", ino); | 1030 | ext4_warning(sb, "bad orphan inode %lu! e2fsck was run?", ino); |
1020 | printk(KERN_NOTICE "ext4_test_bit(bit=%d, block=%llu) = %d\n", | 1031 | printk(KERN_WARNING "ext4_test_bit(bit=%d, block=%llu) = %d\n", |
1021 | bit, (unsigned long long)bitmap_bh->b_blocknr, | 1032 | bit, (unsigned long long)bitmap_bh->b_blocknr, |
1022 | ext4_test_bit(bit, bitmap_bh->b_data)); | 1033 | ext4_test_bit(bit, bitmap_bh->b_data)); |
1023 | printk(KERN_NOTICE "inode=%p\n", inode); | 1034 | printk(KERN_WARNING "inode=%p\n", inode); |
1024 | if (inode) { | 1035 | if (inode) { |
1025 | printk(KERN_NOTICE "is_bad_inode(inode)=%d\n", | 1036 | printk(KERN_WARNING "is_bad_inode(inode)=%d\n", |
1026 | is_bad_inode(inode)); | 1037 | is_bad_inode(inode)); |
1027 | printk(KERN_NOTICE "NEXT_ORPHAN(inode)=%u\n", | 1038 | printk(KERN_WARNING "NEXT_ORPHAN(inode)=%u\n", |
1028 | NEXT_ORPHAN(inode)); | 1039 | NEXT_ORPHAN(inode)); |
1029 | printk(KERN_NOTICE "max_ino=%lu\n", max_ino); | 1040 | printk(KERN_WARNING "max_ino=%lu\n", max_ino); |
1030 | printk(KERN_NOTICE "i_nlink=%u\n", inode->i_nlink); | 1041 | printk(KERN_WARNING "i_nlink=%u\n", inode->i_nlink); |
1031 | /* Avoid freeing blocks if we got a bad deleted inode */ | 1042 | /* Avoid freeing blocks if we got a bad deleted inode */ |
1032 | if (inode->i_nlink == 0) | 1043 | if (inode->i_nlink == 0) |
1033 | inode->i_blocks = 0; | 1044 | inode->i_blocks = 0; |
@@ -1137,7 +1148,7 @@ int ext4_init_inode_table(struct super_block *sb, ext4_group_t group, | |||
1137 | if (gdp->bg_flags & cpu_to_le16(EXT4_BG_INODE_ZEROED)) | 1148 | if (gdp->bg_flags & cpu_to_le16(EXT4_BG_INODE_ZEROED)) |
1138 | goto out; | 1149 | goto out; |
1139 | 1150 | ||
1140 | handle = ext4_journal_start_sb(sb, 1); | 1151 | handle = ext4_journal_start_sb(sb, EXT4_HT_MISC, 1); |
1141 | if (IS_ERR(handle)) { | 1152 | if (IS_ERR(handle)) { |
1142 | ret = PTR_ERR(handle); | 1153 | ret = PTR_ERR(handle); |
1143 | goto out; | 1154 | goto out; |