diff options
Diffstat (limited to 'fs/ext4/mballoc.c')
| -rw-r--r-- | fs/ext4/mballoc.c | 32 |
1 files changed, 19 insertions, 13 deletions
diff --git a/fs/ext4/mballoc.c b/fs/ext4/mballoc.c index deba54f6cbed..4415beeb0b62 100644 --- a/fs/ext4/mballoc.c +++ b/fs/ext4/mballoc.c | |||
| @@ -3693,6 +3693,8 @@ ext4_mb_new_inode_pa(struct ext4_allocation_context *ac) | |||
| 3693 | pa->pa_free = pa->pa_len; | 3693 | pa->pa_free = pa->pa_len; |
| 3694 | atomic_set(&pa->pa_count, 1); | 3694 | atomic_set(&pa->pa_count, 1); |
| 3695 | spin_lock_init(&pa->pa_lock); | 3695 | spin_lock_init(&pa->pa_lock); |
| 3696 | INIT_LIST_HEAD(&pa->pa_inode_list); | ||
| 3697 | INIT_LIST_HEAD(&pa->pa_group_list); | ||
| 3696 | pa->pa_deleted = 0; | 3698 | pa->pa_deleted = 0; |
| 3697 | pa->pa_linear = 0; | 3699 | pa->pa_linear = 0; |
| 3698 | 3700 | ||
| @@ -3755,6 +3757,7 @@ ext4_mb_new_group_pa(struct ext4_allocation_context *ac) | |||
| 3755 | atomic_set(&pa->pa_count, 1); | 3757 | atomic_set(&pa->pa_count, 1); |
| 3756 | spin_lock_init(&pa->pa_lock); | 3758 | spin_lock_init(&pa->pa_lock); |
| 3757 | INIT_LIST_HEAD(&pa->pa_inode_list); | 3759 | INIT_LIST_HEAD(&pa->pa_inode_list); |
| 3760 | INIT_LIST_HEAD(&pa->pa_group_list); | ||
| 3758 | pa->pa_deleted = 0; | 3761 | pa->pa_deleted = 0; |
| 3759 | pa->pa_linear = 1; | 3762 | pa->pa_linear = 1; |
| 3760 | 3763 | ||
| @@ -4476,23 +4479,26 @@ static int ext4_mb_release_context(struct ext4_allocation_context *ac) | |||
| 4476 | pa->pa_free -= ac->ac_b_ex.fe_len; | 4479 | pa->pa_free -= ac->ac_b_ex.fe_len; |
| 4477 | pa->pa_len -= ac->ac_b_ex.fe_len; | 4480 | pa->pa_len -= ac->ac_b_ex.fe_len; |
| 4478 | spin_unlock(&pa->pa_lock); | 4481 | 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 | } | 4482 | } |
| 4492 | ext4_mb_put_pa(ac, ac->ac_sb, pa); | ||
| 4493 | } | 4483 | } |
| 4494 | if (ac->alloc_semp) | 4484 | if (ac->alloc_semp) |
| 4495 | up_read(ac->alloc_semp); | 4485 | up_read(ac->alloc_semp); |
| 4486 | if (pa) { | ||
| 4487 | /* | ||
| 4488 | * We want to add the pa to the right bucket. | ||
| 4489 | * Remove it from the list and while adding | ||
| 4490 | * make sure the list to which we are adding | ||
| 4491 | * doesn't grow big. We need to release | ||
| 4492 | * alloc_semp before calling ext4_mb_add_n_trim() | ||
| 4493 | */ | ||
| 4494 | if (pa->pa_linear && likely(pa->pa_free)) { | ||
| 4495 | spin_lock(pa->pa_obj_lock); | ||
| 4496 | list_del_rcu(&pa->pa_inode_list); | ||
| 4497 | spin_unlock(pa->pa_obj_lock); | ||
| 4498 | ext4_mb_add_n_trim(ac); | ||
| 4499 | } | ||
| 4500 | ext4_mb_put_pa(ac, ac->ac_sb, pa); | ||
| 4501 | } | ||
| 4496 | if (ac->ac_bitmap_page) | 4502 | if (ac->ac_bitmap_page) |
| 4497 | page_cache_release(ac->ac_bitmap_page); | 4503 | page_cache_release(ac->ac_bitmap_page); |
| 4498 | if (ac->ac_buddy_page) | 4504 | if (ac->ac_buddy_page) |
