Skip to content

Commit b1f2381

Browse files
Alexander Aringteigland
authored andcommitted
dlm: drop dlm_scand kthread and use timers
Currently the scand kthread acts like a garbage collection for expired rsbs on toss list, to clean them up after a certain timeout. It triggers every couple of seconds and iterates over the toss list while holding ls_rsbtbl_lock for the whole hash bucket iteration. To reduce the amount of time holding ls_rsbtbl_lock, we now handle the disposal of expired rsbs using a per-lockspace timer that expires for the earliest tossed rsb on the lockspace toss queue. This toss queue is ordered according to the rsb res_toss_time with the earliest tossed rsb as the first entry. The toss timer will only trylock() necessary locks, since it is low priority garbage collection, and will rearm the timer if trylock() fails. If the timer function does not find any expired rsb's, it rearms the timer with the next earliest expired rsb. Signed-off-by: Alexander Aring <[email protected]> Signed-off-by: David Teigland <[email protected]>
1 parent 6644925 commit b1f2381

File tree

7 files changed

+283
-239
lines changed

7 files changed

+283
-239
lines changed

fs/dlm/dlm_internal.h

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -334,6 +334,7 @@ struct dlm_rsb {
334334
struct list_head res_root_list; /* used for recovery */
335335
struct list_head res_masters_list; /* used for recovery */
336336
struct list_head res_recover_list; /* used for recovery */
337+
struct list_head res_toss_q_list;
337338
int res_recover_locks_count;
338339

339340
char *res_lvbptr;
@@ -584,13 +585,20 @@ struct dlm_ls {
584585
spinlock_t ls_lkbidr_spin;
585586

586587
struct rhashtable ls_rsbtbl;
587-
#define DLM_RTF_SHRINK_BIT 0
588-
unsigned long ls_rsbtbl_flags;
589588
spinlock_t ls_rsbtbl_lock;
590589

591590
struct list_head ls_toss;
592591
struct list_head ls_keep;
593592

593+
struct timer_list ls_timer;
594+
/* this queue is ordered according the
595+
* absolute res_toss_time jiffies time
596+
* to mod_timer() with the first element
597+
* if necessary.
598+
*/
599+
struct list_head ls_toss_q;
600+
spinlock_t ls_toss_q_lock;
601+
594602
spinlock_t ls_waiters_lock;
595603
struct list_head ls_waiters; /* lkbs needing a reply */
596604

@@ -601,9 +609,6 @@ struct dlm_ls {
601609
int ls_new_rsb_count;
602610
struct list_head ls_new_rsb; /* new rsb structs */
603611

604-
char *ls_remove_names[DLM_REMOVE_NAMES_MAX];
605-
int ls_remove_lens[DLM_REMOVE_NAMES_MAX];
606-
607612
struct list_head ls_nodes; /* current nodes in ls */
608613
struct list_head ls_nodes_gone; /* dead node list, recovery */
609614
int ls_num_nodes; /* number of nodes in ls */
@@ -640,7 +645,6 @@ struct dlm_ls {
640645

641646
spinlock_t ls_cb_lock;
642647
struct list_head ls_cb_delay; /* save for queue_work later */
643-
struct timer_list ls_timer;
644648
struct task_struct *ls_recoverd_task;
645649
struct mutex ls_recoverd_active;
646650
spinlock_t ls_recover_lock;

0 commit comments

Comments
 (0)