Commit f11722834605a155022a8098ad7d8adacf44b22f
1 parent
2318aa2720
Exists in
smarc-l5.0.0_1.0.0-ga
and in
5 other branches
dlm: avoid scanning unchanged toss lists
Keep track of whether a toss list contains any shrinkable rsbs. If not, dlm_scand can avoid scanning the list for rsbs to shrink. Unnecessary scanning can otherwise waste a lot of time because the toss lists can contain a large number of rsbs that are non-shrinkable (directory records). Signed-off-by: David Teigland <teigland@redhat.com>
Showing 2 changed files with 18 additions and 0 deletions Side-by-side Diff
fs/dlm/dlm_internal.h
fs/dlm/lock.c
... | ... | @@ -1132,6 +1132,7 @@ |
1132 | 1132 | rb_erase(&r->res_hashnode, &ls->ls_rsbtbl[r->res_bucket].keep); |
1133 | 1133 | rsb_insert(r, &ls->ls_rsbtbl[r->res_bucket].toss); |
1134 | 1134 | r->res_toss_time = jiffies; |
1135 | + ls->ls_rsbtbl[r->res_bucket].flags |= DLM_RTF_SHRINK; | |
1135 | 1136 | if (r->res_lvbptr) { |
1136 | 1137 | dlm_free_lvb(r->res_lvbptr); |
1137 | 1138 | r->res_lvbptr = NULL; |
1138 | 1139 | |
... | ... | @@ -1659,11 +1660,18 @@ |
1659 | 1660 | char *name; |
1660 | 1661 | int our_nodeid = dlm_our_nodeid(); |
1661 | 1662 | int remote_count = 0; |
1663 | + int need_shrink = 0; | |
1662 | 1664 | int i, len, rv; |
1663 | 1665 | |
1664 | 1666 | memset(&ls->ls_remove_lens, 0, sizeof(int) * DLM_REMOVE_NAMES_MAX); |
1665 | 1667 | |
1666 | 1668 | spin_lock(&ls->ls_rsbtbl[b].lock); |
1669 | + | |
1670 | + if (!(ls->ls_rsbtbl[b].flags & DLM_RTF_SHRINK)) { | |
1671 | + spin_unlock(&ls->ls_rsbtbl[b].lock); | |
1672 | + return; | |
1673 | + } | |
1674 | + | |
1667 | 1675 | for (n = rb_first(&ls->ls_rsbtbl[b].toss); n; n = next) { |
1668 | 1676 | next = rb_next(n); |
1669 | 1677 | r = rb_entry(n, struct dlm_rsb, res_hashnode); |
... | ... | @@ -1679,6 +1687,8 @@ |
1679 | 1687 | continue; |
1680 | 1688 | } |
1681 | 1689 | |
1690 | + need_shrink = 1; | |
1691 | + | |
1682 | 1692 | if (!time_after_eq(jiffies, r->res_toss_time + |
1683 | 1693 | dlm_config.ci_toss_secs * HZ)) { |
1684 | 1694 | continue; |
... | ... | @@ -1710,6 +1720,11 @@ |
1710 | 1720 | rb_erase(&r->res_hashnode, &ls->ls_rsbtbl[b].toss); |
1711 | 1721 | dlm_free_rsb(r); |
1712 | 1722 | } |
1723 | + | |
1724 | + if (need_shrink) | |
1725 | + ls->ls_rsbtbl[b].flags |= DLM_RTF_SHRINK; | |
1726 | + else | |
1727 | + ls->ls_rsbtbl[b].flags &= ~DLM_RTF_SHRINK; | |
1713 | 1728 | spin_unlock(&ls->ls_rsbtbl[b].lock); |
1714 | 1729 | |
1715 | 1730 | /* |