dlm: remove lkb from callback tracepoints

Stop using lkb structs in the callback tracepoints so that lkb
references are not needed. This prepares for separating lkb
structs from callbacks.

Signed-off-by: Alexander Aring <aahringo@redhat.com>
Signed-off-by: David Teigland <teigland@redhat.com>
This commit is contained in:
Alexander Aring 2024-03-28 11:48:37 -04:00 committed by David Teigland
parent 609ed5bde2
commit 1131f33908
3 changed files with 33 additions and 31 deletions

View File

@ -171,6 +171,7 @@ void dlm_callback_work(struct work_struct *work)
{
struct dlm_lkb *lkb = container_of(work, struct dlm_lkb, lkb_cb_work);
struct dlm_ls *ls = lkb->lkb_resource->res_ls;
struct dlm_rsb *rsb = lkb->lkb_resource;
void (*castfn) (void *astparam);
void (*bastfn) (void *astparam, int mode);
struct dlm_callback *cb;
@ -190,14 +191,18 @@ void dlm_callback_work(struct work_struct *work)
bastfn = lkb->lkb_bastfn;
if (cb->flags & DLM_CB_BAST) {
trace_dlm_bast(ls, lkb, cb->mode);
trace_dlm_bast(ls->ls_global_id, lkb->lkb_id,
cb->mode, rsb->res_name,
rsb->res_length);
lkb->lkb_last_bast_time = ktime_get();
lkb->lkb_last_bast_mode = cb->mode;
bastfn(lkb->lkb_astparam, cb->mode);
} else if (cb->flags & DLM_CB_CAST) {
lkb->lkb_lksb->sb_status = cb->sb_status;
lkb->lkb_lksb->sb_flags = cb->sb_flags;
trace_dlm_ast(ls, lkb);
trace_dlm_ast(ls->ls_global_id, lkb->lkb_id,
cb->sb_flags, cb->sb_status,
rsb->res_name, rsb->res_length);
lkb->lkb_last_cast_time = ktime_get();
castfn(lkb->lkb_astparam);
}

View File

@ -805,6 +805,7 @@ static ssize_t device_read(struct file *file, char __user *buf, size_t count,
struct dlm_lkb *lkb;
DECLARE_WAITQUEUE(wait, current);
struct dlm_callback *cb;
struct dlm_rsb *rsb;
int rv, ret;
if (count == sizeof(struct dlm_device_version)) {
@ -887,12 +888,16 @@ static ssize_t device_read(struct file *file, char __user *buf, size_t count,
}
spin_unlock(&proc->asts_spin);
rsb = lkb->lkb_resource;
if (cb->flags & DLM_CB_BAST) {
trace_dlm_bast(lkb->lkb_resource->res_ls, lkb, cb->mode);
trace_dlm_bast(rsb->res_ls->ls_global_id, lkb->lkb_id,
cb->mode, rsb->res_name, rsb->res_length);
} else if (cb->flags & DLM_CB_CAST) {
lkb->lkb_lksb->sb_status = cb->sb_status;
lkb->lkb_lksb->sb_flags = cb->sb_flags;
trace_dlm_ast(lkb->lkb_resource->res_ls, lkb);
trace_dlm_ast(rsb->res_ls->ls_global_id, lkb->lkb_id,
cb->sb_flags, cb->sb_status, rsb->res_name,
rsb->res_length);
}
ret = copy_result_to_user(lkb->lkb_ua,

View File

@ -189,29 +189,25 @@ TRACE_EVENT(dlm_lock_end,
TRACE_EVENT(dlm_bast,
TP_PROTO(struct dlm_ls *ls, struct dlm_lkb *lkb, int mode),
TP_PROTO(__u32 ls_id, __u32 lkb_id, int mode,
const char *res_name, size_t res_length),
TP_ARGS(ls, lkb, mode),
TP_ARGS(ls_id, lkb_id, mode, res_name, res_length),
TP_STRUCT__entry(
__field(__u32, ls_id)
__field(__u32, lkb_id)
__field(int, mode)
__dynamic_array(unsigned char, res_name,
lkb->lkb_resource ? lkb->lkb_resource->res_length : 0)
__dynamic_array(unsigned char, res_name, res_length)
),
TP_fast_assign(
struct dlm_rsb *r;
__entry->ls_id = ls->ls_global_id;
__entry->lkb_id = lkb->lkb_id;
__entry->ls_id = ls_id;
__entry->lkb_id = lkb_id;
__entry->mode = mode;
r = lkb->lkb_resource;
if (r)
memcpy(__get_dynamic_array(res_name), r->res_name,
__get_dynamic_array_len(res_name));
memcpy(__get_dynamic_array(res_name), res_name,
__get_dynamic_array_len(res_name));
),
TP_printk("ls_id=%u lkb_id=%x mode=%s res_name=%s",
@ -224,31 +220,27 @@ TRACE_EVENT(dlm_bast,
TRACE_EVENT(dlm_ast,
TP_PROTO(struct dlm_ls *ls, struct dlm_lkb *lkb),
TP_PROTO(__u32 ls_id, __u32 lkb_id, __u8 sb_flags, int sb_status,
const char *res_name, size_t res_length),
TP_ARGS(ls, lkb),
TP_ARGS(ls_id, lkb_id, sb_flags, sb_status, res_name, res_length),
TP_STRUCT__entry(
__field(__u32, ls_id)
__field(__u32, lkb_id)
__field(u8, sb_flags)
__field(__u8, sb_flags)
__field(int, sb_status)
__dynamic_array(unsigned char, res_name,
lkb->lkb_resource ? lkb->lkb_resource->res_length : 0)
__dynamic_array(unsigned char, res_name, res_length)
),
TP_fast_assign(
struct dlm_rsb *r;
__entry->ls_id = ls_id;
__entry->lkb_id = lkb_id;
__entry->sb_flags = sb_flags;
__entry->sb_status = sb_status;
__entry->ls_id = ls->ls_global_id;
__entry->lkb_id = lkb->lkb_id;
__entry->sb_flags = lkb->lkb_lksb->sb_flags;
__entry->sb_status = lkb->lkb_lksb->sb_status;
r = lkb->lkb_resource;
if (r)
memcpy(__get_dynamic_array(res_name), r->res_name,
__get_dynamic_array_len(res_name));
memcpy(__get_dynamic_array(res_name), res_name,
__get_dynamic_array_len(res_name));
),
TP_printk("ls_id=%u lkb_id=%x sb_flags=%s sb_status=%d res_name=%s",