static int lprocfs_elc_seq_show(struct seq_file *m, void *v) { struct ldlm_namespace *ns = m->private; unsigned int supp = ns_connect_cancelset(ns); return lprocfs_rd_uint(m, &supp); }
/* Find and cancel locally locks matched by inode @bits & @mode in the resource * found by @fid. Found locks are added into @cancel list. Returns the amount of * locks added to @cancels list. */ int mdc_resource_get_unused(struct obd_export *exp, const struct lu_fid *fid, struct list_head *cancels, enum ldlm_mode mode, __u64 bits) { struct ldlm_namespace *ns = exp->exp_obd->obd_namespace; union ldlm_policy_data policy = { {0} }; struct ldlm_res_id res_id; struct ldlm_resource *res; int count; ENTRY; /* Return, i.e. cancel nothing, only if ELC is supported (flag in * export) but disabled through procfs (flag in NS). * * This distinguishes from a case when ELC is not supported originally, * when we still want to cancel locks in advance and just cancel them * locally, without sending any RPC. */ if (exp_connect_cancelset(exp) && !ns_connect_cancelset(ns)) RETURN(0); fid_build_reg_res_name(fid, &res_id); res = ldlm_resource_get(exp->exp_obd->obd_namespace, NULL, &res_id, 0, 0); if (IS_ERR(res)) RETURN(0); LDLM_RESOURCE_ADDREF(res); /* Initialize ibits lock policy. */ policy.l_inodebits.bits = bits; count = ldlm_cancel_resource_local(res, cancels, &policy, mode, 0, 0, NULL); LDLM_RESOURCE_DELREF(res); ldlm_resource_putref(res); RETURN(count); }
static int lprocfs_rd_elc(char *page, char **start, off_t off, int count, int *eof, void *data) { struct ldlm_namespace *ns = data; unsigned int supp = ns_connect_cancelset(ns); return lprocfs_rd_uint(page, start, off, count, eof, &supp); }
static ssize_t early_lock_cancel_show(struct kobject *kobj, struct attribute *attr, char *buf) { struct ldlm_namespace *ns = container_of(kobj, struct ldlm_namespace, ns_kobj); return sprintf(buf, "%d\n", ns_connect_cancelset(ns)); }