Skip to contentSkip to conversation

dlm: rsb flag ops with inlined functions

PATCH New David Teigland 1 participant 1 message Jul 15, 2005

lore
Share & tools
lore
#0 lore raw

PATCH 5/12 dlm: rsb flag ops with inlined functions

Replace test/set/clear_bit of rsb flags with new inline functions that use the less expense non-atomic bit ops.

drivers/dlm/debug_fs.c +1 -1
Index: linux-2.6.12-mm1/drivers/dlm/debug_fs.c
===================================================================
@@ -114,7 +114,7 @@ static int print_resource(struct dlm_rsb
 			seq_printf(s, "%02x ",
 				   (unsigned char) res->res_lvbptr[i]);
 		}
-		if (test_bit(RESFL_VALNOTVALID, &res->res_flags))
+		if (rsb_flag(res, RSB_VALNOTVALID))
 			seq_printf(s, " (INVALID)");
 		seq_printf(s, "\n");
 	}
drivers/dlm/dlm_internal.h +33 -15

64 lines not on this page · raw message

drivers/dlm/lock.c +23 -23

143 lines not on this page · raw message

drivers/dlm/recover.c +10 -10
Index: linux-2.6.12-mm1/drivers/dlm/recover.c
===================================================================
@@ -309,8 +309,8 @@ static void set_new_master(struct dlm_rs
 
 	set_master_lkbs(r);
 
-	set_bit(RESFL_NEW_MASTER, &r->res_flags);
-	set_bit(RESFL_NEW_MASTER2, &r->res_flags);
+	rsb_set_flag(r, RSB_NEW_MASTER);
+	rsb_set_flag(r, RSB_NEW_MASTER2);
 	unlock_rsb(r);
 }
 
@@ -487,11 +487,11 @@ int dlm_recover_locks(struct dlm_ls *ls)
 	down_read(&ls->ls_root_sem);
 	list_for_each_entry(r, &ls->ls_root_list, res_root_list) {
 		if (is_master(r)) {
-			clear_bit(RESFL_NEW_MASTER, &r->res_flags);
+			rsb_clear_flag(r, RSB_NEW_MASTER);
 			continue;
 		}
 
-		if (!test_bit(RESFL_NEW_MASTER, &r->res_flags))
+		if (!rsb_flag(r, RSB_NEW_MASTER))
 			continue;
 
 		error = dlm_recovery_stopped(ls);
@@ -525,7 +525,7 @@ void dlm_recovered_lock(struct dlm_rsb *
 {
 	r->res_recover_locks_count--;
 	if (!r->res_recover_locks_count) {
-		clear_bit(RESFL_NEW_MASTER, &r->res_flags);
+		rsb_clear_flag(r, RSB_NEW_MASTER);
 		recover_list_del(r);
 	}
 
@@ -538,7 +538,7 @@ void dlm_recovered_lock(struct dlm_rsb *
  * the VALNOTVALID flag if necessary, and determining the correct lvb contents
  * based on the lvb's of the locks held on the rsb.
  *
- * RESFL_VALNOTVALID is set if there are only NL/CR locks on the rsb.  If it
+ * RSB_VALNOTVALID is set if there are only NL/CR locks on the rsb.  If it
  * was already set prior to recovery, it's not cleared, regardless of locks.
  *
  * The LVB contents are only considered for changing when this is a new master
@@ -594,10 +594,10 @@ static void recover_lvb(struct dlm_rsb *
 		goto out;
 
 	if (!big_lock_exists)
-		set_bit(RESFL_VALNOTVALID, &r->res_flags);
+		rsb_set_flag(r, RSB_VALNOTVALID);
 
 	/* don't mess with the lvb unless we're the new master */
-	if (!test_bit(RESFL_NEW_MASTER2, &r->res_flags))
+	if (!rsb_flag(r, RSB_NEW_MASTER2))
 		goto out;
 
 	if (!r->res_lvbptr) {
@@ -657,12 +657,12 @@ void dlm_recover_rsbs(struct dlm_ls *ls)
 	list_for_each_entry(r, &ls->ls_root_list, res_root_list) {
 		lock_rsb(r);
 		if (is_master(r)) {
-			if (test_bit(RESFL_RECOVER_CONVERT, &r->res_flags))
+			if (rsb_flag(r, RSB_RECOVER_CONVERT))
 				recover_conversion(r);
 			recover_lvb(r);
 			count++;
 		}
-		clear_bit(RESFL_RECOVER_CONVERT, &r->res_flags);
+		rsb_clear_flag(r, RSB_RECOVER_CONVERT);
 		unlock_rsb(r);
 	}
 	up_read(&ls->ls_root_sem);

--