diff options
Diffstat (limited to 'fs/ext4/extents.c')
-rw-r--r-- | fs/ext4/extents.c | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/fs/ext4/extents.c b/fs/ext4/extents.c index 5c5dd3a1d657..5596b70efa20 100644 --- a/fs/ext4/extents.c +++ b/fs/ext4/extents.c | |||
@@ -1758,7 +1758,7 @@ int ext4_ext_calc_credits_for_single_extent(struct inode *inode, int num, | |||
1758 | { | 1758 | { |
1759 | if (path) { | 1759 | if (path) { |
1760 | int depth = ext_depth(inode); | 1760 | int depth = ext_depth(inode); |
1761 | int ret; | 1761 | int ret = 0; |
1762 | 1762 | ||
1763 | /* probably there is space in leaf? */ | 1763 | /* probably there is space in leaf? */ |
1764 | if (le16_to_cpu(path[depth].p_hdr->eh_entries) | 1764 | if (le16_to_cpu(path[depth].p_hdr->eh_entries) |
@@ -1777,7 +1777,7 @@ int ext4_ext_calc_credits_for_single_extent(struct inode *inode, int num, | |||
1777 | } | 1777 | } |
1778 | } | 1778 | } |
1779 | 1779 | ||
1780 | return ext4_meta_trans_blocks(inode, num, 1); | 1780 | return ext4_chunk_trans_blocks(inode, num); |
1781 | } | 1781 | } |
1782 | 1782 | ||
1783 | /* | 1783 | /* |
@@ -2810,7 +2810,7 @@ void ext4_ext_truncate(struct inode *inode) | |||
2810 | /* | 2810 | /* |
2811 | * probably first extent we're gonna free will be last in block | 2811 | * probably first extent we're gonna free will be last in block |
2812 | */ | 2812 | */ |
2813 | err = ext4_writepage_trans_blocks(inode) + 3; | 2813 | err = ext4_writepage_trans_blocks(inode); |
2814 | handle = ext4_journal_start(inode, err); | 2814 | handle = ext4_journal_start(inode, err); |
2815 | if (IS_ERR(handle)) | 2815 | if (IS_ERR(handle)) |
2816 | return; | 2816 | return; |
@@ -2923,10 +2923,9 @@ long ext4_fallocate(struct inode *inode, int mode, loff_t offset, loff_t len) | |||
2923 | max_blocks = (EXT4_BLOCK_ALIGN(len + offset, blkbits) >> blkbits) | 2923 | max_blocks = (EXT4_BLOCK_ALIGN(len + offset, blkbits) >> blkbits) |
2924 | - block; | 2924 | - block; |
2925 | /* | 2925 | /* |
2926 | * credits to insert 1 extent into extent tree + buffers to be able to | 2926 | * credits to insert 1 extent into extent tree |
2927 | * modify 1 super block, 1 block bitmap and 1 group descriptor. | ||
2928 | */ | 2927 | */ |
2929 | credits = EXT4_DATA_TRANS_BLOCKS(inode->i_sb) + 3; | 2928 | credits = ext4_chunk_trans_blocks(inode, max_blocks); |
2930 | mutex_lock(&inode->i_mutex); | 2929 | mutex_lock(&inode->i_mutex); |
2931 | retry: | 2930 | retry: |
2932 | while (ret >= 0 && ret < max_blocks) { | 2931 | while (ret >= 0 && ret < max_blocks) { |