kref_init(&dlm_debug->d_refcnt);
        INIT_LIST_HEAD(&dlm_debug->d_lockres_tracking);
        dlm_debug->d_locking_state = NULL;
+       dlm_debug->d_locking_filter = NULL;
+       dlm_debug->d_filter_secs = 0;
 out:
        return dlm_debug;
 }
        int i;
        char *lvb;
        struct ocfs2_lock_res *lockres = v;
+#ifdef CONFIG_OCFS2_FS_STATS
+       u64 now, last;
+       struct ocfs2_dlm_debug *dlm_debug =
+                       ((struct ocfs2_dlm_seq_priv *)m->private)->p_dlm_debug;
+#endif
 
        if (!lockres)
                return -EINVAL;
 
+#ifdef CONFIG_OCFS2_FS_STATS
+       if (dlm_debug->d_filter_secs) {
+               now = ktime_to_us(ktime_get_real());
+               if (lockres->l_lock_prmode.ls_last >
+                   lockres->l_lock_exmode.ls_last)
+                       last = lockres->l_lock_prmode.ls_last;
+               else
+                       last = lockres->l_lock_exmode.ls_last;
+               /*
+                * Use d_filter_secs field to filter lock resources dump,
+                * the default d_filter_secs(0) value filters nothing,
+                * otherwise, only dump the last N seconds active lock
+                * resources.
+                */
+               if (div_u64(now - last, 1000000) > dlm_debug->d_filter_secs)
+                       return 0;
+       }
+#endif
+
        seq_printf(m, "0x%x\t", OCFS2_DLM_DEBUG_STR_VERSION);
 
        if (lockres->l_type == OCFS2_LOCK_TYPE_DENTRY)
                goto out;
        }
 
+       dlm_debug->d_locking_filter = debugfs_create_u32("locking_filter",
+                                               0600,
+                                               osb->osb_debug_root,
+                                               &dlm_debug->d_filter_secs);
+       if (!dlm_debug->d_locking_filter) {
+               ret = -EINVAL;
+               mlog(ML_ERROR,
+                    "Unable to create locking filter debugfs file.\n");
+               goto out;
+       }
+
        ocfs2_get_dlm_debug(dlm_debug);
 out:
        return ret;
 
        if (dlm_debug) {
                debugfs_remove(dlm_debug->d_locking_state);
+               debugfs_remove(dlm_debug->d_locking_filter);
                ocfs2_put_dlm_debug(dlm_debug);
        }
 }