struct iov_iter *to;
size_t iov_count;
ssize_t result;
+ struct lu_env *env = NULL;
+ __u16 refcheck;
ENTRY;
result = ll_file_get_iov_count(iov, &nr_segs, &iov_count);
RETURN(result);
if (nr_segs == 1) {
- struct lu_env *env;
- __u16 refcheck;
env = cl_env_get(&refcheck);
if (IS_ERR(env))
local_iov = &ll_env_info(env)->lti_local_iov;
*local_iov = *iov;
- cl_env_put(env, &refcheck);
} else {
OBD_ALLOC(local_iov, sizeof(*iov) * nr_segs);
if (local_iov == NULL)
OBD_FREE_PTR(to);
out:
- if (nr_segs > 1)
+ if (nr_segs == 1)
+ cl_env_put(env, &refcheck);
+ else
OBD_FREE(local_iov, sizeof(*iov) * nr_segs);
RETURN(result);
struct iov_iter *from;
size_t iov_count;
ssize_t result;
+ struct lu_env *env = NULL;
+ __u16 refcheck;
ENTRY;
result = ll_file_get_iov_count(iov, &nr_segs, &iov_count);
RETURN(result);
if (nr_segs == 1) {
- struct lu_env *env;
- __u16 refcheck;
-
env = cl_env_get(&refcheck);
if (IS_ERR(env))
RETURN(PTR_ERR(env));
local_iov = &ll_env_info(env)->lti_local_iov;
*local_iov = *iov;
-
- cl_env_put(env, &refcheck);
} else {
OBD_ALLOC(local_iov, sizeof(*iov) * nr_segs);
if (local_iov == NULL)
OBD_FREE_PTR(from);
out:
- if (nr_segs > 1)
+ if (nr_segs == 1)
+ cl_env_put(env, &refcheck);
+ else
OBD_FREE(local_iov, sizeof(*iov) * nr_segs);
RETURN(result);