Commit a7d516d6 authored by John L. Hammond's avatar John L. Hammond Committed by Greg Kroah-Hartman

staging/lustre: merge lclient/*.c into llite/

Separate lclient was necessary to be shared between
different client implementations, make no sense to have
them separate in Linux kernel.
Signed-off-by: default avatarJohn L. Hammond <john.hammond@intel.com>
Based-on: http://review.whamcloud.com/10171Signed-off-by: default avatarOleg Drokin <green@linuxhacker.ru>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 616387e8
...@@ -4,7 +4,7 @@ lustre-y := dcache.o dir.o file.o llite_close.o llite_lib.o llite_nfs.o \ ...@@ -4,7 +4,7 @@ lustre-y := dcache.o dir.o file.o llite_close.o llite_lib.o llite_nfs.o \
rw.o namei.o symlink.o llite_mmap.o \ rw.o namei.o symlink.o llite_mmap.o \
xattr.o xattr_cache.o remote_perm.o llite_rmtacl.o \ xattr.o xattr_cache.o remote_perm.o llite_rmtacl.o \
rw26.o super25.o statahead.o \ rw26.o super25.o statahead.o \
../lclient/glimpse.o ../lclient/lcommon_cl.o ../lclient/lcommon_misc.o \ glimpse.o lcommon_cl.o lcommon_misc.o \
vvp_dev.o vvp_page.o vvp_lock.o vvp_io.o vvp_object.o lproc_llite.o vvp_dev.o vvp_page.o vvp_lock.o vvp_io.o vvp_object.o lproc_llite.o
llite_lloop-y := lloop.o llite_lloop-y := lloop.o
...@@ -95,7 +95,7 @@ int cl_glimpse_lock(const struct lu_env *env, struct cl_io *io, ...@@ -95,7 +95,7 @@ int cl_glimpse_lock(const struct lu_env *env, struct cl_io *io,
result = 0; result = 0;
if (!(lli->lli_flags & LLIF_MDS_SIZE_LOCK)) { if (!(lli->lli_flags & LLIF_MDS_SIZE_LOCK)) {
CDEBUG(D_DLMTRACE, "Glimpsing inode "DFID"\n", PFID(fid)); CDEBUG(D_DLMTRACE, "Glimpsing inode " DFID "\n", PFID(fid));
if (lli->lli_has_smd) { if (lli->lli_has_smd) {
/* NOTE: this looks like DLM lock request, but it may /* NOTE: this looks like DLM lock request, but it may
* not be one. Due to CEF_ASYNC flag (translated * not be one. Due to CEF_ASYNC flag (translated
...@@ -179,10 +179,12 @@ static int cl_io_get(struct inode *inode, struct lu_env **envout, ...@@ -179,10 +179,12 @@ static int cl_io_get(struct inode *inode, struct lu_env **envout,
*envout = env; *envout = env;
*ioout = io; *ioout = io;
result = 1; result = 1;
} else } else {
result = PTR_ERR(env); result = PTR_ERR(env);
} else }
} else {
result = 0; result = 0;
}
return result; return result;
} }
...@@ -247,9 +249,9 @@ int cl_local_size(struct inode *inode) ...@@ -247,9 +249,9 @@ int cl_local_size(struct inode *inode)
clob = io->ci_obj; clob = io->ci_obj;
result = cl_io_init(env, io, CIT_MISC, clob); result = cl_io_init(env, io, CIT_MISC, clob);
if (result > 0) if (result > 0) {
result = io->ci_result; result = io->ci_result;
else if (result == 0) { } else if (result == 0) {
cti = ccc_env_info(env); cti = ccc_env_info(env);
descr = &cti->cti_descr; descr = &cti->cti_descr;
...@@ -261,8 +263,9 @@ int cl_local_size(struct inode *inode) ...@@ -261,8 +263,9 @@ int cl_local_size(struct inode *inode)
cl_unuse(env, lock); cl_unuse(env, lock);
cl_lock_release(env, lock, "localsize", current); cl_lock_release(env, lock, "localsize", current);
result = 0; result = 0;
} else } else {
result = -ENODATA; result = -ENODATA;
}
} }
cl_io_fini(env, io); cl_io_fini(env, io);
cl_env_put(env, &refcheck); cl_env_put(env, &refcheck);
......
...@@ -123,7 +123,7 @@ void *ccc_key_init(const struct lu_context *ctx, struct lu_context_key *key) ...@@ -123,7 +123,7 @@ void *ccc_key_init(const struct lu_context *ctx, struct lu_context_key *key)
} }
void ccc_key_fini(const struct lu_context *ctx, void ccc_key_fini(const struct lu_context *ctx,
struct lu_context_key *key, void *data) struct lu_context_key *key, void *data)
{ {
struct ccc_thread_info *info = data; struct ccc_thread_info *info = data;
...@@ -131,7 +131,7 @@ void ccc_key_fini(const struct lu_context *ctx, ...@@ -131,7 +131,7 @@ void ccc_key_fini(const struct lu_context *ctx,
} }
void *ccc_session_key_init(const struct lu_context *ctx, void *ccc_session_key_init(const struct lu_context *ctx,
struct lu_context_key *key) struct lu_context_key *key)
{ {
struct ccc_session *session; struct ccc_session *session;
...@@ -142,7 +142,7 @@ void *ccc_session_key_init(const struct lu_context *ctx, ...@@ -142,7 +142,7 @@ void *ccc_session_key_init(const struct lu_context *ctx,
} }
void ccc_session_key_fini(const struct lu_context *ctx, void ccc_session_key_fini(const struct lu_context *ctx,
struct lu_context_key *key, void *data) struct lu_context_key *key, void *data)
{ {
struct ccc_session *session = data; struct ccc_session *session = data;
...@@ -165,7 +165,7 @@ struct lu_context_key ccc_session_key = { ...@@ -165,7 +165,7 @@ struct lu_context_key ccc_session_key = {
/* LU_TYPE_INIT_FINI(ccc, &ccc_key, &ccc_session_key); */ /* LU_TYPE_INIT_FINI(ccc, &ccc_key, &ccc_session_key); */
int ccc_device_init(const struct lu_env *env, struct lu_device *d, int ccc_device_init(const struct lu_env *env, struct lu_device *d,
const char *name, struct lu_device *next) const char *name, struct lu_device *next)
{ {
struct ccc_device *vdv; struct ccc_device *vdv;
int rc; int rc;
...@@ -185,7 +185,7 @@ int ccc_device_init(const struct lu_env *env, struct lu_device *d, ...@@ -185,7 +185,7 @@ int ccc_device_init(const struct lu_env *env, struct lu_device *d,
} }
struct lu_device *ccc_device_fini(const struct lu_env *env, struct lu_device *ccc_device_fini(const struct lu_env *env,
struct lu_device *d) struct lu_device *d)
{ {
return cl2lu_dev(lu2ccc_dev(d)->cdv_next); return cl2lu_dev(lu2ccc_dev(d)->cdv_next);
} }
...@@ -213,15 +213,16 @@ struct lu_device *ccc_device_alloc(const struct lu_env *env, ...@@ -213,15 +213,16 @@ struct lu_device *ccc_device_alloc(const struct lu_env *env,
site = kzalloc(sizeof(*site), GFP_NOFS); site = kzalloc(sizeof(*site), GFP_NOFS);
if (site) { if (site) {
rc = cl_site_init(site, &vdv->cdv_cl); rc = cl_site_init(site, &vdv->cdv_cl);
if (rc == 0) if (rc == 0) {
rc = lu_site_init_finish(&site->cs_lu); rc = lu_site_init_finish(&site->cs_lu);
else { } else {
LASSERT(!lud->ld_site); LASSERT(!lud->ld_site);
CERROR("Cannot init lu_site, rc %d.\n", rc); CERROR("Cannot init lu_site, rc %d.\n", rc);
kfree(site); kfree(site);
} }
} else } else {
rc = -ENOMEM; rc = -ENOMEM;
}
if (rc != 0) { if (rc != 0) {
ccc_device_free(env, lud); ccc_device_free(env, lud);
lud = ERR_PTR(rc); lud = ERR_PTR(rc);
...@@ -230,7 +231,7 @@ struct lu_device *ccc_device_alloc(const struct lu_env *env, ...@@ -230,7 +231,7 @@ struct lu_device *ccc_device_alloc(const struct lu_env *env,
} }
struct lu_device *ccc_device_free(const struct lu_env *env, struct lu_device *ccc_device_free(const struct lu_env *env,
struct lu_device *d) struct lu_device *d)
{ {
struct ccc_device *vdv = lu2ccc_dev(d); struct ccc_device *vdv = lu2ccc_dev(d);
struct cl_site *site = lu2cl_site(d->ld_site); struct cl_site *site = lu2cl_site(d->ld_site);
...@@ -246,7 +247,7 @@ struct lu_device *ccc_device_free(const struct lu_env *env, ...@@ -246,7 +247,7 @@ struct lu_device *ccc_device_free(const struct lu_env *env,
} }
int ccc_req_init(const struct lu_env *env, struct cl_device *dev, int ccc_req_init(const struct lu_env *env, struct cl_device *dev,
struct cl_req *req) struct cl_req *req)
{ {
struct ccc_req *vrq; struct ccc_req *vrq;
int result; int result;
...@@ -255,8 +256,9 @@ int ccc_req_init(const struct lu_env *env, struct cl_device *dev, ...@@ -255,8 +256,9 @@ int ccc_req_init(const struct lu_env *env, struct cl_device *dev,
if (vrq) { if (vrq) {
cl_req_slice_add(req, &vrq->crq_cl, dev, &ccc_req_ops); cl_req_slice_add(req, &vrq->crq_cl, dev, &ccc_req_ops);
result = 0; result = 0;
} else } else {
result = -ENOMEM; result = -ENOMEM;
}
return result; return result;
} }
...@@ -287,7 +289,7 @@ int ccc_global_init(struct lu_device_type *device_type) ...@@ -287,7 +289,7 @@ int ccc_global_init(struct lu_device_type *device_type)
goto out_kmem; goto out_kmem;
ccc_inode_fini_env = cl_env_alloc(&dummy_refcheck, ccc_inode_fini_env = cl_env_alloc(&dummy_refcheck,
LCT_REMEMBER|LCT_NOREF); LCT_REMEMBER | LCT_NOREF);
if (IS_ERR(ccc_inode_fini_env)) { if (IS_ERR(ccc_inode_fini_env)) {
result = PTR_ERR(ccc_inode_fini_env); result = PTR_ERR(ccc_inode_fini_env);
goto out_device; goto out_device;
...@@ -339,14 +341,15 @@ struct lu_object *ccc_object_alloc(const struct lu_env *env, ...@@ -339,14 +341,15 @@ struct lu_object *ccc_object_alloc(const struct lu_env *env,
vob->cob_cl.co_ops = clops; vob->cob_cl.co_ops = clops;
obj->lo_ops = luops; obj->lo_ops = luops;
} else } else {
obj = NULL; obj = NULL;
}
return obj; return obj;
} }
int ccc_object_init0(const struct lu_env *env, int ccc_object_init0(const struct lu_env *env,
struct ccc_object *vob, struct ccc_object *vob,
const struct cl_object_conf *conf) const struct cl_object_conf *conf)
{ {
vob->cob_inode = conf->coc_inode; vob->cob_inode = conf->coc_inode;
vob->cob_transient_pages = 0; vob->cob_transient_pages = 0;
...@@ -355,7 +358,7 @@ int ccc_object_init0(const struct lu_env *env, ...@@ -355,7 +358,7 @@ int ccc_object_init0(const struct lu_env *env,
} }
int ccc_object_init(const struct lu_env *env, struct lu_object *obj, int ccc_object_init(const struct lu_env *env, struct lu_object *obj,
const struct lu_object_conf *conf) const struct lu_object_conf *conf)
{ {
struct ccc_device *dev = lu2ccc_dev(obj->lo_dev); struct ccc_device *dev = lu2ccc_dev(obj->lo_dev);
struct ccc_object *vob = lu2ccc(obj); struct ccc_object *vob = lu2ccc(obj);
...@@ -372,8 +375,9 @@ int ccc_object_init(const struct lu_env *env, struct lu_object *obj, ...@@ -372,8 +375,9 @@ int ccc_object_init(const struct lu_env *env, struct lu_object *obj,
INIT_LIST_HEAD(&vob->cob_pending_list); INIT_LIST_HEAD(&vob->cob_pending_list);
lu_object_add(obj, below); lu_object_add(obj, below);
result = ccc_object_init0(env, vob, cconf); result = ccc_object_init0(env, vob, cconf);
} else } else {
result = -ENOMEM; result = -ENOMEM;
}
return result; return result;
} }
...@@ -400,8 +404,9 @@ int ccc_lock_init(const struct lu_env *env, ...@@ -400,8 +404,9 @@ int ccc_lock_init(const struct lu_env *env,
if (clk) { if (clk) {
cl_lock_slice_add(lock, &clk->clk_cl, obj, lkops); cl_lock_slice_add(lock, &clk->clk_cl, obj, lkops);
result = 0; result = 0;
} else } else {
result = -ENOMEM; result = -ENOMEM;
}
return result; return result;
} }
...@@ -446,7 +451,7 @@ static void ccc_object_size_unlock(struct cl_object *obj) ...@@ -446,7 +451,7 @@ static void ccc_object_size_unlock(struct cl_object *obj)
*/ */
struct page *ccc_page_vmpage(const struct lu_env *env, struct page *ccc_page_vmpage(const struct lu_env *env,
const struct cl_page_slice *slice) const struct cl_page_slice *slice)
{ {
return cl2vm_page(slice); return cl2vm_page(slice);
} }
...@@ -463,9 +468,9 @@ int ccc_page_is_under_lock(const struct lu_env *env, ...@@ -463,9 +468,9 @@ int ccc_page_is_under_lock(const struct lu_env *env,
if (io->ci_type == CIT_READ || io->ci_type == CIT_WRITE || if (io->ci_type == CIT_READ || io->ci_type == CIT_WRITE ||
io->ci_type == CIT_FAULT) { io->ci_type == CIT_FAULT) {
if (cio->cui_fd->fd_flags & LL_FILE_GROUP_LOCKED) if (cio->cui_fd->fd_flags & LL_FILE_GROUP_LOCKED) {
result = -EBUSY; result = -EBUSY;
else { } else {
desc->cld_start = page->cp_index; desc->cld_start = page->cp_index;
desc->cld_end = page->cp_index; desc->cld_end = page->cp_index;
desc->cld_obj = page->cp_obj; desc->cld_obj = page->cp_obj;
...@@ -473,8 +478,9 @@ int ccc_page_is_under_lock(const struct lu_env *env, ...@@ -473,8 +478,9 @@ int ccc_page_is_under_lock(const struct lu_env *env,
result = cl_queue_match(&io->ci_lockset.cls_done, result = cl_queue_match(&io->ci_lockset.cls_done,
desc) ? -EBUSY : 0; desc) ? -EBUSY : 0;
} }
} else } else {
result = 0; result = 0;
}
return result; return result;
} }
...@@ -488,8 +494,8 @@ int ccc_fail(const struct lu_env *env, const struct cl_page_slice *slice) ...@@ -488,8 +494,8 @@ int ccc_fail(const struct lu_env *env, const struct cl_page_slice *slice)
} }
int ccc_transient_page_prep(const struct lu_env *env, int ccc_transient_page_prep(const struct lu_env *env,
const struct cl_page_slice *slice, const struct cl_page_slice *slice,
struct cl_io *unused) struct cl_io *unused)
{ {
/* transient page should always be sent. */ /* transient page should always be sent. */
return 0; return 0;
...@@ -780,11 +786,9 @@ int ccc_prep_size(const struct lu_env *env, struct cl_object *obj, ...@@ -780,11 +786,9 @@ int ccc_prep_size(const struct lu_env *env, struct cl_object *obj,
*/ */
if (cl_isize_read(inode) < kms) { if (cl_isize_read(inode) < kms) {
cl_isize_write_nolock(inode, kms); cl_isize_write_nolock(inode, kms);
CDEBUG(D_VFSTRACE, CDEBUG(D_VFSTRACE, DFID " updating i_size %llu\n",
DFID" updating i_size %llu\n", PFID(lu_object_fid(&obj->co_lu)),
PFID(lu_object_fid(&obj->co_lu)), (__u64)cl_isize_read(inode));
(__u64)cl_isize_read(inode));
} }
} }
ccc_object_size_unlock(obj); ccc_object_size_unlock(obj);
...@@ -1044,8 +1048,9 @@ int cl_file_inode_init(struct inode *inode, struct lustre_md *md) ...@@ -1044,8 +1048,9 @@ int cl_file_inode_init(struct inode *inode, struct lustre_md *md)
lli->lli_clob = clob; lli->lli_clob = clob;
lli->lli_has_smd = lsm_has_objects(md->lsm); lli->lli_has_smd = lsm_has_objects(md->lsm);
lu_object_ref_add(&clob->co_lu, "inode", inode); lu_object_ref_add(&clob->co_lu, "inode", inode);
} else } else {
result = PTR_ERR(clob); result = PTR_ERR(clob);
}
} else { } else {
result = cl_conf_set(env, lli->lli_clob, &conf); result = cl_conf_set(env, lli->lli_clob, &conf);
} }
...@@ -1053,7 +1058,7 @@ int cl_file_inode_init(struct inode *inode, struct lustre_md *md) ...@@ -1053,7 +1058,7 @@ int cl_file_inode_init(struct inode *inode, struct lustre_md *md)
cl_env_put(env, &refcheck); cl_env_put(env, &refcheck);
if (result != 0) if (result != 0)
CERROR("Failure to initialize cl object "DFID": %d\n", CERROR("Failure to initialize cl object " DFID ": %d\n",
PFID(fid), result); PFID(fid), result);
return result; return result;
} }
...@@ -1127,8 +1132,9 @@ void cl_inode_fini(struct inode *inode) ...@@ -1127,8 +1132,9 @@ void cl_inode_fini(struct inode *inode)
if (emergency) { if (emergency) {
cl_env_unplant(ccc_inode_fini_env, &refcheck); cl_env_unplant(ccc_inode_fini_env, &refcheck);
mutex_unlock(&ccc_inode_fini_guard); mutex_unlock(&ccc_inode_fini_guard);
} else } else {
cl_env_put(env, &refcheck); cl_env_put(env, &refcheck);
}
cl_env_reexit(cookie); cl_env_reexit(cookie);
} }
} }
...@@ -1145,7 +1151,7 @@ __u16 ll_dirent_type_get(struct lu_dirent *ent) ...@@ -1145,7 +1151,7 @@ __u16 ll_dirent_type_get(struct lu_dirent *ent)
int len = 0; int len = 0;
if (le32_to_cpu(ent->lde_attrs) & LUDA_TYPE) { if (le32_to_cpu(ent->lde_attrs) & LUDA_TYPE) {
const unsigned align = sizeof(struct luda_type) - 1; const unsigned int align = sizeof(struct luda_type) - 1;
len = le16_to_cpu(ent->lde_namelen); len = le16_to_cpu(ent->lde_namelen);
len = (len + align) & ~align; len = (len + align) & ~align;
......
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