aboutsummaryrefslogtreecommitdiffstats
path: root/fs/ext4
diff options
context:
space:
mode:
Diffstat (limited to 'fs/ext4')
-rw-r--r--fs/ext4/balloc.c18
1 files changed, 10 insertions, 8 deletions
diff --git a/fs/ext4/balloc.c b/fs/ext4/balloc.c
index a425e78c73eb..ae26c37e398e 100644
--- a/fs/ext4/balloc.c
+++ b/fs/ext4/balloc.c
@@ -1804,15 +1804,17 @@ retry_alloc:
1804 goto io_error; 1804 goto io_error;
1805 1805
1806 free_blocks = le16_to_cpu(gdp->bg_free_blocks_count); 1806 free_blocks = le16_to_cpu(gdp->bg_free_blocks_count);
1807 /*
1808 * if there is not enough free blocks to make a new resevation
1809 * turn off reservation for this allocation
1810 */
1811 if (my_rsv && (free_blocks < windowsz)
1812 && (rsv_is_empty(&my_rsv->rsv_window)))
1813 my_rsv = NULL;
1814 1807
1815 if (free_blocks > 0) { 1808 if (free_blocks > 0) {
1809 /*
1810 * try to allocate with group target block
1811 * in the goal group. If we have low free_blocks
1812 * count turn off reservation
1813 */
1814 if (my_rsv && (free_blocks < windowsz)
1815 && (rsv_is_empty(&my_rsv->rsv_window)))
1816 my_rsv = NULL;
1817
1816 bitmap_bh = ext4_read_block_bitmap(sb, group_no); 1818 bitmap_bh = ext4_read_block_bitmap(sb, group_no);
1817 if (!bitmap_bh) 1819 if (!bitmap_bh)
1818 goto io_error; 1820 goto io_error;
@@ -1845,7 +1847,7 @@ retry_alloc:
1845 * free blocks is less than half of the reservation 1847 * free blocks is less than half of the reservation
1846 * window size. 1848 * window size.
1847 */ 1849 */
1848 if (free_blocks <= (windowsz/2)) 1850 if (my_rsv && (free_blocks <= (windowsz/2)))
1849 continue; 1851 continue;
1850 1852
1851 brelse(bitmap_bh); 1853 brelse(bitmap_bh);