From: <vl...@us...> - 2007-01-09 14:52:32
|
Revision: 74 http://svn.sourceforge.net/scst/?rev=74&view=rev Author: vlnb Date: 2007-01-09 06:52:16 -0800 (Tue, 09 Jan 2007) Log Message: ----------- Atomic memory barriers cleanup. Inspired by Ming Zhang. Modified Paths: -------------- trunk/qla2x00t/qla2x00-target/qla2x00t.c trunk/scst/src/scst_priv.h Modified: trunk/qla2x00t/qla2x00-target/qla2x00t.c =================================================================== --- trunk/qla2x00t/qla2x00-target/qla2x00t.c 2007-01-08 17:56:35 UTC (rev 73) +++ trunk/qla2x00t/qla2x00-target/qla2x00t.c 2007-01-09 14:52:16 UTC (rev 74) @@ -287,11 +287,8 @@ tgt->handle, list_empty(&tgt->sess_list), atomic_read(&tgt->sess_count)); - smp_mb__before_atomic_dec(); - if (atomic_dec_and_test(&tgt->sess_count)) { - smp_mb__after_atomic_dec(); + if (atomic_dec_and_test(&tgt->sess_count)) wake_up_all(&tgt->waitQ); - } out: TRACE_EXIT(); @@ -1415,7 +1412,6 @@ out_free_sess: kfree(sess); - smp_mb__before_atomic_dec(); if (atomic_dec_and_test(&tgt->sess_count)) wake_up_all(&tgt->waitQ); /* go through */ Modified: trunk/scst/src/scst_priv.h =================================================================== --- trunk/scst/src/scst_priv.h 2007-01-08 17:56:35 UTC (rev 73) +++ trunk/scst/src/scst_priv.h 2007-01-09 14:52:16 UTC (rev 74) @@ -433,6 +433,7 @@ static inline void scst_inc_cmd_count(void) { atomic_inc(&scst_cmd_count); + /* It's needed to be before test_bit(SCST_FLAG_SUSPENDED) */ smp_mb__after_atomic_inc(); TRACE_DBG("Incrementing scst_cmd_count(%d)", atomic_read(&scst_cmd_count)); @@ -442,7 +443,6 @@ { int f; f = atomic_dec_and_test(&scst_cmd_count); - smp_mb__after_atomic_dec(); if (f && unlikely(test_bit(SCST_FLAG_SUSPENDED, &scst_flags))) wake_up_all(&scst_dev_cmd_waitQ); TRACE_DBG("Decrementing scst_cmd_count(%d)", @@ -458,11 +458,8 @@ static inline void scst_sess_put(struct scst_session *sess) { - smp_mb__before_atomic_dec(); - if (atomic_dec_and_test(&sess->refcnt)) { - smp_mb__after_atomic_dec(); + if (atomic_dec_and_test(&sess->refcnt)) scst_sched_session_free(sess); - } } void __scst_suspend_activity(void); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |