diff options
Diffstat (limited to 'fs/ext4')
-rw-r--r-- | fs/ext4/block_validity.c | 1 | ||||
-rw-r--r-- | fs/ext4/extents.c | 1 | ||||
-rw-r--r-- | fs/ext4/ialloc.c | 4 | ||||
-rw-r--r-- | fs/ext4/inode.c | 8 | ||||
-rw-r--r-- | fs/ext4/mballoc.c | 24 | ||||
-rw-r--r-- | fs/ext4/migrate.c | 1 | ||||
-rw-r--r-- | fs/ext4/move_extent.c | 1 | ||||
-rw-r--r-- | fs/ext4/super.c | 31 | ||||
-rw-r--r-- | fs/ext4/xattr_security.c | 1 |
9 files changed, 44 insertions, 28 deletions
diff --git a/fs/ext4/block_validity.c b/fs/ext4/block_validity.c index 983f0e127493..538c48655084 100644 --- a/fs/ext4/block_validity.c +++ b/fs/ext4/block_validity.c | |||
@@ -18,6 +18,7 @@ | |||
18 | #include <linux/pagemap.h> | 18 | #include <linux/pagemap.h> |
19 | #include <linux/blkdev.h> | 19 | #include <linux/blkdev.h> |
20 | #include <linux/mutex.h> | 20 | #include <linux/mutex.h> |
21 | #include <linux/slab.h> | ||
21 | #include "ext4.h" | 22 | #include "ext4.h" |
22 | 23 | ||
23 | struct ext4_system_zone { | 24 | struct ext4_system_zone { |
diff --git a/fs/ext4/extents.c b/fs/ext4/extents.c index 94c8ee81f5e1..236b834b4ca8 100644 --- a/fs/ext4/extents.c +++ b/fs/ext4/extents.c | |||
@@ -3879,6 +3879,7 @@ static int ext4_xattr_fiemap(struct inode *inode, | |||
3879 | physical += offset; | 3879 | physical += offset; |
3880 | length = EXT4_SB(inode->i_sb)->s_inode_size - offset; | 3880 | length = EXT4_SB(inode->i_sb)->s_inode_size - offset; |
3881 | flags |= FIEMAP_EXTENT_DATA_INLINE; | 3881 | flags |= FIEMAP_EXTENT_DATA_INLINE; |
3882 | brelse(iloc.bh); | ||
3882 | } else { /* external block */ | 3883 | } else { /* external block */ |
3883 | physical = EXT4_I(inode)->i_file_acl << blockbits; | 3884 | physical = EXT4_I(inode)->i_file_acl << blockbits; |
3884 | length = inode->i_sb->s_blocksize; | 3885 | length = inode->i_sb->s_blocksize; |
diff --git a/fs/ext4/ialloc.c b/fs/ext4/ialloc.c index 361c0b9962a8..57f6eef6ccd6 100644 --- a/fs/ext4/ialloc.c +++ b/fs/ext4/ialloc.c | |||
@@ -263,7 +263,7 @@ void ext4_free_inode(handle_t *handle, struct inode *inode) | |||
263 | ext4_group_t f; | 263 | ext4_group_t f; |
264 | 264 | ||
265 | f = ext4_flex_group(sbi, block_group); | 265 | f = ext4_flex_group(sbi, block_group); |
266 | atomic_dec(&sbi->s_flex_groups[f].free_inodes); | 266 | atomic_dec(&sbi->s_flex_groups[f].used_dirs); |
267 | } | 267 | } |
268 | 268 | ||
269 | } | 269 | } |
@@ -773,7 +773,7 @@ static int ext4_claim_inode(struct super_block *sb, | |||
773 | if (sbi->s_log_groups_per_flex) { | 773 | if (sbi->s_log_groups_per_flex) { |
774 | ext4_group_t f = ext4_flex_group(sbi, group); | 774 | ext4_group_t f = ext4_flex_group(sbi, group); |
775 | 775 | ||
776 | atomic_inc(&sbi->s_flex_groups[f].free_inodes); | 776 | atomic_inc(&sbi->s_flex_groups[f].used_dirs); |
777 | } | 777 | } |
778 | } | 778 | } |
779 | gdp->bg_checksum = ext4_group_desc_csum(sbi, group, gdp); | 779 | gdp->bg_checksum = ext4_group_desc_csum(sbi, group, gdp); |
diff --git a/fs/ext4/inode.c b/fs/ext4/inode.c index 986120f30066..81d605412844 100644 --- a/fs/ext4/inode.c +++ b/fs/ext4/inode.c | |||
@@ -39,6 +39,7 @@ | |||
39 | #include <linux/bio.h> | 39 | #include <linux/bio.h> |
40 | #include <linux/workqueue.h> | 40 | #include <linux/workqueue.h> |
41 | #include <linux/kernel.h> | 41 | #include <linux/kernel.h> |
42 | #include <linux/slab.h> | ||
42 | 43 | ||
43 | #include "ext4_jbd2.h" | 44 | #include "ext4_jbd2.h" |
44 | #include "xattr.h" | 45 | #include "xattr.h" |
@@ -1035,7 +1036,7 @@ static int ext4_indirect_calc_metadata_amount(struct inode *inode, | |||
1035 | sector_t lblock) | 1036 | sector_t lblock) |
1036 | { | 1037 | { |
1037 | struct ext4_inode_info *ei = EXT4_I(inode); | 1038 | struct ext4_inode_info *ei = EXT4_I(inode); |
1038 | int dind_mask = EXT4_ADDR_PER_BLOCK(inode->i_sb) - 1; | 1039 | sector_t dind_mask = ~((sector_t)EXT4_ADDR_PER_BLOCK(inode->i_sb) - 1); |
1039 | int blk_bits; | 1040 | int blk_bits; |
1040 | 1041 | ||
1041 | if (lblock < EXT4_NDIR_BLOCKS) | 1042 | if (lblock < EXT4_NDIR_BLOCKS) |
@@ -1050,7 +1051,7 @@ static int ext4_indirect_calc_metadata_amount(struct inode *inode, | |||
1050 | } | 1051 | } |
1051 | ei->i_da_metadata_calc_last_lblock = lblock & dind_mask; | 1052 | ei->i_da_metadata_calc_last_lblock = lblock & dind_mask; |
1052 | ei->i_da_metadata_calc_len = 1; | 1053 | ei->i_da_metadata_calc_len = 1; |
1053 | blk_bits = roundup_pow_of_two(lblock + 1); | 1054 | blk_bits = order_base_2(lblock); |
1054 | return (blk_bits / EXT4_ADDR_PER_BLOCK_BITS(inode->i_sb)) + 1; | 1055 | return (blk_bits / EXT4_ADDR_PER_BLOCK_BITS(inode->i_sb)) + 1; |
1055 | } | 1056 | } |
1056 | 1057 | ||
@@ -5374,7 +5375,7 @@ int ext4_write_inode(struct inode *inode, struct writeback_control *wbc) | |||
5374 | } else { | 5375 | } else { |
5375 | struct ext4_iloc iloc; | 5376 | struct ext4_iloc iloc; |
5376 | 5377 | ||
5377 | err = ext4_get_inode_loc(inode, &iloc); | 5378 | err = __ext4_get_inode_loc(inode, &iloc, 0); |
5378 | if (err) | 5379 | if (err) |
5379 | return err; | 5380 | return err; |
5380 | if (wbc->sync_mode == WB_SYNC_ALL) | 5381 | if (wbc->sync_mode == WB_SYNC_ALL) |
@@ -5385,6 +5386,7 @@ int ext4_write_inode(struct inode *inode, struct writeback_control *wbc) | |||
5385 | (unsigned long long)iloc.bh->b_blocknr); | 5386 | (unsigned long long)iloc.bh->b_blocknr); |
5386 | err = -EIO; | 5387 | err = -EIO; |
5387 | } | 5388 | } |
5389 | brelse(iloc.bh); | ||
5388 | } | 5390 | } |
5389 | return err; | 5391 | return err; |
5390 | } | 5392 | } |
diff --git a/fs/ext4/mballoc.c b/fs/ext4/mballoc.c index 506713a2ebd8..b423a364dca3 100644 --- a/fs/ext4/mballoc.c +++ b/fs/ext4/mballoc.c | |||
@@ -23,6 +23,7 @@ | |||
23 | 23 | ||
24 | #include "mballoc.h" | 24 | #include "mballoc.h" |
25 | #include <linux/debugfs.h> | 25 | #include <linux/debugfs.h> |
26 | #include <linux/slab.h> | ||
26 | #include <trace/events/ext4.h> | 27 | #include <trace/events/ext4.h> |
27 | 28 | ||
28 | /* | 29 | /* |
@@ -69,7 +70,7 @@ | |||
69 | * | 70 | * |
70 | * pa_lstart -> the logical start block for this prealloc space | 71 | * pa_lstart -> the logical start block for this prealloc space |
71 | * pa_pstart -> the physical start block for this prealloc space | 72 | * pa_pstart -> the physical start block for this prealloc space |
72 | * pa_len -> lenght for this prealloc space | 73 | * pa_len -> length for this prealloc space |
73 | * pa_free -> free space available in this prealloc space | 74 | * pa_free -> free space available in this prealloc space |
74 | * | 75 | * |
75 | * The inode preallocation space is used looking at the _logical_ start | 76 | * The inode preallocation space is used looking at the _logical_ start |
@@ -2534,6 +2535,17 @@ static void release_blocks_on_commit(journal_t *journal, transaction_t *txn) | |||
2534 | mb_debug(1, "gonna free %u blocks in group %u (0x%p):", | 2535 | mb_debug(1, "gonna free %u blocks in group %u (0x%p):", |
2535 | entry->count, entry->group, entry); | 2536 | entry->count, entry->group, entry); |
2536 | 2537 | ||
2538 | if (test_opt(sb, DISCARD)) { | ||
2539 | ext4_fsblk_t discard_block; | ||
2540 | |||
2541 | discard_block = entry->start_blk + | ||
2542 | ext4_group_first_block_no(sb, entry->group); | ||
2543 | trace_ext4_discard_blocks(sb, | ||
2544 | (unsigned long long)discard_block, | ||
2545 | entry->count); | ||
2546 | sb_issue_discard(sb, discard_block, entry->count); | ||
2547 | } | ||
2548 | |||
2537 | err = ext4_mb_load_buddy(sb, entry->group, &e4b); | 2549 | err = ext4_mb_load_buddy(sb, entry->group, &e4b); |
2538 | /* we expect to find existing buddy because it's pinned */ | 2550 | /* we expect to find existing buddy because it's pinned */ |
2539 | BUG_ON(err != 0); | 2551 | BUG_ON(err != 0); |
@@ -2555,16 +2567,6 @@ static void release_blocks_on_commit(journal_t *journal, transaction_t *txn) | |||
2555 | page_cache_release(e4b.bd_bitmap_page); | 2567 | page_cache_release(e4b.bd_bitmap_page); |
2556 | } | 2568 | } |
2557 | ext4_unlock_group(sb, entry->group); | 2569 | ext4_unlock_group(sb, entry->group); |
2558 | if (test_opt(sb, DISCARD)) { | ||
2559 | ext4_fsblk_t discard_block; | ||
2560 | |||
2561 | discard_block = entry->start_blk + | ||
2562 | ext4_group_first_block_no(sb, entry->group); | ||
2563 | trace_ext4_discard_blocks(sb, | ||
2564 | (unsigned long long)discard_block, | ||
2565 | entry->count); | ||
2566 | sb_issue_discard(sb, discard_block, entry->count); | ||
2567 | } | ||
2568 | kmem_cache_free(ext4_free_ext_cachep, entry); | 2570 | kmem_cache_free(ext4_free_ext_cachep, entry); |
2569 | ext4_mb_release_desc(&e4b); | 2571 | ext4_mb_release_desc(&e4b); |
2570 | } | 2572 | } |
diff --git a/fs/ext4/migrate.c b/fs/ext4/migrate.c index 8b87bd0eac95..34dcfc52ef44 100644 --- a/fs/ext4/migrate.c +++ b/fs/ext4/migrate.c | |||
@@ -13,6 +13,7 @@ | |||
13 | */ | 13 | */ |
14 | 14 | ||
15 | #include <linux/module.h> | 15 | #include <linux/module.h> |
16 | #include <linux/slab.h> | ||
16 | #include "ext4_jbd2.h" | 17 | #include "ext4_jbd2.h" |
17 | #include "ext4_extents.h" | 18 | #include "ext4_extents.h" |
18 | 19 | ||
diff --git a/fs/ext4/move_extent.c b/fs/ext4/move_extent.c index aa5fe28d180f..d1fc662cc311 100644 --- a/fs/ext4/move_extent.c +++ b/fs/ext4/move_extent.c | |||
@@ -15,6 +15,7 @@ | |||
15 | 15 | ||
16 | #include <linux/fs.h> | 16 | #include <linux/fs.h> |
17 | #include <linux/quotaops.h> | 17 | #include <linux/quotaops.h> |
18 | #include <linux/slab.h> | ||
18 | #include "ext4_jbd2.h" | 19 | #include "ext4_jbd2.h" |
19 | #include "ext4_extents.h" | 20 | #include "ext4_extents.h" |
20 | #include "ext4.h" | 21 | #include "ext4.h" |
diff --git a/fs/ext4/super.c b/fs/ext4/super.c index ce84a6ed4a48..e14d22c170d5 100644 --- a/fs/ext4/super.c +++ b/fs/ext4/super.c | |||
@@ -68,7 +68,21 @@ static int ext4_statfs(struct dentry *dentry, struct kstatfs *buf); | |||
68 | static int ext4_unfreeze(struct super_block *sb); | 68 | static int ext4_unfreeze(struct super_block *sb); |
69 | static void ext4_write_super(struct super_block *sb); | 69 | static void ext4_write_super(struct super_block *sb); |
70 | static int ext4_freeze(struct super_block *sb); | 70 | static int ext4_freeze(struct super_block *sb); |
71 | static int ext4_get_sb(struct file_system_type *fs_type, int flags, | ||
72 | const char *dev_name, void *data, struct vfsmount *mnt); | ||
71 | 73 | ||
74 | #if !defined(CONFIG_EXT3_FS) && !defined(CONFIG_EXT3_FS_MODULE) && defined(CONFIG_EXT4_USE_FOR_EXT23) | ||
75 | static struct file_system_type ext3_fs_type = { | ||
76 | .owner = THIS_MODULE, | ||
77 | .name = "ext3", | ||
78 | .get_sb = ext4_get_sb, | ||
79 | .kill_sb = kill_block_super, | ||
80 | .fs_flags = FS_REQUIRES_DEV, | ||
81 | }; | ||
82 | #define IS_EXT3_SB(sb) ((sb)->s_bdev->bd_holder == &ext3_fs_type) | ||
83 | #else | ||
84 | #define IS_EXT3_SB(sb) (0) | ||
85 | #endif | ||
72 | 86 | ||
73 | ext4_fsblk_t ext4_block_bitmap(struct super_block *sb, | 87 | ext4_fsblk_t ext4_block_bitmap(struct super_block *sb, |
74 | struct ext4_group_desc *bg) | 88 | struct ext4_group_desc *bg) |
@@ -302,7 +316,7 @@ void ext4_journal_abort_handle(const char *caller, const char *err_fn, | |||
302 | * write out the superblock safely. | 316 | * write out the superblock safely. |
303 | * | 317 | * |
304 | * We'll just use the jbd2_journal_abort() error code to record an error in | 318 | * We'll just use the jbd2_journal_abort() error code to record an error in |
305 | * the journal instead. On recovery, the journal will compain about | 319 | * the journal instead. On recovery, the journal will complain about |
306 | * that error until we've noted it down and cleared it. | 320 | * that error until we've noted it down and cleared it. |
307 | */ | 321 | */ |
308 | 322 | ||
@@ -2539,7 +2553,8 @@ static int ext4_fill_super(struct super_block *sb, void *data, int silent) | |||
2539 | * enable delayed allocation by default | 2553 | * enable delayed allocation by default |
2540 | * Use -o nodelalloc to turn it off | 2554 | * Use -o nodelalloc to turn it off |
2541 | */ | 2555 | */ |
2542 | set_opt(sbi->s_mount_opt, DELALLOC); | 2556 | if (!IS_EXT3_SB(sb)) |
2557 | set_opt(sbi->s_mount_opt, DELALLOC); | ||
2543 | 2558 | ||
2544 | if (!parse_options((char *) data, sb, &journal_devnum, | 2559 | if (!parse_options((char *) data, sb, &journal_devnum, |
2545 | &journal_ioprio, NULL, 0)) | 2560 | &journal_ioprio, NULL, 0)) |
@@ -4068,7 +4083,7 @@ static int ext4_get_sb(struct file_system_type *fs_type, int flags, | |||
4068 | return get_sb_bdev(fs_type, flags, dev_name, data, ext4_fill_super,mnt); | 4083 | return get_sb_bdev(fs_type, flags, dev_name, data, ext4_fill_super,mnt); |
4069 | } | 4084 | } |
4070 | 4085 | ||
4071 | #if !defined(CONTIG_EXT2_FS) && !defined(CONFIG_EXT2_FS_MODULE) && defined(CONFIG_EXT4_USE_FOR_EXT23) | 4086 | #if !defined(CONFIG_EXT2_FS) && !defined(CONFIG_EXT2_FS_MODULE) && defined(CONFIG_EXT4_USE_FOR_EXT23) |
4072 | static struct file_system_type ext2_fs_type = { | 4087 | static struct file_system_type ext2_fs_type = { |
4073 | .owner = THIS_MODULE, | 4088 | .owner = THIS_MODULE, |
4074 | .name = "ext2", | 4089 | .name = "ext2", |
@@ -4095,15 +4110,7 @@ static inline void register_as_ext2(void) { } | |||
4095 | static inline void unregister_as_ext2(void) { } | 4110 | static inline void unregister_as_ext2(void) { } |
4096 | #endif | 4111 | #endif |
4097 | 4112 | ||
4098 | #if !defined(CONTIG_EXT3_FS) && !defined(CONFIG_EXT3_FS_MODULE) && defined(CONFIG_EXT4_USE_FOR_EXT23) | 4113 | #if !defined(CONFIG_EXT3_FS) && !defined(CONFIG_EXT3_FS_MODULE) && defined(CONFIG_EXT4_USE_FOR_EXT23) |
4099 | static struct file_system_type ext3_fs_type = { | ||
4100 | .owner = THIS_MODULE, | ||
4101 | .name = "ext3", | ||
4102 | .get_sb = ext4_get_sb, | ||
4103 | .kill_sb = kill_block_super, | ||
4104 | .fs_flags = FS_REQUIRES_DEV, | ||
4105 | }; | ||
4106 | |||
4107 | static inline void register_as_ext3(void) | 4114 | static inline void register_as_ext3(void) |
4108 | { | 4115 | { |
4109 | int err = register_filesystem(&ext3_fs_type); | 4116 | int err = register_filesystem(&ext3_fs_type); |
diff --git a/fs/ext4/xattr_security.c b/fs/ext4/xattr_security.c index 983c253999a7..8b145e98df07 100644 --- a/fs/ext4/xattr_security.c +++ b/fs/ext4/xattr_security.c | |||
@@ -7,6 +7,7 @@ | |||
7 | #include <linux/string.h> | 7 | #include <linux/string.h> |
8 | #include <linux/fs.h> | 8 | #include <linux/fs.h> |
9 | #include <linux/security.h> | 9 | #include <linux/security.h> |
10 | #include <linux/slab.h> | ||
10 | #include "ext4_jbd2.h" | 11 | #include "ext4_jbd2.h" |
11 | #include "ext4.h" | 12 | #include "ext4.h" |
12 | #include "xattr.h" | 13 | #include "xattr.h" |