X-Git-Url: https://git.whamcloud.com/?p=fs%2Flustre-release.git;a=blobdiff_plain;f=lustre%2Fldlm%2Fldlm_internal.h;h=294ba722af0345802411541b9c923166c81ffbff;hp=741190aa538192abfdd1060a3b3d2c274da93adb;hb=710793eab04e08c5ce671cb99ed1b2db4baa333f;hpb=4ab9da2f75d10022f6f65626f1cbef6bd611dae8 diff --git a/lustre/ldlm/ldlm_internal.h b/lustre/ldlm/ldlm_internal.h index 741190aa..294ba72 100644 --- a/lustre/ldlm/ldlm_internal.h +++ b/lustre/ldlm/ldlm_internal.h @@ -47,6 +47,8 @@ int ldlm_cancel_lru(struct ldlm_namespace *ns, int nr, ldlm_sync_t sync, int flags); int ldlm_cancel_lru_local(struct ldlm_namespace *ns, struct list_head *cancels, int count, int max, int cancel_flags, int flags); +int ldlm_cancel_lru_estimate(struct ldlm_namespace *ns, int count, int max, + int flags); /* ldlm_resource.c */ int ldlm_resource_putref_locked(struct ldlm_resource *res); @@ -138,3 +140,46 @@ struct ldlm_state { int ldlm_init(void); void ldlm_exit(void); +enum ldlm_policy_res { + LDLM_POLICY_CANCEL_LOCK, + LDLM_POLICY_KEEP_LOCK +}; + +typedef enum ldlm_policy_res ldlm_policy_res_t; + +#define LDLM_POOL_PROC_READER(var, type) \ + static int lprocfs_rd_##var(char *page, char **start, off_t off, \ + int count, int *eof, void *data) \ + { \ + struct ldlm_pool *pl = data; \ + type tmp; \ + \ + spin_lock(&pl->pl_lock); \ + tmp = pl->pl_##var; \ + spin_unlock(&pl->pl_lock); \ + \ + return lprocfs_rd_uint(page, start, off, count, eof, &tmp); \ + } \ + struct __##var##__dummy_read {;} /* semicolon catcher */ + +#define LDLM_POOL_PROC_WRITER(var, type) \ + int lprocfs_wr_##var(struct file *file, const char *buffer, \ + unsigned long count, void *data) \ + { \ + struct ldlm_pool *pl = data; \ + type tmp; \ + int rc; \ + \ + rc = lprocfs_wr_uint(file, buffer, count, &tmp); \ + if (rc) { \ + CERROR("Can't parse user input, rc = %d\n", rc); \ + return rc; \ + } \ + \ + spin_lock(&pl->pl_lock); \ + pl->pl_##var = tmp; \ + spin_unlock(&pl->pl_lock); \ + \ + return rc; \ + } \ + struct __##var##__dummy_write {;} /* semicolon catcher */