@@ -971,11 +971,10 @@ void ext4_es_insert_extent(struct inode *inode, ext4_lblk_t lblk,
* reduce the reserved cluster count and claim quota.
*
* Otherwise, we aren't allocating delayed allocated clusters
- * (from fallocate, filemap, DIO, or clusters allocated when
- * delalloc has been disabled by ext4_nonda_switch()), reduce the
- * reserved cluster count by the number of allocated clusters that
- * have previously been delayed allocated. Quota has been claimed
- * by ext4_mb_new_blocks(), so release the quota reservations made
+ * (from fallocate, filemap, DIO), reduce the reserved cluster
+ * count by the number of allocated clusters that have previously
+ * been delayed allocated. Quota has been claimed by
+ * ext4_mb_new_blocks(), so release the quota reservations made
* for any previously delayed allocated clusters.
*/
ext4_da_update_reserve_space(inode, rinfo.ndelonly_clu + pending,
@@ -2838,40 +2838,6 @@ static int ext4_dax_writepages(struct address_space *mapping,
return ret;
}
-static int ext4_nonda_switch(struct super_block *sb)
-{
- s64 free_clusters, dirty_clusters;
- struct ext4_sb_info *sbi = EXT4_SB(sb);
-
- /*
- * switch to non delalloc mode if we are running low
- * on free block. The free block accounting via percpu
- * counters can get slightly wrong with percpu_counter_batch getting
- * accumulated on each CPU without updating global counters
- * Delalloc need an accurate free block accounting. So switch
- * to non delalloc when we are near to error range.
- */
- free_clusters =
- percpu_counter_read_positive(&sbi->s_freeclusters_counter);
- dirty_clusters =
- percpu_counter_read_positive(&sbi->s_dirtyclusters_counter);
- /*
- * Start pushing delalloc when 1/2 of free blocks are dirty.
- */
- if (dirty_clusters && (free_clusters < 2 * dirty_clusters))
- try_to_writeback_inodes_sb(sb, WB_REASON_FS_FREE_SPACE);
-
- if (2 * free_clusters < 3 * dirty_clusters ||
- free_clusters < (dirty_clusters + EXT4_FREECLUSTERS_WATERMARK)) {
- /*
- * free block count is less than 150% of dirty blocks
- * or free blocks is less than watermark
- */
- return 1;
- }
- return 0;
-}
-
static int ext4_da_write_begin(struct file *file, struct address_space *mapping,
loff_t pos, unsigned len,
struct page **pagep, void **fsdata)
@@ -2886,7 +2852,7 @@ static int ext4_da_write_begin(struct file *file, struct address_space *mapping,
index = pos >> PAGE_SHIFT;
- if (ext4_nonda_switch(inode->i_sb) || ext4_verity_in_progress(inode)) {
+ if (ext4_verity_in_progress(inode)) {
*fsdata = (void *)FALL_BACK_TO_NONDELALLOC;
return ext4_write_begin(file, mapping, pos,
len, pagep, fsdata);
@@ -6117,8 +6083,7 @@ vm_fault_t ext4_page_mkwrite(struct vm_fault *vmf)
goto retry_alloc;
/* Delalloc case is easy... */
- if (test_opt(inode->i_sb, DELALLOC) &&
- !ext4_nonda_switch(inode->i_sb)) {
+ if (test_opt(inode->i_sb, DELALLOC)) {
do {
err = block_page_mkwrite(vma, vmf,
ext4_da_get_block_prep);