[PATCH 1/3] ext4: reorganize if statement of, ext4_mb_release_context()

From: brookxu
Date: Thu Jul 23 2020 - 22:58:19 EST


Reorganize the if statement of ext4_mb_release_context(), make it
easier to read.

Signed-off-by: Chunguang Xu <brookxu@xxxxxxxxxxx>
---
Âfs/ext4/mballoc.c | 27 +++++++++++++--------------
Â1 file changed, 13 insertions(+), 14 deletions(-)

diff --git a/fs/ext4/mballoc.c b/fs/ext4/mballoc.c
index c0a331e..4f21f34 100644
--- a/fs/ext4/mballoc.c
+++ b/fs/ext4/mballoc.c
@@ -4564,20 +4564,19 @@ static int ext4_mb_release_context(struct ext4_allocation_context *ac)
ÂÂÂÂ ÂÂÂ ÂÂÂ pa->pa_free -= ac->ac_b_ex.fe_len;
ÂÂÂÂ ÂÂÂ ÂÂÂ pa->pa_len -= ac->ac_b_ex.fe_len;
ÂÂÂÂ ÂÂÂ ÂÂÂ spin_unlock(&pa->pa_lock);
-ÂÂÂ ÂÂÂ }
-ÂÂÂ }
-ÂÂÂ if (pa) {
-ÂÂÂ ÂÂÂ /*
-ÂÂÂ ÂÂÂ Â* We want to add the pa to the right bucket.
-ÂÂÂ ÂÂÂ Â* Remove it from the list and while adding
-ÂÂÂ ÂÂÂ Â* make sure the list to which we are adding
-ÂÂÂ ÂÂÂ Â* doesn't grow big.
-ÂÂÂ ÂÂÂ Â*/
-ÂÂÂ ÂÂÂ if ((pa->pa_type == MB_GROUP_PA) && likely(pa->pa_free)) {
-ÂÂÂ ÂÂÂ ÂÂÂ spin_lock(pa->pa_obj_lock);
-ÂÂÂ ÂÂÂ ÂÂÂ list_del_rcu(&pa->pa_inode_list);
-ÂÂÂ ÂÂÂ ÂÂÂ spin_unlock(pa->pa_obj_lock);
-ÂÂÂ ÂÂÂ ÂÂÂ ext4_mb_add_n_trim(ac);
+
+ÂÂÂ ÂÂÂ ÂÂÂ /*
+ÂÂÂ ÂÂÂ ÂÂÂ Â* We want to add the pa to the right bucket.
+ÂÂÂ ÂÂÂ ÂÂÂ Â* Remove it from the list and while adding
+ÂÂÂ ÂÂÂ ÂÂÂ Â* make sure the list to which we are adding
+ÂÂÂ ÂÂÂ ÂÂÂ Â* doesn't grow big.
+ÂÂÂ ÂÂÂ ÂÂÂ Â*/
+ÂÂÂ ÂÂÂ ÂÂÂ if (likely(pa->pa_free)) {
+ÂÂÂ ÂÂÂ ÂÂÂ ÂÂÂ spin_lock(pa->pa_obj_lock);
+ÂÂÂ ÂÂÂ ÂÂÂ ÂÂÂ list_del_rcu(&pa->pa_inode_list);
+ÂÂÂ ÂÂÂ ÂÂÂ ÂÂÂ spin_unlock(pa->pa_obj_lock);
+ÂÂÂ ÂÂÂ ÂÂÂ ÂÂÂ ext4_mb_add_n_trim(ac);
+ÂÂÂ ÂÂÂ ÂÂÂ }
ÂÂÂÂ ÂÂÂ }
ÂÂÂÂ ÂÂÂ ext4_mb_put_pa(ac, ac->ac_sb, pa);
ÂÂÂÂ }
--
1.8.3.1