aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--fs/ext4/mballoc.c29
1 files changed, 16 insertions, 13 deletions
diff --git a/fs/ext4/mballoc.c b/fs/ext4/mballoc.c
index deba54f6cbed..c962d0690505 100644
--- a/fs/ext4/mballoc.c
+++ b/fs/ext4/mballoc.c
@@ -4476,23 +4476,26 @@ static int ext4_mb_release_context(struct ext4_allocation_context *ac)
4476 pa->pa_free -= ac->ac_b_ex.fe_len; 4476 pa->pa_free -= ac->ac_b_ex.fe_len;
4477 pa->pa_len -= ac->ac_b_ex.fe_len; 4477 pa->pa_len -= ac->ac_b_ex.fe_len;
4478 spin_unlock(&pa->pa_lock); 4478 spin_unlock(&pa->pa_lock);
4479 /*
4480 * We want to add the pa to the right bucket.
4481 * Remove it from the list and while adding
4482 * make sure the list to which we are adding
4483 * doesn't grow big.
4484 */
4485 if (likely(pa->pa_free)) {
4486 spin_lock(pa->pa_obj_lock);
4487 list_del_rcu(&pa->pa_inode_list);
4488 spin_unlock(pa->pa_obj_lock);
4489 ext4_mb_add_n_trim(ac);
4490 }
4491 } 4479 }
4492 ext4_mb_put_pa(ac, ac->ac_sb, pa);
4493 } 4480 }
4494 if (ac->alloc_semp) 4481 if (ac->alloc_semp)
4495 up_read(ac->alloc_semp); 4482 up_read(ac->alloc_semp);
4483 if (pa) {
4484 /*
4485 * We want to add the pa to the right bucket.
4486 * Remove it from the list and while adding
4487 * make sure the list to which we are adding
4488 * doesn't grow big. We need to release
4489 * alloc_semp before calling ext4_mb_add_n_trim()
4490 */
4491 if (pa->pa_linear && likely(pa->pa_free)) {
4492 spin_lock(pa->pa_obj_lock);
4493 list_del_rcu(&pa->pa_inode_list);
4494 spin_unlock(pa->pa_obj_lock);
4495 ext4_mb_add_n_trim(ac);
4496 }
4497 ext4_mb_put_pa(ac, ac->ac_sb, pa);
4498 }
4496 if (ac->ac_bitmap_page) 4499 if (ac->ac_bitmap_page)
4497 page_cache_release(ac->ac_bitmap_page); 4500 page_cache_release(ac->ac_bitmap_page);
4498 if (ac->ac_buddy_page) 4501 if (ac->ac_buddy_page)