Commit 4f5957a9 authored by David Teigland's avatar David Teigland
Browse files

dlm: change list and timer names



The old terminology of "toss" and "keep" is no longer an
accurate description of the rsb states and lists, so change
the names to "inactive" and "active".  The old names had
also been copied into the scanning code, which is changed
back to use the "scan" name.

- "active" rsb structs have lkb's attached, and are ref counted.
- "inactive" rsb structs have no lkb's attached, are not ref counted.
- "scan" list is for rsb's that can be freed after a timeout period.
- "slow" lists are for infrequent iterations through active or
   inactive rsb structs.
- inactive rsb structs that are directory records will not be put
  on the scan list, since they are not freed based on timeouts.
- inactive rsb structs that are not directory records will be
  put on the scan list to be freed, since they are not longer needed.

Signed-off-by: default avatarDavid Teigland <teigland@redhat.com>
parent fa0b54f1
Loading
Loading
Loading
Loading
+5 −5
Original line number Diff line number Diff line
@@ -380,7 +380,7 @@ static const struct seq_operations format4_seq_ops;

static int table_seq_show(struct seq_file *seq, void *iter_ptr)
{
	struct dlm_rsb *rsb = list_entry(iter_ptr, struct dlm_rsb, res_rsbs_list);
	struct dlm_rsb *rsb = list_entry(iter_ptr, struct dlm_rsb, res_slow_list);

	if (seq->op == &format1_seq_ops)
		print_format1(rsb, seq);
@@ -409,9 +409,9 @@ static void *table_seq_start(struct seq_file *seq, loff_t *pos)
	}

	if (seq->op == &format4_seq_ops)
		list = &ls->ls_toss;
		list = &ls->ls_slow_inactive;
	else
		list = &ls->ls_keep;
		list = &ls->ls_slow_active;

	read_lock_bh(&ls->ls_rsbtbl_lock);
	return seq_list_start(list, *pos);
