Commit a763e916 authored by Jinshan Xiong's avatar Jinshan Xiong Committed by Greg Kroah-Hartman

staging/lustre: Get rid of cl_env hash table

cl_env hash table is under heavy contention when there are lots of
processes doing IO at the same time;
reduce lock contention by replacing cl_env cache with percpu array;
remove cl_env_nested_get() and cl_env_nested_put();
remove cl_env_reenter() and cl_env_reexit();
Signed-off-by: default avatarJinshan Xiong <jinshan.xiong@intel.com>
Reviewed-on: http://review.whamcloud.com/20254
Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-4257Reviewed-by: default avatarAndreas Dilger <andreas.dilger@intel.com>
Reviewed-by: default avatarBobi Jam <bobijam@hotmail.com>
Signed-off-by: default avatarOleg Drokin <green@linuxhacker.ru>
Reviewed-by: default avatarJames Simmons <jsimmons@infradead.org>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 2d8c919e
...@@ -2640,35 +2640,13 @@ void cl_sync_io_end(const struct lu_env *env, struct cl_sync_io *anchor); ...@@ -2640,35 +2640,13 @@ void cl_sync_io_end(const struct lu_env *env, struct cl_sync_io *anchor);
* - allocation and destruction of environment is amortized by caching no * - allocation and destruction of environment is amortized by caching no
* longer used environments instead of destroying them; * longer used environments instead of destroying them;
* *
* - there is a notion of "current" environment, attached to the kernel
* data structure representing current thread Top-level lustre code
* allocates an environment and makes it current, then calls into
* non-lustre code, that in turn calls lustre back. Low-level lustre
* code thus called can fetch environment created by the top-level code
* and reuse it, avoiding additional environment allocation.
* Right now, three interfaces can attach the cl_env to running thread:
* - cl_env_get
* - cl_env_implant
* - cl_env_reexit(cl_env_reenter had to be called priorly)
*
* \see lu_env, lu_context, lu_context_key * \see lu_env, lu_context, lu_context_key
* @{ * @{
*/ */
struct cl_env_nest {
int cen_refcheck;
void *cen_cookie;
};
struct lu_env *cl_env_get(int *refcheck); struct lu_env *cl_env_get(int *refcheck);
struct lu_env *cl_env_alloc(int *refcheck, __u32 tags); struct lu_env *cl_env_alloc(int *refcheck, __u32 tags);
struct lu_env *cl_env_nested_get(struct cl_env_nest *nest);
void cl_env_put(struct lu_env *env, int *refcheck); void cl_env_put(struct lu_env *env, int *refcheck);
void cl_env_nested_put(struct cl_env_nest *nest, struct lu_env *env);
void *cl_env_reenter(void);
void cl_env_reexit(void *cookie);
void cl_env_implant(struct lu_env *env, int *refcheck);
void cl_env_unplant(struct lu_env *env, int *refcheck);
unsigned int cl_env_cache_purge(unsigned int nr); unsigned int cl_env_cache_purge(unsigned int nr);
struct lu_env *cl_env_percpu_get(void); struct lu_env *cl_env_percpu_get(void);
void cl_env_percpu_put(struct lu_env *env); void cl_env_percpu_put(struct lu_env *env);
......
...@@ -794,7 +794,6 @@ static unsigned long ldlm_pools_count(ldlm_side_t client, gfp_t gfp_mask) ...@@ -794,7 +794,6 @@ static unsigned long ldlm_pools_count(ldlm_side_t client, gfp_t gfp_mask)
int nr_ns; int nr_ns;
struct ldlm_namespace *ns; struct ldlm_namespace *ns;
struct ldlm_namespace *ns_old = NULL; /* loop detection */ struct ldlm_namespace *ns_old = NULL; /* loop detection */
void *cookie;
if (client == LDLM_NAMESPACE_CLIENT && !(gfp_mask & __GFP_FS)) if (client == LDLM_NAMESPACE_CLIENT && !(gfp_mask & __GFP_FS))
return 0; return 0;
...@@ -802,8 +801,6 @@ static unsigned long ldlm_pools_count(ldlm_side_t client, gfp_t gfp_mask) ...@@ -802,8 +801,6 @@ static unsigned long ldlm_pools_count(ldlm_side_t client, gfp_t gfp_mask)
CDEBUG(D_DLMTRACE, "Request to count %s locks from all pools\n", CDEBUG(D_DLMTRACE, "Request to count %s locks from all pools\n",
client == LDLM_NAMESPACE_CLIENT ? "client" : "server"); client == LDLM_NAMESPACE_CLIENT ? "client" : "server");
cookie = cl_env_reenter();
/* /*
* Find out how many resources we may release. * Find out how many resources we may release.
*/ */
...@@ -812,7 +809,6 @@ static unsigned long ldlm_pools_count(ldlm_side_t client, gfp_t gfp_mask) ...@@ -812,7 +809,6 @@ static unsigned long ldlm_pools_count(ldlm_side_t client, gfp_t gfp_mask)
mutex_lock(ldlm_namespace_lock(client)); mutex_lock(ldlm_namespace_lock(client));
if (list_empty(ldlm_namespace_list(client))) { if (list_empty(ldlm_namespace_list(client))) {
mutex_unlock(ldlm_namespace_lock(client)); mutex_unlock(ldlm_namespace_lock(client));
cl_env_reexit(cookie);
return 0; return 0;
} }
ns = ldlm_namespace_first_locked(client); ns = ldlm_namespace_first_locked(client);
...@@ -838,7 +834,6 @@ static unsigned long ldlm_pools_count(ldlm_side_t client, gfp_t gfp_mask) ...@@ -838,7 +834,6 @@ static unsigned long ldlm_pools_count(ldlm_side_t client, gfp_t gfp_mask)
ldlm_namespace_put(ns); ldlm_namespace_put(ns);
} }
cl_env_reexit(cookie);
return total; return total;
} }
...@@ -847,13 +842,10 @@ static unsigned long ldlm_pools_scan(ldlm_side_t client, int nr, gfp_t gfp_mask) ...@@ -847,13 +842,10 @@ static unsigned long ldlm_pools_scan(ldlm_side_t client, int nr, gfp_t gfp_mask)
unsigned long freed = 0; unsigned long freed = 0;
int tmp, nr_ns; int tmp, nr_ns;
struct ldlm_namespace *ns; struct ldlm_namespace *ns;
void *cookie;
if (client == LDLM_NAMESPACE_CLIENT && !(gfp_mask & __GFP_FS)) if (client == LDLM_NAMESPACE_CLIENT && !(gfp_mask & __GFP_FS))
return -1; return -1;
cookie = cl_env_reenter();
/* /*
* Shrink at least ldlm_namespace_nr_read(client) namespaces. * Shrink at least ldlm_namespace_nr_read(client) namespaces.
*/ */
...@@ -883,7 +875,6 @@ static unsigned long ldlm_pools_scan(ldlm_side_t client, int nr, gfp_t gfp_mask) ...@@ -883,7 +875,6 @@ static unsigned long ldlm_pools_scan(ldlm_side_t client, int nr, gfp_t gfp_mask)
freed += ldlm_pool_shrink(&ns->ns_pool, cancel, gfp_mask); freed += ldlm_pool_shrink(&ns->ns_pool, cancel, gfp_mask);
ldlm_namespace_put(ns); ldlm_namespace_put(ns);
} }
cl_env_reexit(cookie);
/* /*
* we only decrease the SLV in server pools shrinker, return * we only decrease the SLV in server pools shrinker, return
* SHRINK_STOP to kernel to avoid needless loop. LU-1128 * SHRINK_STOP to kernel to avoid needless loop. LU-1128
......
...@@ -1584,11 +1584,11 @@ int ll_data_version(struct inode *inode, __u64 *data_version, int flags) ...@@ -1584,11 +1584,11 @@ int ll_data_version(struct inode *inode, __u64 *data_version, int flags)
*/ */
int ll_hsm_release(struct inode *inode) int ll_hsm_release(struct inode *inode)
{ {
struct cl_env_nest nest;
struct lu_env *env; struct lu_env *env;
struct obd_client_handle *och = NULL; struct obd_client_handle *och = NULL;
__u64 data_version = 0; __u64 data_version = 0;
int rc; int rc;
int refcheck;
CDEBUG(D_INODE, "%s: Releasing file "DFID".\n", CDEBUG(D_INODE, "%s: Releasing file "DFID".\n",
ll_get_fsname(inode->i_sb, NULL, 0), ll_get_fsname(inode->i_sb, NULL, 0),
...@@ -1605,14 +1605,14 @@ int ll_hsm_release(struct inode *inode) ...@@ -1605,14 +1605,14 @@ int ll_hsm_release(struct inode *inode)
if (rc != 0) if (rc != 0)
goto out; goto out;
env = cl_env_nested_get(&nest); env = cl_env_get(&refcheck);
if (IS_ERR(env)) { if (IS_ERR(env)) {
rc = PTR_ERR(env); rc = PTR_ERR(env);
goto out; goto out;
} }
ll_merge_attr(env, inode); ll_merge_attr(env, inode);
cl_env_nested_put(&nest, env); cl_env_put(env, &refcheck);
/* Release the file. /* Release the file.
* NB: lease lock handle is released in mdc_hsm_release_pack() because * NB: lease lock handle is released in mdc_hsm_release_pack() because
...@@ -2268,17 +2268,17 @@ static int ll_flush(struct file *file, fl_owner_t id) ...@@ -2268,17 +2268,17 @@ static int ll_flush(struct file *file, fl_owner_t id)
int cl_sync_file_range(struct inode *inode, loff_t start, loff_t end, int cl_sync_file_range(struct inode *inode, loff_t start, loff_t end,
enum cl_fsync_mode mode, int ignore_layout) enum cl_fsync_mode mode, int ignore_layout)
{ {
struct cl_env_nest nest;
struct lu_env *env; struct lu_env *env;
struct cl_io *io; struct cl_io *io;
struct cl_fsync_io *fio; struct cl_fsync_io *fio;
int result; int result;
int refcheck;
if (mode != CL_FSYNC_NONE && mode != CL_FSYNC_LOCAL && if (mode != CL_FSYNC_NONE && mode != CL_FSYNC_LOCAL &&
mode != CL_FSYNC_DISCARD && mode != CL_FSYNC_ALL) mode != CL_FSYNC_DISCARD && mode != CL_FSYNC_ALL)
return -EINVAL; return -EINVAL;
env = cl_env_nested_get(&nest); env = cl_env_get(&refcheck);
if (IS_ERR(env)) if (IS_ERR(env))
return PTR_ERR(env); return PTR_ERR(env);
...@@ -2301,7 +2301,7 @@ int cl_sync_file_range(struct inode *inode, loff_t start, loff_t end, ...@@ -2301,7 +2301,7 @@ int cl_sync_file_range(struct inode *inode, loff_t start, loff_t end,
if (result == 0) if (result == 0)
result = fio->fi_nr_written; result = fio->fi_nr_written;
cl_io_fini(env, io); cl_io_fini(env, io);
cl_env_nested_put(&nest, env); cl_env_put(env, &refcheck);
return result; return result;
} }
...@@ -3149,14 +3149,14 @@ int ll_layout_conf(struct inode *inode, const struct cl_object_conf *conf) ...@@ -3149,14 +3149,14 @@ int ll_layout_conf(struct inode *inode, const struct cl_object_conf *conf)
{ {
struct ll_inode_info *lli = ll_i2info(inode); struct ll_inode_info *lli = ll_i2info(inode);
struct cl_object *obj = lli->lli_clob; struct cl_object *obj = lli->lli_clob;
struct cl_env_nest nest;
struct lu_env *env; struct lu_env *env;
int rc; int rc;
int refcheck;
if (!obj) if (!obj)
return 0; return 0;
env = cl_env_nested_get(&nest); env = cl_env_get(&refcheck);
if (IS_ERR(env)) if (IS_ERR(env))
return PTR_ERR(env); return PTR_ERR(env);
...@@ -3190,7 +3190,7 @@ int ll_layout_conf(struct inode *inode, const struct cl_object_conf *conf) ...@@ -3190,7 +3190,7 @@ int ll_layout_conf(struct inode *inode, const struct cl_object_conf *conf)
ll_layout_version_set(lli, cl.cl_layout_gen); ll_layout_version_set(lli, cl.cl_layout_gen);
} }
out: out:
cl_env_nested_put(&nest, env); cl_env_put(env, &refcheck);
return rc; return rc;
} }
......
...@@ -246,15 +246,11 @@ void cl_inode_fini(struct inode *inode) ...@@ -246,15 +246,11 @@ void cl_inode_fini(struct inode *inode)
int emergency; int emergency;
if (clob) { if (clob) {
void *cookie;
cookie = cl_env_reenter();
env = cl_env_get(&refcheck); env = cl_env_get(&refcheck);
emergency = IS_ERR(env); emergency = IS_ERR(env);
if (emergency) { if (emergency) {
mutex_lock(&cl_inode_fini_guard); mutex_lock(&cl_inode_fini_guard);
LASSERT(cl_inode_fini_env); LASSERT(cl_inode_fini_env);
cl_env_implant(cl_inode_fini_env, &refcheck);
env = cl_inode_fini_env; env = cl_inode_fini_env;
} }
/* /*
...@@ -266,13 +262,10 @@ void cl_inode_fini(struct inode *inode) ...@@ -266,13 +262,10 @@ void cl_inode_fini(struct inode *inode)
lu_object_ref_del(&clob->co_lu, "inode", inode); lu_object_ref_del(&clob->co_lu, "inode", inode);
cl_object_put_last(env, clob); cl_object_put_last(env, clob);
lli->lli_clob = NULL; lli->lli_clob = NULL;
if (emergency) { if (emergency)
cl_env_unplant(cl_inode_fini_env, &refcheck);
mutex_unlock(&cl_inode_fini_guard); mutex_unlock(&cl_inode_fini_guard);
} else { else
cl_env_put(env, &refcheck); cl_env_put(env, &refcheck);
}
cl_env_reexit(cookie);
} }
} }
......
...@@ -162,13 +162,11 @@ int cl_get_grouplock(struct cl_object *obj, unsigned long gid, int nonblock, ...@@ -162,13 +162,11 @@ int cl_get_grouplock(struct cl_object *obj, unsigned long gid, int nonblock,
return rc; return rc;
} }
cg->lg_env = cl_env_get(&refcheck); cg->lg_env = env;
cg->lg_io = io; cg->lg_io = io;
cg->lg_lock = lock; cg->lg_lock = lock;
cg->lg_gid = gid; cg->lg_gid = gid;
LASSERT(cg->lg_env == env);
cl_env_unplant(env, &refcheck);
return 0; return 0;
} }
...@@ -177,14 +175,10 @@ void cl_put_grouplock(struct ll_grouplock *cg) ...@@ -177,14 +175,10 @@ void cl_put_grouplock(struct ll_grouplock *cg)
struct lu_env *env = cg->lg_env; struct lu_env *env = cg->lg_env;
struct cl_io *io = cg->lg_io; struct cl_io *io = cg->lg_io;
struct cl_lock *lock = cg->lg_lock; struct cl_lock *lock = cg->lg_lock;
int refcheck;
LASSERT(cg->lg_env); LASSERT(cg->lg_env);
LASSERT(cg->lg_gid); LASSERT(cg->lg_gid);
cl_env_implant(env, &refcheck);
cl_env_put(env, &refcheck);
cl_lock_release(env, lock); cl_lock_release(env, lock);
cl_io_fini(env, io); cl_io_fini(env, io);
cl_env_put(env, NULL); cl_env_put(env, NULL);
......
...@@ -80,43 +80,24 @@ struct vm_area_struct *our_vma(struct mm_struct *mm, unsigned long addr, ...@@ -80,43 +80,24 @@ struct vm_area_struct *our_vma(struct mm_struct *mm, unsigned long addr,
* API independent part for page fault initialization. * API independent part for page fault initialization.
* \param vma - virtual memory area addressed to page fault * \param vma - virtual memory area addressed to page fault
* \param env - corespondent lu_env to processing * \param env - corespondent lu_env to processing
* \param nest - nested level
* \param index - page index corespondent to fault. * \param index - page index corespondent to fault.
* \parm ra_flags - vma readahead flags. * \parm ra_flags - vma readahead flags.
* *
* \return allocated and initialized env for fault operation. * \return error codes from cl_io_init.
* \retval EINVAL if env can't allocated
* \return other error codes from cl_io_init.
*/ */
static struct cl_io * static struct cl_io *
ll_fault_io_init(struct vm_area_struct *vma, struct lu_env **env_ret, ll_fault_io_init(struct lu_env *env, struct vm_area_struct *vma,
struct cl_env_nest *nest, pgoff_t index, pgoff_t index, unsigned long *ra_flags)
unsigned long *ra_flags)
{ {
struct file *file = vma->vm_file; struct file *file = vma->vm_file;
struct inode *inode = file_inode(file); struct inode *inode = file_inode(file);
struct cl_io *io; struct cl_io *io;
struct cl_fault_io *fio; struct cl_fault_io *fio;
struct lu_env *env;
int rc; int rc;
*env_ret = NULL;
if (ll_file_nolock(file)) if (ll_file_nolock(file))
return ERR_PTR(-EOPNOTSUPP); return ERR_PTR(-EOPNOTSUPP);
/*
* page fault can be called when lustre IO is
* already active for the current thread, e.g., when doing read/write
* against user level buffer mapped from Lustre buffer. To avoid
* stomping on existing context, optionally force an allocation of a new
* one.
*/
env = cl_env_nested_get(nest);
if (IS_ERR(env))
return ERR_PTR(-EINVAL);
*env_ret = env;
restart: restart:
io = vvp_env_thread_io(env); io = vvp_env_thread_io(env);
io->ci_obj = ll_i2info(inode)->lli_clob; io->ci_obj = ll_i2info(inode)->lli_clob;
...@@ -155,7 +136,6 @@ ll_fault_io_init(struct vm_area_struct *vma, struct lu_env **env_ret, ...@@ -155,7 +136,6 @@ ll_fault_io_init(struct vm_area_struct *vma, struct lu_env **env_ret,
if (io->ci_need_restart) if (io->ci_need_restart)
goto restart; goto restart;
cl_env_nested_put(nest, env);
io = ERR_PTR(rc); io = ERR_PTR(rc);
} }
...@@ -169,13 +149,17 @@ static int ll_page_mkwrite0(struct vm_area_struct *vma, struct page *vmpage, ...@@ -169,13 +149,17 @@ static int ll_page_mkwrite0(struct vm_area_struct *vma, struct page *vmpage,
struct lu_env *env; struct lu_env *env;
struct cl_io *io; struct cl_io *io;
struct vvp_io *vio; struct vvp_io *vio;
struct cl_env_nest nest;
int result; int result;
int refcheck;
sigset_t set; sigset_t set;
struct inode *inode; struct inode *inode;
struct ll_inode_info *lli; struct ll_inode_info *lli;
io = ll_fault_io_init(vma, &env, &nest, vmpage->index, NULL); env = cl_env_get(&refcheck);
if (IS_ERR(env))
return PTR_ERR(env);
io = ll_fault_io_init(env, vma, vmpage->index, NULL);
if (IS_ERR(io)) { if (IS_ERR(io)) {
result = PTR_ERR(io); result = PTR_ERR(io);
goto out; goto out;
...@@ -240,8 +224,8 @@ static int ll_page_mkwrite0(struct vm_area_struct *vma, struct page *vmpage, ...@@ -240,8 +224,8 @@ static int ll_page_mkwrite0(struct vm_area_struct *vma, struct page *vmpage,
out_io: out_io:
cl_io_fini(env, io); cl_io_fini(env, io);
cl_env_nested_put(&nest, env);
out: out:
cl_env_put(env, &refcheck);
CDEBUG(D_MMAP, "%s mkwrite with %d\n", current->comm, result); CDEBUG(D_MMAP, "%s mkwrite with %d\n", current->comm, result);
LASSERT(ergo(result == 0, PageLocked(vmpage))); LASSERT(ergo(result == 0, PageLocked(vmpage)));
...@@ -285,13 +269,19 @@ static int ll_fault0(struct vm_area_struct *vma, struct vm_fault *vmf) ...@@ -285,13 +269,19 @@ static int ll_fault0(struct vm_area_struct *vma, struct vm_fault *vmf)
struct vvp_io *vio = NULL; struct vvp_io *vio = NULL;
struct page *vmpage; struct page *vmpage;
unsigned long ra_flags; unsigned long ra_flags;
struct cl_env_nest nest; int result = 0;
int result;
int fault_ret = 0; int fault_ret = 0;
int refcheck;
io = ll_fault_io_init(vma, &env, &nest, vmf->pgoff, &ra_flags); env = cl_env_get(&refcheck);
if (IS_ERR(io)) if (IS_ERR(env))
return to_fault_error(PTR_ERR(io)); return PTR_ERR(env);
io = ll_fault_io_init(env, vma, vmf->pgoff, &ra_flags);
if (IS_ERR(io)) {
result = to_fault_error(PTR_ERR(io));
goto out;
}
result = io->ci_result; result = io->ci_result;
if (result == 0) { if (result == 0) {
...@@ -322,14 +312,15 @@ static int ll_fault0(struct vm_area_struct *vma, struct vm_fault *vmf) ...@@ -322,14 +312,15 @@ static int ll_fault0(struct vm_area_struct *vma, struct vm_fault *vmf)
} }
} }
cl_io_fini(env, io); cl_io_fini(env, io);
cl_env_nested_put(&nest, env);
vma->vm_flags |= ra_flags; vma->vm_flags |= ra_flags;
out:
cl_env_put(env, &refcheck);
if (result != 0 && !(fault_ret & VM_FAULT_RETRY)) if (result != 0 && !(fault_ret & VM_FAULT_RETRY))
fault_ret |= to_fault_error(result); fault_ret |= to_fault_error(result);
CDEBUG(D_MMAP, "%s fault %d/%d\n", CDEBUG(D_MMAP, "%s fault %d/%d\n", current->comm, fault_ret, result);
current->comm, fault_ret, result);
return fault_ret; return fault_ret;
} }
......
...@@ -896,17 +896,17 @@ int ll_writepage(struct page *vmpage, struct writeback_control *wbc) ...@@ -896,17 +896,17 @@ int ll_writepage(struct page *vmpage, struct writeback_control *wbc)
struct cl_io *io; struct cl_io *io;
struct cl_page *page; struct cl_page *page;
struct cl_object *clob; struct cl_object *clob;
struct cl_env_nest nest;
bool redirtied = false; bool redirtied = false;
bool unlocked = false; bool unlocked = false;
int result; int result;
int refcheck;
LASSERT(PageLocked(vmpage)); LASSERT(PageLocked(vmpage));
LASSERT(!PageWriteback(vmpage)); LASSERT(!PageWriteback(vmpage));
LASSERT(ll_i2dtexp(inode)); LASSERT(ll_i2dtexp(inode));
env = cl_env_nested_get(&nest); env = cl_env_get(&refcheck);
if (IS_ERR(env)) { if (IS_ERR(env)) {
result = PTR_ERR(env); result = PTR_ERR(env);
goto out; goto out;
...@@ -971,7 +971,7 @@ int ll_writepage(struct page *vmpage, struct writeback_control *wbc) ...@@ -971,7 +971,7 @@ int ll_writepage(struct page *vmpage, struct writeback_control *wbc)
} }
} }
cl_env_nested_put(&nest, env); cl_env_put(env, &refcheck);
goto out; goto out;
out: out:
......
...@@ -103,7 +103,6 @@ static void ll_invalidatepage(struct page *vmpage, unsigned int offset, ...@@ -103,7 +103,6 @@ static void ll_invalidatepage(struct page *vmpage, unsigned int offset,
static int ll_releasepage(struct page *vmpage, gfp_t gfp_mask) static int ll_releasepage(struct page *vmpage, gfp_t gfp_mask)
{ {
struct lu_env *env; struct lu_env *env;
void *cookie;
struct cl_object *obj; struct cl_object *obj;
struct cl_page *page; struct cl_page *page;
struct address_space *mapping; struct address_space *mapping;
...@@ -129,7 +128,6 @@ static int ll_releasepage(struct page *vmpage, gfp_t gfp_mask) ...@@ -129,7 +128,6 @@ static int ll_releasepage(struct page *vmpage, gfp_t gfp_mask)
if (!page) if (!page)
return 1; return 1;
cookie = cl_env_reenter();
env = cl_env_percpu_get(); env = cl_env_percpu_get();
LASSERT(!IS_ERR(env)); LASSERT(!IS_ERR(env));
...@@ -155,7 +153,6 @@ static int ll_releasepage(struct page *vmpage, gfp_t gfp_mask) ...@@ -155,7 +153,6 @@ static int ll_releasepage(struct page *vmpage, gfp_t gfp_mask)
cl_page_put(env, page); cl_page_put(env, page);
cl_env_percpu_put(env); cl_env_percpu_put(env);
cl_env_reexit(cookie);
return result; return result;
} }
...@@ -340,7 +337,8 @@ static ssize_t ll_direct_IO_26_seg(const struct lu_env *env, struct cl_io *io, ...@@ -340,7 +337,8 @@ static ssize_t ll_direct_IO_26_seg(const struct lu_env *env, struct cl_io *io,
PAGE_SIZE) & ~(DT_MAX_BRW_SIZE - 1)) PAGE_SIZE) & ~(DT_MAX_BRW_SIZE - 1))
static ssize_t ll_direct_IO_26(struct kiocb *iocb, struct iov_iter *iter) static ssize_t ll_direct_IO_26(struct kiocb *iocb, struct iov_iter *iter)
{ {
struct lu_env *env; struct ll_cl_context *lcc;
const struct lu_env *env;
struct cl_io *io; struct cl_io *io;
struct file *file = iocb->ki_filp; struct file *file = iocb->ki_filp;
struct inode *inode = file->f_mapping->host; struct inode *inode = file->f_mapping->host;
...@@ -348,7 +346,6 @@ static ssize_t ll_direct_IO_26(struct kiocb *iocb, struct iov_iter *iter) ...@@ -348,7 +346,6 @@ static ssize_t ll_direct_IO_26(struct kiocb *iocb, struct iov_iter *iter)
ssize_t count = iov_iter_count(iter); ssize_t count = iov_iter_count(iter);
ssize_t tot_bytes = 0, result = 0; ssize_t tot_bytes = 0, result = 0;
long size = MAX_DIO_SIZE; long size = MAX_DIO_SIZE;
int refcheck;
/* FIXME: io smaller than PAGE_SIZE is broken on ia64 ??? */ /* FIXME: io smaller than PAGE_SIZE is broken on ia64 ??? */
if ((file_offset & ~PAGE_MASK) || (count & ~PAGE_MASK)) if ((file_offset & ~PAGE_MASK) || (count & ~PAGE_MASK))
...@@ -363,9 +360,13 @@ static ssize_t ll_direct_IO_26(struct kiocb *iocb, struct iov_iter *iter) ...@@ -363,9 +360,13 @@ static ssize_t ll_direct_IO_26(struct kiocb *iocb, struct iov_iter *iter)
if (iov_iter_alignment(iter) & ~PAGE_MASK) if (iov_iter_alignment(iter) & ~PAGE_MASK)
return -EINVAL; return -EINVAL;
env = cl_env_get(&refcheck); lcc = ll_cl_find(file);
if (!lcc)
return -EIO;
env = lcc->lcc_env;
LASSERT(!IS_ERR(env)); LASSERT(!IS_ERR(env));
io = vvp_env_io(env)->vui_cl.cis_io; io = lcc->lcc_io;
LASSERT(io); LASSERT(io);
while (iov_iter_count(iter)) { while (iov_iter_count(iter)) {
...@@ -422,7 +423,6 @@ static ssize_t ll_direct_IO_26(struct kiocb *iocb, struct iov_iter *iter) ...@@ -422,7 +423,6 @@ static ssize_t ll_direct_IO_26(struct kiocb *iocb, struct iov_iter *iter)
vio->u.write.vui_written += tot_bytes; vio->u.write.vui_written += tot_bytes;
} }
cl_env_put(env, &refcheck);
return tot_bytes ? tot_bytes : result; return tot_bytes ? tot_bytes : result;
} }
......
...@@ -167,12 +167,7 @@ static int lov_io_sub_init(const struct lu_env *env, struct lov_io *lio, ...@@ -167,12 +167,7 @@ static int lov_io_sub_init(const struct lu_env *env, struct lov_io *lio,
sub->sub_env = ld->ld_emrg[stripe]->emrg_env; sub->sub_env = ld->ld_emrg[stripe]->emrg_env;
sub->sub_borrowed = 1; sub->sub_borrowed = 1;
} else { } else {
void *cookie;
/* obtain new environment */
cookie = cl_env_reenter();
sub->sub_env = cl_env_get(&sub->sub_refcheck); sub->sub_env = cl_env_get(&sub->sub_refcheck);
cl_env_reexit(cookie);
if (IS_ERR(sub->sub_env)) if (IS_ERR(sub->sub_env))
result = PTR_ERR(sub->sub_env); result = PTR_ERR(sub->sub_env);
......
...@@ -729,19 +729,15 @@ static int lov_layout_change(const struct lu_env *unused, ...@@ -729,19 +729,15 @@ static int lov_layout_change(const struct lu_env *unused,
union lov_layout_state *state = &lov->u; union lov_layout_state *state = &lov->u;
const struct lov_layout_operations *old_ops; const struct lov_layout_operations *old_ops;
const struct lov_layout_operations *new_ops; const struct lov_layout_operations *new_ops;
void *cookie;
struct lu_env *env; struct lu_env *env;
int refcheck; int refcheck;
int rc; int rc;
LASSERT(0 <= lov->lo_type && lov->lo_type < ARRAY_SIZE(lov_dispatch)); LASSERT(0 <= lov->lo_type && lov->lo_type < ARRAY_SIZE(lov_dispatch));
cookie = cl_env_reenter();
env = cl_env_get(&refcheck); env = cl_env_get(&refcheck);
if (IS_ERR(env)) { if (IS_ERR(env))
cl_env_reexit(cookie);
return PTR_ERR(env); return PTR_ERR(env);
}
LASSERT(0 <= llt && llt < ARRAY_SIZE(lov_dispatch)); LASSERT(0 <= llt && llt < ARRAY_SIZE(lov_dispatch));
...@@ -782,7 +778,6 @@ static int lov_layout_change(const struct lu_env *unused, ...@@ -782,7 +778,6 @@ static int lov_layout_change(const struct lu_env *unused,
lov->lo_type = llt; lov->lo_type = llt;
out: out:
cl_env_put(env, &refcheck); cl_env_put(env, &refcheck);
cl_env_reexit(cookie);
return rc; return rc;
} }
......
...@@ -49,25 +49,6 @@ enum clt_nesting_level { ...@@ -49,25 +49,6 @@ enum clt_nesting_level {
CNL_NR CNL_NR
}; };
/**
* Counters used to check correctness of cl_lock interface usage.
*/
struct cl_thread_counters {
/**
* Number of outstanding calls to cl_lock_mutex_get() made by the
* current thread. For debugging.
*/
int ctc_nr_locks_locked;
/** List of locked locks. */
struct lu_ref ctc_locks_locked;
/** Number of outstanding holds on locks. */
int ctc_nr_held;
/** Number of outstanding uses on locks. */
int ctc_nr_used;
/** Number of held extent locks. */
int ctc_nr_locks_acquired;
};
/** /**
* Thread local state internal for generic cl-code. * Thread local state internal for generic cl-code.
*/ */
...@@ -83,10 +64,6 @@ struct cl_thread_info { ...@@ -83,10 +64,6 @@ struct cl_thread_info {
*/ */
struct cl_lock_descr clt_descr; struct cl_lock_descr clt_descr;
struct cl_page_list clt_list; struct cl_page_list clt_list;
/**
* Counters for every level of lock nesting.
*/
struct cl_thread_counters clt_counters[CNL_NR];
/** @} debugging */ /** @} debugging */
/* /*
......
...@@ -412,7 +412,6 @@ void cl_io_unlock(const struct lu_env *env, struct cl_io *io) ...@@ -412,7 +412,6 @@ void cl_io_unlock(const struct lu_env *env, struct cl_io *io)
scan->cis_iop->op[io->ci_type].cio_unlock(env, scan); scan->cis_iop->op[io->ci_type].cio_unlock(env, scan);
} }
io->ci_state = CIS_UNLOCKED; io->ci_state = CIS_UNLOCKED;
LASSERT(!cl_env_info(env)->clt_counters[CNL_TOP].ctc_nr_locks_acquired);
} }
EXPORT_SYMBOL(cl_io_unlock); EXPORT_SYMBOL(cl_io_unlock);
......
...@@ -1520,10 +1520,6 @@ void lu_context_key_quiesce(struct lu_context_key *key) ...@@ -1520,10 +1520,6 @@ void lu_context_key_quiesce(struct lu_context_key *key)
struct lu_context *ctx; struct lu_context *ctx;
if (!(key->lct_tags & LCT_QUIESCENT)) { if (!(key->lct_tags & LCT_QUIESCENT)) {
/*
* XXX layering violation.
*/
cl_env_cache_purge(~0);
/* /*
* XXX memory barrier has to go here. * XXX memory barrier has to go here.
*/ */
......
...@@ -563,16 +563,10 @@ static void echo_thread_key_fini(const struct lu_context *ctx, ...@@ -563,16 +563,10 @@ static void echo_thread_key_fini(const struct lu_context *ctx,
kmem_cache_free(echo_thread_kmem, info); kmem_cache_free(echo_thread_kmem, info);
} }
static void echo_thread_key_exit(const struct lu_context *ctx,
struct lu_context_key *key, void *data)
{
}
static struct lu_context_key echo_thread_key = { static struct lu_context_key echo_thread_key = {
.lct_tags = LCT_CL_THREAD, .lct_tags = LCT_CL_THREAD,
.lct_init = echo_thread_key_init, .lct_init = echo_thread_key_init,
.lct_fini = echo_thread_key_fini, .lct_fini = echo_thread_key_fini,
.lct_exit = echo_thread_key_exit
}; };
static void *echo_session_key_init(const struct lu_context *ctx, static void *echo_session_key_init(const struct lu_context *ctx,
...@@ -594,16 +588,10 @@ static void echo_session_key_fini(const struct lu_context *ctx, ...@@ -594,16 +588,10 @@ static void echo_session_key_fini(const struct lu_context *ctx,
kmem_cache_free(echo_session_kmem, session); kmem_cache_free(echo_session_kmem, session);
} }
static void echo_session_key_exit(const struct lu_context *ctx,
struct lu_context_key *key, void *data)
{
}
static struct lu_context_key echo_session_key = { static struct lu_context_key echo_session_key = {
.lct_tags = LCT_SESSION, .lct_tags = LCT_SESSION,
.lct_init = echo_session_key_init, .lct_init = echo_session_key_init,
.lct_fini = echo_session_key_fini, .lct_fini = echo_session_key_fini,
.lct_exit = echo_session_key_exit
}; };
LU_TYPE_INIT_FINI(echo, &echo_thread_key, &echo_session_key); LU_TYPE_INIT_FINI(echo, &echo_thread_key, &echo_session_key);
...@@ -787,6 +775,8 @@ static struct lu_device *echo_device_free(const struct lu_env *env, ...@@ -787,6 +775,8 @@ static struct lu_device *echo_device_free(const struct lu_env *env,
cl_device_fini(&ed->ed_cl); cl_device_fini(&ed->ed_cl);
kfree(ed); kfree(ed);
cl_env_cache_purge(~0);
return NULL; return NULL;
} }
......
...@@ -977,7 +977,6 @@ static int osc_extent_wait(const struct lu_env *env, struct osc_extent *ext, ...@@ -977,7 +977,6 @@ static int osc_extent_wait(const struct lu_env *env, struct osc_extent *ext,
static int osc_extent_truncate(struct osc_extent *ext, pgoff_t trunc_index, static int osc_extent_truncate(struct osc_extent *ext, pgoff_t trunc_index,
bool partial) bool partial)
{ {
struct cl_env_nest nest;
struct lu_env *env; struct lu_env *env;
struct cl_io *io; struct cl_io *io;
struct osc_object *obj = ext->oe_obj; struct osc_object *obj = ext->oe_obj;
...@@ -990,6 +989,7 @@ static int osc_extent_truncate(struct osc_extent *ext, pgoff_t trunc_index, ...@@ -990,6 +989,7 @@ static int osc_extent_truncate(struct osc_extent *ext, pgoff_t trunc_index,
int grants = 0; int grants = 0;
int nr_pages = 0; int nr_pages = 0;
int rc = 0; int rc = 0;
int refcheck;
LASSERT(sanity_check(ext) == 0); LASSERT(sanity_check(ext) == 0);
EASSERT(ext->oe_state == OES_TRUNC, ext); EASSERT(ext->oe_state == OES_TRUNC, ext);
...@@ -999,7 +999,7 @@ static int osc_extent_truncate(struct osc_extent *ext, pgoff_t trunc_index, ...@@ -999,7 +999,7 @@ static int osc_extent_truncate(struct osc_extent *ext, pgoff_t trunc_index,
* We can't use that env from osc_cache_truncate_start() because * We can't use that env from osc_cache_truncate_start() because
* it's from lov_io_sub and not fully initialized. * it's from lov_io_sub and not fully initialized.
*/ */
env = cl_env_nested_get(&nest); env = cl_env_get(&refcheck);
io = &osc_env_info(env)->oti_io; io = &osc_env_info(env)->oti_io;
io->ci_obj = cl_object_top(osc2cl(obj)); io->ci_obj = cl_object_top(osc2cl(obj));
rc = cl_io_init(env, io, CIT_MISC, io->ci_obj); rc = cl_io_init(env, io, CIT_MISC, io->ci_obj);
...@@ -1085,7 +1085,7 @@ static int osc_extent_truncate(struct osc_extent *ext, pgoff_t trunc_index, ...@@ -1085,7 +1085,7 @@ static int osc_extent_truncate(struct osc_extent *ext, pgoff_t trunc_index,
out: out:
cl_io_fini(env, io); cl_io_fini(env, io);
cl_env_nested_put(&nest, env); cl_env_put(env, &refcheck);
return rc; return rc;
} }
......
...@@ -294,10 +294,10 @@ static int osc_lock_upcall(void *cookie, struct lustre_handle *lockh, ...@@ -294,10 +294,10 @@ static int osc_lock_upcall(void *cookie, struct lustre_handle *lockh,
struct osc_lock *oscl = cookie; struct osc_lock *oscl = cookie;
struct cl_lock_slice *slice = &oscl->ols_cl; struct cl_lock_slice *slice = &oscl->ols_cl;
struct lu_env *env; struct lu_env *env;
struct cl_env_nest nest;
int rc; int rc;
int refcheck;
env = cl_env_nested_get(&nest); env = cl_env_get(&refcheck);
/* should never happen, similar to osc_ldlm_blocking_ast(). */ /* should never happen, similar to osc_ldlm_blocking_ast(). */
LASSERT(!IS_ERR(env)); LASSERT(!IS_ERR(env));
...@@ -336,7 +336,7 @@ static int osc_lock_upcall(void *cookie, struct lustre_handle *lockh, ...@@ -336,7 +336,7 @@ static int osc_lock_upcall(void *cookie, struct lustre_handle *lockh,
if (oscl->ols_owner) if (oscl->ols_owner)
cl_sync_io_note(env, oscl->ols_owner, rc); cl_sync_io_note(env, oscl->ols_owner, rc);
cl_env_nested_put(&nest, env); cl_env_put(env, &refcheck);
return rc; return rc;
} }
...@@ -347,9 +347,9 @@ static int osc_lock_upcall_agl(void *cookie, struct lustre_handle *lockh, ...@@ -347,9 +347,9 @@ static int osc_lock_upcall_agl(void *cookie, struct lustre_handle *lockh,
struct osc_object *osc = cookie; struct osc_object *osc = cookie;
struct ldlm_lock *dlmlock; struct ldlm_lock *dlmlock;
struct lu_env *env; struct lu_env *env;
struct cl_env_nest nest; int refcheck;
env = cl_env_nested_get(&nest); env = cl_env_get(&refcheck);
LASSERT(!IS_ERR(env)); LASSERT(!IS_ERR(env));
if (errcode == ELDLM_LOCK_MATCHED) { if (errcode == ELDLM_LOCK_MATCHED) {
...@@ -374,7 +374,7 @@ static int osc_lock_upcall_agl(void *cookie, struct lustre_handle *lockh, ...@@ -374,7 +374,7 @@ static int osc_lock_upcall_agl(void *cookie, struct lustre_handle *lockh,
out: out:
cl_object_put(env, osc2cl(osc)); cl_object_put(env, osc2cl(osc));
cl_env_nested_put(&nest, env); cl_env_put(env, &refcheck);
return ldlm_error2errno(errcode); return ldlm_error2errno(errcode);
} }
...@@ -382,11 +382,11 @@ static int osc_lock_flush(struct osc_object *obj, pgoff_t start, pgoff_t end, ...@@ -382,11 +382,11 @@ static int osc_lock_flush(struct osc_object *obj, pgoff_t start, pgoff_t end,
enum cl_lock_mode mode, int discard) enum cl_lock_mode mode, int discard)
{ {
struct lu_env *env; struct lu_env *env;
struct cl_env_nest nest; int refcheck;
int rc = 0; int rc = 0;
int rc2 = 0; int rc2 = 0;
env = cl_env_nested_get(&nest); env = cl_env_get(&refcheck);
if (IS_ERR(env)) if (IS_ERR(env))
return PTR_ERR(env); return PTR_ERR(env);
...@@ -404,7 +404,7 @@ static int osc_lock_flush(struct osc_object *obj, pgoff_t start, pgoff_t end, ...@@ -404,7 +404,7 @@ static int osc_lock_flush(struct osc_object *obj, pgoff_t start, pgoff_t end,
if (rc == 0 && rc2 < 0) if (rc == 0 && rc2 < 0)
rc = rc2; rc = rc2;
cl_env_nested_put(&nest, env); cl_env_put(env, &refcheck);
return rc; return rc;
} }
...@@ -536,7 +536,7 @@ static int osc_ldlm_blocking_ast(struct ldlm_lock *dlmlock, ...@@ -536,7 +536,7 @@ static int osc_ldlm_blocking_ast(struct ldlm_lock *dlmlock,
} }
case LDLM_CB_CANCELING: { case LDLM_CB_CANCELING: {
struct lu_env *env; struct lu_env *env;
struct cl_env_nest nest; int refcheck;
/* /*
* This can be called in the context of outer IO, e.g., * This can be called in the context of outer IO, e.g.,
...@@ -549,14 +549,14 @@ static int osc_ldlm_blocking_ast(struct ldlm_lock *dlmlock, ...@@ -549,14 +549,14 @@ static int osc_ldlm_blocking_ast(struct ldlm_lock *dlmlock,
* new environment has to be created to not corrupt outer * new environment has to be created to not corrupt outer
* context. * context.
*/ */
env = cl_env_nested_get(&nest); env = cl_env_get(&refcheck);
if (IS_ERR(env)) { if (IS_ERR(env)) {
result = PTR_ERR(env); result = PTR_ERR(env);
break; break;
} }
result = osc_dlm_blocking_ast0(env, dlmlock, data, flag); result = osc_dlm_blocking_ast0(env, dlmlock, data, flag);
cl_env_nested_put(&nest, env); cl_env_put(env, &refcheck);
break; break;
} }
default: default:
...@@ -568,61 +568,61 @@ static int osc_ldlm_blocking_ast(struct ldlm_lock *dlmlock, ...@@ -568,61 +568,61 @@ static int osc_ldlm_blocking_ast(struct ldlm_lock *dlmlock,
static int osc_ldlm_glimpse_ast(struct ldlm_lock *dlmlock, void *data) static int osc_ldlm_glimpse_ast(struct ldlm_lock *dlmlock, void *data)
{ {
struct ptlrpc_request *req = data; struct ptlrpc_request *req = data;
struct cl_env_nest nest;
struct lu_env *env; struct lu_env *env;
struct ost_lvb *lvb; struct ost_lvb *lvb;
struct req_capsule *cap; struct req_capsule *cap;
struct cl_object *obj = NULL;
int result; int result;
int refcheck;
LASSERT(lustre_msg_get_opc(req->rq_reqmsg) == LDLM_GL_CALLBACK); LASSERT(lustre_msg_get_opc(req->rq_reqmsg) == LDLM_GL_CALLBACK);
env = cl_env_nested_get(&nest); env = cl_env_get(&refcheck);
if (!IS_ERR(env)) { if (IS_ERR(env)) {
struct cl_object *obj = NULL; result = PTR_ERR(env);
goto out;
}
lock_res_and_lock(dlmlock); lock_res_and_lock(dlmlock);
if (dlmlock->l_ast_data) { if (dlmlock->l_ast_data) {
obj = osc2cl(dlmlock->l_ast_data); obj = osc2cl(dlmlock->l_ast_data);
cl_object_get(obj); cl_object_get(obj);
} }
unlock_res_and_lock(dlmlock); unlock_res_and_lock(dlmlock);
if (obj) { if (obj) {
/* Do not grab the mutex of cl_lock for glimpse. /* Do not grab the mutex of cl_lock for glimpse.
* See LU-1274 for details. * See LU-1274 for details.
* BTW, it's okay for cl_lock to be cancelled during * BTW, it's okay for cl_lock to be cancelled during
* this period because server can handle this race. * this period because server can handle this race.
* See ldlm_server_glimpse_ast() for details. * See ldlm_server_glimpse_ast() for details.
* cl_lock_mutex_get(env, lock); * cl_lock_mutex_get(env, lock);
*/ */
cap = &req->rq_pill; cap = &req->rq_pill;
req_capsule_extend(cap, &RQF_LDLM_GL_CALLBACK); req_capsule_extend(cap, &RQF_LDLM_GL_CALLBACK);
req_capsule_set_size(cap, &RMF_DLM_LVB, RCL_SERVER, req_capsule_set_size(cap, &RMF_DLM_LVB, RCL_SERVER,
sizeof(*lvb)); sizeof(*lvb));
result = req_capsule_server_pack(cap); result = req_capsule_server_pack(cap);
if (result == 0) { if (result == 0) {
lvb = req_capsule_server_get(cap, &RMF_DLM_LVB); lvb = req_capsule_server_get(cap, &RMF_DLM_LVB);
result = cl_object_glimpse(env, obj, lvb); result = cl_object_glimpse(env, obj, lvb);
}
if (!exp_connect_lvb_type(req->rq_export))
req_capsule_shrink(&req->rq_pill,
&RMF_DLM_LVB,
sizeof(struct ost_lvb_v1),
RCL_SERVER);
cl_object_put(env, obj);
} else {
/*
* These errors are normal races, so we don't want to
* fill the console with messages by calling
* ptlrpc_error()
*/
lustre_pack_reply(req, 1, NULL, NULL);
result = -ELDLM_NO_LOCK_DATA;
} }
cl_env_nested_put(&nest, env); if (!exp_connect_lvb_type(req->rq_export))
req_capsule_shrink(&req->rq_pill, &RMF_DLM_LVB,
sizeof(struct ost_lvb_v1), RCL_SERVER);
cl_object_put(env, obj);
} else { } else {
result = PTR_ERR(env); /*
* These errors are normal races, so we don't want to
* fill the console with messages by calling
* ptlrpc_error()
*/
lustre_pack_reply(req, 1, NULL, NULL);
result = -ELDLM_NO_LOCK_DATA;
} }
cl_env_put(env, &refcheck);
out:
req->rq_status = result; req->rq_status = result;
return result; return result;
} }
...@@ -677,12 +677,12 @@ static unsigned long osc_lock_weight(const struct lu_env *env, ...@@ -677,12 +677,12 @@ static unsigned long osc_lock_weight(const struct lu_env *env,
*/ */
unsigned long osc_ldlm_weigh_ast(struct ldlm_lock *dlmlock) unsigned long osc_ldlm_weigh_ast(struct ldlm_lock *dlmlock)
{ {
struct cl_env_nest nest;
struct lu_env *env; struct lu_env *env;
struct osc_object *obj; struct osc_object *obj;
struct osc_lock *oscl; struct osc_lock *oscl;
unsigned long weight; unsigned long weight;
bool found = false; bool found = false;
int refcheck;
might_sleep(); might_sleep();
/* /*
...@@ -692,7 +692,7 @@ unsigned long osc_ldlm_weigh_ast(struct ldlm_lock *dlmlock) ...@@ -692,7 +692,7 @@ unsigned long osc_ldlm_weigh_ast(struct ldlm_lock *dlmlock)
* the upper context because cl_lock_put don't modify environment * the upper context because cl_lock_put don't modify environment
* variables. But just in case .. * variables. But just in case ..
*/ */
env = cl_env_nested_get(&nest); env = cl_env_get(&refcheck);
if (IS_ERR(env)) if (IS_ERR(env))
/* Mostly because lack of memory, do not eliminate this lock */ /* Mostly because lack of memory, do not eliminate this lock */
return 1; return 1;
...@@ -722,7 +722,7 @@ unsigned long osc_ldlm_weigh_ast(struct ldlm_lock *dlmlock) ...@@ -722,7 +722,7 @@ unsigned long osc_ldlm_weigh_ast(struct ldlm_lock *dlmlock)
weight = osc_lock_weight(env, obj, &dlmlock->l_policy_data.l_extent); weight = osc_lock_weight(env, obj, &dlmlock->l_policy_data.l_extent);
out: out:
cl_env_nested_put(&nest, env); cl_env_put(env, &refcheck);
return weight; return weight;
} }
......
...@@ -644,15 +644,15 @@ long osc_lru_shrink(const struct lu_env *env, struct client_obd *cli, ...@@ -644,15 +644,15 @@ long osc_lru_shrink(const struct lu_env *env, struct client_obd *cli,
long osc_lru_reclaim(struct client_obd *cli) long osc_lru_reclaim(struct client_obd *cli)
{ {
struct cl_env_nest nest;
struct lu_env *env; struct lu_env *env;
struct cl_client_cache *cache = cli->cl_cache; struct cl_client_cache *cache = cli->cl_cache;
int max_scans; int max_scans;
int refcheck;
long rc = 0; long rc = 0;
LASSERT(cache); LASSERT(cache);
env = cl_env_nested_get(&nest); env = cl_env_get(&refcheck);
if (IS_ERR(env)) if (IS_ERR(env))
return 0; return 0;
...@@ -704,7 +704,7 @@ long osc_lru_reclaim(struct client_obd *cli) ...@@ -704,7 +704,7 @@ long osc_lru_reclaim(struct client_obd *cli)
spin_unlock(&cache->ccc_lru_lock); spin_unlock(&cache->ccc_lru_lock);
out: out:
cl_env_nested_put(&nest, env); cl_env_put(env, &refcheck);
CDEBUG(D_CACHE, "%s: cli %p freed %ld pages.\n", CDEBUG(D_CACHE, "%s: cli %p freed %ld pages.\n",
cli->cl_import->imp_obd->obd_name, cli, rc); cli->cl_import->imp_obd->obd_name, cli, rc);
return rc; return rc;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment