Whamcloud - gitweb
LU-6527 ext4: journal_commit_callback optimization 11/14611/4
authorSergey Cheremencev <sergey.cheremencev@seagate.com>
Wed, 8 Apr 2015 19:18:07 +0000 (22:18 +0300)
committerOleg Drokin <oleg.drokin@intel.com>
Wed, 7 Oct 2015 17:39:33 +0000 (17:39 +0000)
Don't take spinlock in tgt_cb_last_committed, if
exp_last_committed was updated with higher trasno.
Also change list_add_tail to list_add. It gives
advantages to ldiskfs in tgt_cb_last_committed.
In the beginning of list will be placed thandles
with the highest transaction numbers. So at the
first iterations we will have the highest transno.
It will save from extra call of
ptlrpc_commit_replies.

Change-Id: Ib6f9cc54dae7d9ac1ca301402299f308b825ede4
Signed-off-by: Sergey Cheremencev <sergey.cheremencev@seagate.com>
Xyratex-bug-id: MRP-2575
Reviewed-on: http://es-gerrit.xyus.xyratex.com:8080/5907
Tested-by: Jenkins
Reviewed-by: Alexander Zarochentsev <alexander.zarochentsev@seagate.com>
Reviewed-by: Alexander Boyko <alexander.boyko@seagate.com>
Tested-by: Alexander Lezhoev <alexander.lezhoev@seagate.com>
Reviewed-by: Alexey Leonidovich Lyashkov <alexey.lyashkov@seagate.com>
Reviewed-on: http://review.whamcloud.com/14611
Tested-by: Maloo <hpdd-maloo@intel.com>
Reviewed-by: Alex Zhuravlev <alexey.zhuravlev@intel.com>
Reviewed-by: Mike Pershin <mike.pershin@intel.com>
Reviewed-by: Oleg Drokin <oleg.drokin@intel.com>
ldiskfs/kernel_patches/patches/rhel6.3/ext4-journal-callback.patch
lustre/target/tgt_lastrcvd.c

index 7f8a90c..9255ebf 100644 (file)
@@ -73,7 +73,7 @@ Index: linux-2.6.32-504.3.3.el6.x86_64/fs/ext4/ext4_jbd2.h
 +      /* Add the jce to transaction's private list */
 +      jce->jce_func = func;
 +      spin_lock(&sbi->s_md_lock);
-+      list_add_tail(&jce->jce_list, &handle->h_transaction->t_private_list);
++      list_add(&jce->jce_list, &handle->h_transaction->t_private_list);
 +      spin_unlock(&sbi->s_md_lock);
 +}
 +
index 8b0f9a0..a152f05 100644 (file)
@@ -761,14 +761,19 @@ static void tgt_cb_last_committed(struct lu_env *env, struct thandle *th,
 
        ccb = container_of0(cb, struct tgt_last_committed_callback, llcc_cb);
 
+       LASSERT(ccb->llcc_exp);
        LASSERT(ccb->llcc_tgt != NULL);
        LASSERT(ccb->llcc_exp->exp_obd == ccb->llcc_tgt->lut_obd);
 
+       /* Fast path w/o spinlock, if exp_last_committed was updated
+        * with higher transno, no need to take spinlock and check,
+        * also no need to update obd_last_committed. */
+       if (ccb->llcc_transno <= ccb->llcc_exp->exp_last_committed)
+               goto out;
        spin_lock(&ccb->llcc_tgt->lut_translock);
        if (ccb->llcc_transno > ccb->llcc_tgt->lut_obd->obd_last_committed)
                ccb->llcc_tgt->lut_obd->obd_last_committed = ccb->llcc_transno;
 
-       LASSERT(ccb->llcc_exp);
        if (ccb->llcc_transno > ccb->llcc_exp->exp_last_committed) {
                ccb->llcc_exp->exp_last_committed = ccb->llcc_transno;
                spin_unlock(&ccb->llcc_tgt->lut_translock);
@@ -776,6 +781,7 @@ static void tgt_cb_last_committed(struct lu_env *env, struct thandle *th,
        } else {
                spin_unlock(&ccb->llcc_tgt->lut_translock);
        }
+out:
        class_export_cb_put(ccb->llcc_exp);
        if (ccb->llcc_transno)
                CDEBUG(D_HA, "%s: transno "LPD64" is committed\n",