@@ -423,9 +423,9 @@ static void *table_seq_next(struct seq_file *seq, void *iter_ptr, loff_t *pos)
	struct list_head *list;

	if (seq->op == &format4_seq_ops)
		list = &ls->ls_toss;
		list = &ls->ls_slow_inactive;
	else
		list = &ls->ls_keep;
		list = &ls->ls_slow_active;

	return seq_list_next(iter_ptr, list, pos);
}
+12 −16
Original line number Diff line number Diff line
@@ -327,11 +327,11 @@ struct dlm_rsb {
	struct list_head	res_convertqueue;
	struct list_head	res_waitqueue;

	struct list_head	res_rsbs_list;
	struct list_head	res_slow_list;      /* ls_slow_* */
	struct list_head	res_scan_list;
	struct list_head	res_root_list;	    /* used for recovery */
	struct list_head	res_masters_list;   /* used for recovery */
	struct list_head	res_recover_list;   /* used for recovery */
	struct list_head	res_toss_q_list;
	int			res_recover_locks_count;

	char			*res_lvbptr;
@@ -365,7 +365,7 @@ enum rsb_flags {
	RSB_RECOVER_CONVERT,
	RSB_RECOVER_GRANT,
	RSB_RECOVER_LVB_INVAL,
	RSB_TOSS,
	RSB_INACTIVE,
};

static inline void rsb_set_flag(struct dlm_rsb *r, enum rsb_flags flag)
@@ -572,20 +572,16 @@ struct dlm_ls {
	struct xarray		ls_lkbxa;
	rwlock_t		ls_lkbxa_lock;

	/* an rsb is on rsbtl for primary locking functions,
	   and on a slow list for recovery/dump iteration  */
	struct rhashtable	ls_rsbtbl;
	rwlock_t		ls_rsbtbl_lock;
	rwlock_t		ls_rsbtbl_lock; /* for ls_rsbtbl and ls_slow */
	struct list_head	ls_slow_inactive; /* to iterate rsbtbl */
	struct list_head	ls_slow_active;   /* to iterate rsbtbl */

	struct list_head	ls_toss;
	struct list_head	ls_keep;

	struct timer_list	ls_timer;
	/* this queue is ordered according the
	 * absolute res_toss_time jiffies time
	 * to mod_timer() with the first element
	 * if necessary.
	 */
	struct list_head	ls_toss_q;
	spinlock_t		ls_toss_q_lock;
	struct timer_list	ls_scan_timer; /* based on first scan_list rsb toss_time */
	struct list_head	ls_scan_list;  /* rsbs ordered by res_toss_time */
	spinlock_t		ls_scan_lock;

	spinlock_t		ls_waiters_lock;
	struct list_head	ls_waiters;	/* lkbs needing a reply */
+140 −168

File changed.

Preview size limit exceeded, changes collapsed.

+3 −4
Original line number Diff line number Diff line
@@ -11,7 +11,6 @@
#ifndef __LOCK_DOT_H__
#define __LOCK_DOT_H__

void dlm_rsb_toss_timer(struct timer_list *timer);
void dlm_dump_rsb(struct dlm_rsb *r);
void dlm_dump_rsb_name(struct dlm_ls *ls, const char *name, int len);
void dlm_print_lkb(struct dlm_lkb *lkb);
@@ -19,15 +18,15 @@ void dlm_receive_message_saved(struct dlm_ls *ls, const struct dlm_message *ms,
			       uint32_t saved_seq);
void dlm_receive_buffer(const union dlm_packet *p, int nodeid);
int dlm_modes_compat(int mode1, int mode2);
void free_toss_rsb(struct dlm_rsb *r);
void free_inactive_rsb(struct dlm_rsb *r);
void dlm_put_rsb(struct dlm_rsb *r);
void dlm_hold_rsb(struct dlm_rsb *r);
int dlm_put_lkb(struct dlm_lkb *lkb);
void dlm_scan_rsbs(struct dlm_ls *ls);
int dlm_lock_recovery_try(struct dlm_ls *ls);
void dlm_lock_recovery(struct dlm_ls *ls);
void dlm_unlock_recovery(struct dlm_ls *ls);
void dlm_timer_resume(struct dlm_ls *ls);
void dlm_rsb_scan(struct timer_list *timer);
void resume_scan_timer(struct dlm_ls *ls);

int dlm_master_lookup(struct dlm_ls *ls, int from_nodeid, const char *name,
		      int len, unsigned int flags, int *r_nodeid, int *result);
+6 −7
Original line number Diff line number Diff line
@@ -412,8 +412,8 @@ static int new_lockspace(const char *name, const char *cluster,
	 */
	ls->ls_exflags = (flags & ~(DLM_LSFL_FS | DLM_LSFL_NEWEXCL));

	INIT_LIST_HEAD(&ls->ls_toss);
	INIT_LIST_HEAD(&ls->ls_keep);
	INIT_LIST_HEAD(&ls->ls_slow_inactive);
	INIT_LIST_HEAD(&ls->ls_slow_active);
	rwlock_init(&ls->ls_rsbtbl_lock);

	error = rhashtable_init(&ls->ls_rsbtbl, &dlm_rhash_rsb_params);
@@ -490,10 +490,9 @@ static int new_lockspace(const char *name, const char *cluster,
	INIT_LIST_HEAD(&ls->ls_dir_dump_list);
	rwlock_init(&ls->ls_dir_dump_lock);

	INIT_LIST_HEAD(&ls->ls_toss_q);
	spin_lock_init(&ls->ls_toss_q_lock);
	timer_setup(&ls->ls_timer, dlm_rsb_toss_timer,
		    TIMER_DEFERRABLE);
	INIT_LIST_HEAD(&ls->ls_scan_list);
	spin_lock_init(&ls->ls_scan_lock);
	timer_setup(&ls->ls_scan_timer, dlm_rsb_scan, TIMER_DEFERRABLE);

	spin_lock_bh(&lslist_lock);
	ls->ls_create_count = 1;
@@ -723,7 +722,7 @@ static int release_lockspace(struct dlm_ls *ls, int force)
	 * time_shutdown_sync(), we don't care anymore
	 */
	clear_bit(LSFL_RUNNING, &ls->ls_flags);
	timer_shutdown_sync(&ls->ls_timer);
	timer_shutdown_sync(&ls->ls_scan_timer);

	if (ls_count == 1) {
		dlm_clear_members(ls);
Loading