Whamcloud - gitweb
LU-5971 llite: reorganize variable and data structures 14/13714/5
authorJohn Hammond <john.hammond@intel.com>
Thu, 26 Mar 2015 05:08:49 +0000 (22:08 -0700)
committerOleg Drokin <oleg.drokin@intel.com>
Mon, 6 Apr 2015 00:33:57 +0000 (00:33 +0000)
Rename struct ccc_grouplock to ll_grouplock and move the definition
from vvp_internal.h to llite_internal.h.

struct vvp_thread_info is used in the non-VVP parts of llite so rename
it struct ll_thread_info. Rename supporting functions accordingly.

struct ccc_thread_info is used in the VVP parts of llite so rename
it struct vvp_thread_info. Rename supporting functions accordingly.

Remove ccc_global_{init,fini}(), merging their contents into
vvp_global_{init,fini}() and {init,exit}_lustre_lite(). Rename
ccc_inode_fini_* to cl_inode_fini_*.

Move several declarations between llite_internal.h and vvp_internal.h
with the goal of reserving the latter header for functions that
pertain to vvp_{device,object,page,...}.

Signed-off-by: John L. Hammond <john.hammond@intel.com>
Signed-off-by: Jinshan Xiong <jinshan.xiong@intel.com>
Change-Id: I79b51e6f58dee9e9488c983b4a0759fa4117d2a6
Reviewed-on: http://review.whamcloud.com/13714
Tested-by: Jenkins
Reviewed-by: Bobi Jam <bobijam@hotmail.com>
Tested-by: Maloo <hpdd-maloo@intel.com>
Reviewed-by: James Simmons <uja.ornl@gmail.com>
Reviewed-by: Oleg Drokin <oleg.drokin@intel.com>
14 files changed:
lustre/llite/dir.c
lustre/llite/file.c
lustre/llite/glimpse.c
lustre/llite/lcommon_cl.c
lustre/llite/lcommon_misc.c
lustre/llite/llite_internal.h
lustre/llite/llite_lib.c
lustre/llite/llite_mmap.c
lustre/llite/rw.c
lustre/llite/rw26.c
lustre/llite/super25.c
lustre/llite/vvp_dev.c
lustre/llite/vvp_internal.h
lustre/llite/vvp_io.c

index e20ffd7..101918e 100644 (file)
@@ -175,6 +175,29 @@ void ll_release_page(struct inode *inode, struct page *page,
        page_cache_release(page);
 }
 
+/**
+ * return IF_* type for given lu_dirent entry.
+ * IF_* flag shld be converted to particular OS file type in
+ * platform llite module.
+ */
+static u16 ll_dirent_type_get(struct lu_dirent *ent)
+{
+       u16 type = 0;
+       struct luda_type *lt;
+       int len = 0;
+
+       if (le32_to_cpu(ent->lde_attrs) & LUDA_TYPE) {
+               const unsigned align = sizeof(struct luda_type) - 1;
+
+               len = le16_to_cpu(ent->lde_namelen);
+               len = (len + align) & ~align;
+               lt = (void *)ent->lde_name + len;
+               type = IFTODT(le16_to_cpu(lt->lt_type));
+       }
+
+       return type;
+}
+
 #ifdef HAVE_DIR_CONTEXT
 int ll_dir_read(struct inode *inode, __u64 *ppos, struct md_op_data *op_data,
                struct dir_context *ctx)
index a07e74b..1752da1 100644 (file)
 #include <linux/pagemap.h>
 #include <linux/file.h>
 #include <linux/sched.h>
-#include "llite_internal.h"
 #include <lustre/ll_fiemap.h>
 #include <lustre_ioctl.h>
 
 #include "cl_object.h"
 
+#include "llite_internal.h"
+#include "vvp_internal.h"
+
 static int
 ll_put_grouplock(struct inode *inode, struct file *file, unsigned long arg);
 
@@ -246,9 +248,9 @@ static int ll_md_close(struct obd_export *md_exp, struct inode *inode,
         int rc = 0;
         ENTRY;
 
-        /* clear group lock, if present */
-        if (unlikely(fd->fd_flags & LL_FILE_GROUP_LOCKED))
-                ll_put_grouplock(inode, file, fd->fd_grouplock.cg_gid);
+       /* clear group lock, if present */
+       if (unlikely(fd->fd_flags & LL_FILE_GROUP_LOCKED))
+               ll_put_grouplock(inode, file, fd->fd_grouplock.lg_gid);
 
        if (fd->fd_lease_och != NULL) {
                bool lease_broken;
@@ -885,7 +887,7 @@ int ll_merge_attr(const struct lu_env *env, struct inode *inode)
 {
        struct ll_inode_info *lli = ll_i2info(inode);
        struct cl_object *obj = lli->lli_clob;
-       struct cl_attr *attr = ccc_env_thread_attr(env);
+       struct cl_attr *attr = vvp_env_thread_attr(env);
        s64 atime;
        s64 mtime;
        s64 ctime;
@@ -1005,7 +1007,7 @@ ll_file_io_generic(const struct lu_env *env, struct vvp_io_args *args,
                file->f_dentry->d_name.name, iot, *ppos, count);
 
 restart:
-        io = ccc_env_thread_io(env);
+       io = vvp_env_thread_io(env);
         ll_io_init(io, file, iot == CIT_WRITE);
 
        /* The maximum Lustre file size is variable, based on the
@@ -1162,7 +1164,7 @@ static ssize_t ll_file_aio_read(struct kiocb *iocb, const struct iovec *iov,
         if (IS_ERR(env))
                 RETURN(PTR_ERR(env));
 
-        args = vvp_env_args(env, IO_NORMAL);
+       args = ll_env_args(env, IO_NORMAL);
         args->u.normal.via_iov = (struct iovec *)iov;
         args->u.normal.via_nrsegs = nr_segs;
         args->u.normal.via_iocb = iocb;
@@ -1187,8 +1189,8 @@ static ssize_t ll_file_read(struct file *file, char __user *buf, size_t count,
         if (IS_ERR(env))
                 RETURN(PTR_ERR(env));
 
-        local_iov = &vvp_env_info(env)->vti_local_iov;
-        kiocb = &vvp_env_info(env)->vti_kiocb;
+       local_iov = &ll_env_info(env)->lti_local_iov;
+       kiocb = &ll_env_info(env)->lti_kiocb;
         local_iov->iov_base = (void __user *)buf;
         local_iov->iov_len = count;
         init_sync_kiocb(kiocb, file);
@@ -1228,7 +1230,7 @@ static ssize_t ll_file_aio_write(struct kiocb *iocb, const struct iovec *iov,
         if (IS_ERR(env))
                 RETURN(PTR_ERR(env));
 
-        args = vvp_env_args(env, IO_NORMAL);
+       args = ll_env_args(env, IO_NORMAL);
         args->u.normal.via_iov = (struct iovec *)iov;
         args->u.normal.via_nrsegs = nr_segs;
         args->u.normal.via_iocb = iocb;
@@ -1253,8 +1255,8 @@ static ssize_t ll_file_write(struct file *file, const char __user *buf,
         if (IS_ERR(env))
                 RETURN(PTR_ERR(env));
 
-        local_iov = &vvp_env_info(env)->vti_local_iov;
-        kiocb = &vvp_env_info(env)->vti_kiocb;
+       local_iov = &ll_env_info(env)->lti_local_iov;
+       kiocb = &ll_env_info(env)->lti_kiocb;
         local_iov->iov_base = (void __user *)buf;
         local_iov->iov_len = count;
         init_sync_kiocb(kiocb, file);
@@ -1289,7 +1291,7 @@ static ssize_t ll_file_splice_read(struct file *in_file, loff_t *ppos,
         if (IS_ERR(env))
                 RETURN(PTR_ERR(env));
 
-        args = vvp_env_args(env, IO_SPLICE);
+       args = ll_env_args(env, IO_SPLICE);
         args->u.splice.via_pipe = pipe;
         args->u.splice.via_flags = flags;
 
@@ -1502,7 +1504,7 @@ ll_get_grouplock(struct inode *inode, struct file *file, unsigned long arg)
 {
         struct ll_inode_info   *lli = ll_i2info(inode);
         struct ll_file_data    *fd = LUSTRE_FPRIVATE(file);
-        struct ccc_grouplock    grouplock;
+       struct ll_grouplock     grouplock;
         int                     rc;
         ENTRY;
 
@@ -1517,11 +1519,11 @@ ll_get_grouplock(struct inode *inode, struct file *file, unsigned long arg)
        spin_lock(&lli->lli_lock);
        if (fd->fd_flags & LL_FILE_GROUP_LOCKED) {
                CWARN("group lock already existed with gid %lu\n",
-                     fd->fd_grouplock.cg_gid);
+                     fd->fd_grouplock.lg_gid);
                spin_unlock(&lli->lli_lock);
                RETURN(-EINVAL);
        }
-       LASSERT(fd->fd_grouplock.cg_lock == NULL);
+       LASSERT(fd->fd_grouplock.lg_lock == NULL);
        spin_unlock(&lli->lli_lock);
 
        rc = cl_get_grouplock(ll_i2info(inode)->lli_clob,
@@ -1550,7 +1552,7 @@ static int ll_put_grouplock(struct inode *inode, struct file *file,
 {
        struct ll_inode_info   *lli = ll_i2info(inode);
        struct ll_file_data    *fd = LUSTRE_FPRIVATE(file);
-       struct ccc_grouplock    grouplock;
+       struct ll_grouplock     grouplock;
        ENTRY;
 
        spin_lock(&lli->lli_lock);
@@ -1559,11 +1561,12 @@ static int ll_put_grouplock(struct inode *inode, struct file *file,
                 CWARN("no group lock held\n");
                 RETURN(-EINVAL);
         }
-        LASSERT(fd->fd_grouplock.cg_lock != NULL);
 
-        if (fd->fd_grouplock.cg_gid != arg) {
-                CWARN("group lock %lu doesn't match current id %lu\n",
-                       arg, fd->fd_grouplock.cg_gid);
+       LASSERT(fd->fd_grouplock.lg_lock != NULL);
+
+       if (fd->fd_grouplock.lg_gid != arg) {
+               CWARN("group lock %lu doesn't match current id %lu\n",
+                     arg, fd->fd_grouplock.lg_gid);
                spin_unlock(&lli->lli_lock);
                RETURN(-EINVAL);
        }
@@ -2588,7 +2591,7 @@ int cl_sync_file_range(struct inode *inode, loff_t start, loff_t end,
 
        capa = ll_osscapa_get(inode, CAPA_OPC_OSS_WRITE);
 
-       io = ccc_env_thread_io(env);
+       io = vvp_env_thread_io(env);
        io->ci_obj = ll_i2info(inode)->lli_clob;
        io->ci_ignore_layout = ignore_layout;
 
index 539cf1c..5966d58 100644 (file)
@@ -52,6 +52,7 @@
 
 #include "cl_object.h"
 #include "llite_internal.h"
+#include "vvp_internal.h"
 
 static const struct cl_lock_descr whole_file = {
         .cld_start = 0,
@@ -93,7 +94,7 @@ int cl_glimpse_lock(const struct lu_env *env, struct cl_io *io,
 
        CDEBUG(D_DLMTRACE, "Glimpsing inode "DFID"\n", PFID(fid));
        if (lli->lli_has_smd) {
-               struct cl_lock *lock = ccc_env_lock(env);
+               struct cl_lock *lock = vvp_env_lock(env);
                struct cl_lock_descr *descr = &lock->cll_descr;
 
                /* NOTE: this looks like DLM lock request, but it may
@@ -161,7 +162,7 @@ static int cl_io_get(struct inode *inode, struct lu_env **envout,
        if (S_ISREG(inode->i_mode)) {
                 env = cl_env_get(refcheck);
                 if (!IS_ERR(env)) {
-                        io = ccc_env_thread_io(env);
+                       io = vvp_env_thread_io(env);
                         io->ci_obj = clob;
                         *envout = env;
                         *ioout  = io;
@@ -238,7 +239,7 @@ int cl_local_size(struct inode *inode)
         if (result > 0)
                 result = io->ci_result;
        else if (result == 0) {
-               struct cl_lock *lock = ccc_env_lock(env);
+               struct cl_lock *lock = vvp_env_lock(env);
 
                lock->cll_descr = whole_file;
                lock->cll_descr.cld_enq_flags = CEF_PEEK;
index d4c4daf..0d356a1 100644 (file)
@@ -33,9 +33,6 @@
  * This file is part of Lustre, http://www.lustre.org/
  * Lustre is a trademark of Sun Microsystems, Inc.
  *
- * cl code shared between vvp and liblustre (and other Lustre clients in the
- * future).
- *
  *   Author: Nikita Danilov <nikita.danilov@sun.com>
  */
 
 #include <cl_object.h>
 
 #include "llite_internal.h"
-
-/*
- * ccc_ prefix stands for "Common Client Code".
- */
-
-static struct kmem_cache *ccc_thread_kmem;
-
-static struct lu_kmem_descr ccc_caches[] = {
-        {
-                .ckd_cache = &ccc_thread_kmem,
-                .ckd_name  = "ccc_thread_kmem",
-                .ckd_size  = sizeof (struct ccc_thread_info),
-        },
-        {
-                .ckd_cache = NULL
-        }
-};
-
-/*****************************************************************************
- *
- * Vvp device and device type functions.
- *
- */
-
-void *ccc_key_init(const struct lu_context *ctx, struct lu_context_key *key)
-{
-       struct ccc_thread_info *info;
-
-       OBD_SLAB_ALLOC_PTR_GFP(info, ccc_thread_kmem, GFP_NOFS);
-       if (info == NULL)
-               info = ERR_PTR(-ENOMEM);
-       return info;
-}
-
-void ccc_key_fini(const struct lu_context *ctx,
-                         struct lu_context_key *key, void *data)
-{
-        struct ccc_thread_info *info = data;
-        OBD_SLAB_FREE_PTR(info, ccc_thread_kmem);
-}
-
-struct lu_context_key ccc_key = {
-        .lct_tags = LCT_CL_THREAD,
-        .lct_init = ccc_key_init,
-        .lct_fini = ccc_key_fini
-};
+#include "vvp_internal.h"
 
 /**
- * An `emergency' environment used by ccc_inode_fini() when cl_env_get()
- * fails. Access to this environment is serialized by ccc_inode_fini_guard
+ * An `emergency' environment used by cl_inode_fini() when cl_env_get()
+ * fails. Access to this environment is serialized by cl_inode_fini_guard
  * mutex.
  */
-static struct lu_env *ccc_inode_fini_env = NULL;
+struct lu_env *cl_inode_fini_env;
+int cl_inode_fini_refcheck;
 
 /**
  * A mutex serializing calls to slp_inode_fini() under extreme memory
  * pressure, when environments cannot be allocated.
  */
-static DEFINE_MUTEX(ccc_inode_fini_guard);
-static int dummy_refcheck;
-
-int ccc_global_init(struct lu_device_type *device_type)
-{
-        int result;
-
-        result = lu_kmem_init(ccc_caches);
-        if (result)
-                return result;
-
-        result = lu_device_type_init(device_type);
-        if (result)
-                goto out_kmem;
-
-        ccc_inode_fini_env = cl_env_alloc(&dummy_refcheck,
-                                          LCT_REMEMBER|LCT_NOREF);
-        if (IS_ERR(ccc_inode_fini_env)) {
-                result = PTR_ERR(ccc_inode_fini_env);
-                goto out_device;
-        }
-
-        ccc_inode_fini_env->le_ctx.lc_cookie = 0x4;
-        return 0;
-out_device:
-        lu_device_type_fini(device_type);
-out_kmem:
-        lu_kmem_fini(ccc_caches);
-        return result;
-}
-
-void ccc_global_fini(struct lu_device_type *device_type)
-{
-        if (ccc_inode_fini_env != NULL) {
-                cl_env_put(ccc_inode_fini_env, &dummy_refcheck);
-                ccc_inode_fini_env = NULL;
-        }
-        lu_device_type_fini(device_type);
-        lu_kmem_fini(ccc_caches);
-}
+static DEFINE_MUTEX(cl_inode_fini_guard);
 
 int cl_setattr_ost(struct inode *inode, const struct iattr *attr,
                    struct obd_capa *capa)
@@ -172,7 +86,7 @@ int cl_setattr_ost(struct inode *inode, const struct iattr *attr,
         if (IS_ERR(env))
                 RETURN(PTR_ERR(env));
 
-        io = ccc_env_thread_io(env);
+       io = vvp_env_thread_io(env);
        io->ci_obj = ll_i2info(inode)->lli_clob;
 
        io->u.ci_setattr.sa_attr.lvb_atime = LTIME_S(attr->ia_atime);
@@ -328,12 +242,13 @@ void cl_inode_fini(struct inode *inode)
                 cookie = cl_env_reenter();
                 env = cl_env_get(&refcheck);
                 emergency = IS_ERR(env);
-                if (emergency) {
-                       mutex_lock(&ccc_inode_fini_guard);
-                        LASSERT(ccc_inode_fini_env != NULL);
-                        cl_env_implant(ccc_inode_fini_env, &refcheck);
-                        env = ccc_inode_fini_env;
-                }
+               if (emergency) {
+                       mutex_lock(&cl_inode_fini_guard);
+                       LASSERT(cl_inode_fini_env != NULL);
+                       cl_env_implant(cl_inode_fini_env, &refcheck);
+                       env = cl_inode_fini_env;
+               }
+
                 /*
                  * cl_object cache is a slave to inode cache (which, in turn
                  * is a slave to dentry cache), don't keep cl_object in memory
@@ -343,38 +258,18 @@ void cl_inode_fini(struct inode *inode)
                 lu_object_ref_del(&clob->co_lu, "inode", inode);
                 cl_object_put_last(env, clob);
                 lli->lli_clob = NULL;
-                if (emergency) {
-                        cl_env_unplant(ccc_inode_fini_env, &refcheck);
-                       mutex_unlock(&ccc_inode_fini_guard);
-                } else
-                        cl_env_put(env, &refcheck);
+               if (emergency) {
+                       cl_env_unplant(cl_inode_fini_env, &refcheck);
+                       mutex_unlock(&cl_inode_fini_guard);
+               } else {
+                       cl_env_put(env, &refcheck);
+               }
+
                 cl_env_reexit(cookie);
         }
 }
 
 /**
- * return IF_* type for given lu_dirent entry.
- * IF_* flag shld be converted to particular OS file type in
- * platform llite module.
- */
-__u16 ll_dirent_type_get(struct lu_dirent *ent)
-{
-        __u16 type = 0;
-        struct luda_type *lt;
-        int len = 0;
-
-        if (le32_to_cpu(ent->lde_attrs) & LUDA_TYPE) {
-                const unsigned align = sizeof(struct luda_type) - 1;
-
-                len = le16_to_cpu(ent->lde_namelen);
-                len = (len + align) & ~align;
-               lt = (void *)ent->lde_name + len;
-               type = IFTODT(le16_to_cpu(lt->lt_type));
-       }
-       return type;
-}
-
-/**
  * build inode number from passed @fid */
 __u64 cl_fid_build_ino(const struct lu_fid *fid, int api32)
 {
index cd3c0d7..05a670d 100644 (file)
 
 #include "llite_internal.h"
 
-
 /* Initialize the default and maximum LOV EA and cookie sizes.  This allows
  * us to make MDS RPCs with large enough reply buffers to hold the
  * maximum-sized (= maximum striped) EA and cookie without having to
  * calculate this (via a call into the LOV + OSCs) each time we make an RPC. */
-int cl_init_ea_size(struct obd_export *md_exp, struct obd_export *dt_exp)
+static int cl_init_ea_size(struct obd_export *md_exp, struct obd_export *dt_exp)
 {
        struct lov_stripe_md lsm = { .lsm_magic = LOV_MAGIC_V3 };
        __u32 valsize = sizeof(struct lov_desc);
@@ -126,7 +125,7 @@ int cl_ocd_update(struct obd_device *host,
 #define GROUPLOCK_SCOPE "grouplock"
 
 int cl_get_grouplock(struct cl_object *obj, unsigned long gid, int nonblock,
-                     struct ccc_grouplock *cg)
+                    struct ll_grouplock *lg)
 {
         struct lu_env          *env;
         struct cl_io           *io;
@@ -140,7 +139,7 @@ int cl_get_grouplock(struct cl_object *obj, unsigned long gid, int nonblock,
         if (IS_ERR(env))
                 return PTR_ERR(env);
 
-        io = ccc_env_thread_io(env);
+       io = vvp_env_thread_io(env);
         io->ci_obj = obj;
        io->ci_ignore_layout = 1;
 
@@ -154,7 +153,7 @@ int cl_get_grouplock(struct cl_object *obj, unsigned long gid, int nonblock,
                return rc;
        }
 
-       lock = ccc_env_lock(env);
+       lock = vvp_env_lock(env);
        descr = &lock->cll_descr;
         descr->cld_obj = obj;
         descr->cld_start = 0;
@@ -172,25 +171,25 @@ int cl_get_grouplock(struct cl_object *obj, unsigned long gid, int nonblock,
                return rc;
        }
 
-        cg->cg_env  = cl_env_get(&refcheck);
-        cg->cg_io   = io;
-        cg->cg_lock = lock;
-        cg->cg_gid  = gid;
-        LASSERT(cg->cg_env == env);
+       lg->lg_env = cl_env_get(&refcheck);
+       lg->lg_io = io;
+       lg->lg_lock = lock;
+       lg->lg_gid = gid;
+       LASSERT(lg->lg_env == env);
 
-        cl_env_unplant(env, &refcheck);
-        return 0;
+       cl_env_unplant(env, &refcheck);
+       return 0;
 }
 
-void cl_put_grouplock(struct ccc_grouplock *cg)
+void cl_put_grouplock(struct ll_grouplock *lg)
 {
-       struct lu_env  *env  = cg->cg_env;
-       struct cl_io   *io   = cg->cg_io;
-       struct cl_lock *lock = cg->cg_lock;
+       struct lu_env  *env  = lg->lg_env;
+       struct cl_io   *io   = lg->lg_io;
+       struct cl_lock *lock = lg->lg_lock;
        int             refcheck;
 
-       LASSERT(cg->cg_env);
-       LASSERT(cg->cg_gid);
+       LASSERT(lg->lg_env != NULL);
+       LASSERT(lg->lg_gid != 0);
 
        cl_env_implant(env, &refcheck);
        cl_env_put(env, &refcheck);
@@ -199,4 +198,3 @@ void cl_put_grouplock(struct ccc_grouplock *cg)
        cl_io_fini(env, io);
        cl_env_put(env, NULL);
 }
-
index 85e3738..11e1c96 100644 (file)
@@ -113,6 +113,13 @@ struct ll_remote_perm {
                                                     lrp_fsuid/lrp_fsgid. */
 };
 
+struct ll_grouplock {
+       struct lu_env   *lg_env;
+       struct cl_io    *lg_io;
+       struct cl_lock  *lg_lock;
+       unsigned long    lg_gid;
+};
+
 enum lli_flags {
        /* File data is modified. */
        LLIF_DATA_MODIFIED      = 1 << 0,
@@ -639,7 +646,7 @@ extern struct kmem_cache *ll_file_data_slab;
 struct lustre_handle;
 struct ll_file_data {
        struct ll_readahead_state fd_ras;
-       struct ccc_grouplock fd_grouplock;
+       struct ll_grouplock fd_grouplock;
        __u64 lfd_pos;
        __u32 fd_flags;
        fmode_t fd_omode;
@@ -683,6 +690,13 @@ static inline int ll_need_32bit_api(struct ll_sb_info *sbi)
 
 void ll_ras_enter(struct file *f);
 
+/* llite/lcommon_misc.c */
+int cl_ocd_update(struct obd_device *host, struct obd_device *watched,
+                 enum obd_notify_event ev, void *owner, void *data);
+int cl_get_grouplock(struct cl_object *obj, unsigned long gid, int nonblock,
+                    struct ll_grouplock *lg);
+void cl_put_grouplock(struct ll_grouplock *lg);
+
 /* llite/lproc_llite.c */
 #ifdef CONFIG_PROC_FS
 int lprocfs_register_mountpoint(struct proc_dir_entry *parent,
@@ -899,6 +913,15 @@ int ll_set_default_mdsize(struct ll_sb_info *sbi, int default_mdsize);
 int ll_get_max_cookiesize(struct ll_sb_info *sbi, int *max_cookiesize);
 int ll_get_default_cookiesize(struct ll_sb_info *sbi, int *default_cookiesize);
 int ll_process_config(struct lustre_cfg *lcfg);
+
+enum {
+       LUSTRE_OPC_MKDIR        = 0,
+       LUSTRE_OPC_SYMLINK      = 1,
+       LUSTRE_OPC_MKNOD        = 2,
+       LUSTRE_OPC_CREATE       = 3,
+       LUSTRE_OPC_ANY          = 5,
+};
+
 struct md_op_data *ll_prep_md_op_data(struct md_op_data *op_data,
                                      struct inode *i1, struct inode *i2,
                                      const char *name, size_t namelen,
@@ -968,38 +991,36 @@ struct ll_cl_context {
        struct cl_page          *lcc_page;
 };
 
-struct vvp_thread_info {
-        struct iovec         vti_local_iov;
-        struct vvp_io_args   vti_args;
-        struct ra_io_arg     vti_ria;
-        struct kiocb         vti_kiocb;
-        struct ll_cl_context vti_io_ctx;
+struct ll_thread_info {
+       struct iovec            lti_local_iov;
+       struct vvp_io_args      lti_args;
+       struct ra_io_arg        lti_ria;
+       struct kiocb            lti_kiocb;
+       struct ll_cl_context    lti_io_ctx;
 };
 
-extern struct lu_context_key vvp_key;
+extern struct lu_context_key ll_thread_key;
 
-static inline struct vvp_thread_info *vvp_env_info(const struct lu_env *env)
+static inline struct ll_thread_info *ll_env_info(const struct lu_env *env)
 {
-        struct vvp_thread_info      *info;
+       struct ll_thread_info *lti;
+
+       lti = lu_context_key_get(&env->le_ctx, &ll_thread_key);
+       LASSERT(lti != NULL);
 
-        info = lu_context_key_get(&env->le_ctx, &vvp_key);
-        LASSERT(info != NULL);
-        return info;
+       return lti;
 }
 
-static inline struct vvp_io_args *vvp_env_args(const struct lu_env *env,
-                                               enum vvp_io_subtype type)
+static inline struct vvp_io_args *ll_env_args(const struct lu_env *env,
+                                             enum vvp_io_subtype type)
 {
-        struct vvp_io_args *ret = &vvp_env_info(env)->vti_args;
+       struct vvp_io_args *via = &ll_env_info(env)->lti_args;
 
-        ret->via_io_subtype = type;
+       via->via_io_subtype = type;
 
-        return ret;
+       return via;
 }
 
-int vvp_global_init(void);
-void vvp_global_fini(void);
-
 /* llite/llite_mmap.c */
 
 int ll_teardown_mmaps(struct address_space *mapping, __u64 first, __u64 last);
@@ -1114,9 +1135,6 @@ void ll_truncate_free_capa(struct obd_capa *ocapa);
 void ll_clear_inode_capas(struct inode *inode);
 void ll_print_capa_stat(struct ll_sb_info *sbi);
 
-/* llite/llite_cl.c */
-extern struct lu_device_type vvp_device_type;
-
 /**
  * Common IO arguments for various VFS I/O interfaces.
  */
@@ -1202,6 +1220,23 @@ int ll_statahead(struct inode *dir, struct dentry **dentry, bool unplug);
 void ll_authorize_statahead(struct inode *dir, void *key);
 void ll_deauthorize_statahead(struct inode *dir, void *key);
 
+/* glimpse.c */
+blkcnt_t dirty_cnt(struct inode *inode);
+
+int cl_glimpse_size0(struct inode *inode, int agl);
+int cl_glimpse_lock(const struct lu_env *env, struct cl_io *io,
+                   struct inode *inode, struct cl_object *clob, int agl);
+
+static inline int cl_glimpse_size(struct inode *inode)
+{
+       return cl_glimpse_size0(inode, 0);
+}
+
+static inline int cl_agl(struct inode *inode)
+{
+       return cl_glimpse_size0(inode, 1);
+}
+
 static inline int ll_glimpse_size(struct inode *inode)
 {
        struct ll_inode_info *lli = ll_i2info(inode);
@@ -1477,4 +1512,18 @@ int ll_page_sync_io(const struct lu_env *env, struct cl_io *io,
 
 int ll_getparent(struct file *file, struct getparent __user *arg);
 
+/* lcommon_cl.c */
+int cl_setattr_ost(struct inode *inode, const struct iattr *attr,
+                  struct obd_capa *capa);
+
+extern struct lu_env *cl_inode_fini_env;
+extern int cl_inode_fini_refcheck;
+
+int cl_file_inode_init(struct inode *inode, struct lustre_md *md);
+void cl_inode_fini(struct inode *inode);
+int cl_local_size(struct inode *inode);
+
+u64 cl_fid_build_ino(const struct lu_fid *fid, int api32);
+u32 cl_fid_build_gen(const struct lu_fid *fid);
+
 #endif /* LLITE_INTERNAL_H */
index 668a719..c562c04 100644 (file)
@@ -2671,7 +2671,7 @@ void ll_dirty_page_discard_warn(struct page *page, int ioret)
 {
        char *buf, *path = NULL;
        struct dentry *dentry = NULL;
-       struct vvp_object *obj = cl_inode2vvp(page->mapping->host);
+       struct inode *inode = page->mapping->host;
 
        /* this can be called inside spin lock so use GFP_ATOMIC. */
        buf = (char *)__get_free_page(GFP_ATOMIC);
@@ -2685,7 +2685,7 @@ void ll_dirty_page_discard_warn(struct page *page, int ioret)
               "%s: dirty page discard: %s/fid: "DFID"/%s may get corrupted "
               "(rc %d)\n", ll_get_fsname(page->mapping->host->i_sb, NULL, 0),
               s2lsi(page->mapping->host->i_sb)->lsi_lmd->lmd_dev,
-              PFID(&obj->vob_header.coh_lu.loh_fid),
+              PFID(ll_inode2fid(inode)),
               (path && !IS_ERR(path)) ? path : "", ioret);
 
        if (dentry != NULL)
index 16ce8c6..7f296c9 100644 (file)
@@ -128,7 +128,7 @@ ll_fault_io_init(struct vm_area_struct *vma, struct lu_env **env_ret,
 
         *env_ret = env;
 
-        io = ccc_env_thread_io(env);
+       io = vvp_env_thread_io(env);
         io->ci_obj = ll_i2info(inode)->lli_clob;
         LASSERT(io->ci_obj != NULL);
 
index 17386e8..ca19828 100644 (file)
@@ -435,12 +435,12 @@ static int ll_readahead(const struct lu_env *env, struct cl_io *io,
                        struct ll_readahead_state *ras, bool hit)
 {
        struct vvp_io *vio = vvp_env_io(env);
-       struct vvp_thread_info *vti = vvp_env_info(env);
-       struct cl_attr *attr = ccc_env_thread_attr(env);
+       struct ll_thread_info *lti = ll_env_info(env);
+       struct cl_attr *attr = vvp_env_thread_attr(env);
        unsigned long len, mlen = 0, reserved;
        pgoff_t ra_end, start = 0, end = 0;
        struct inode *inode;
-       struct ra_io_arg *ria = &vti->vti_ria;
+       struct ra_io_arg *ria = &lti->lti_ria;
        struct cl_object *clob;
        int ret = 0;
        __u64 kms;
@@ -921,7 +921,7 @@ int ll_writepage(struct page *vmpage, struct writeback_control *wbc)
         clob  = ll_i2info(inode)->lli_clob;
         LASSERT(clob != NULL);
 
-        io = ccc_env_thread_io(env);
+       io = vvp_env_thread_io(env);
         io->ci_obj = clob;
        io->ci_ignore_layout = 1;
         result = cl_io_init(env, io, CIT_MISC, clob);
@@ -1062,7 +1062,7 @@ struct ll_cl_context *ll_cl_find(struct file *file)
 void ll_cl_add(struct file *file, const struct lu_env *env, struct cl_io *io)
 {
        struct ll_file_data *fd = LUSTRE_FPRIVATE(file);
-       struct ll_cl_context *lcc = &vvp_env_info(env)->vti_io_ctx;
+       struct ll_cl_context *lcc = &ll_env_info(env)->lti_io_ctx;
 
        memset(lcc, 0, sizeof(*lcc));
        INIT_LIST_HEAD(&lcc->lcc_list);
@@ -1078,7 +1078,7 @@ void ll_cl_add(struct file *file, const struct lu_env *env, struct cl_io *io)
 void ll_cl_remove(struct file *file, const struct lu_env *env)
 {
        struct ll_file_data *fd = LUSTRE_FPRIVATE(file);
-       struct ll_cl_context *lcc = &vvp_env_info(env)->vti_io_ctx;
+       struct ll_cl_context *lcc = &ll_env_info(env)->lti_io_ctx;
 
        write_lock(&fd->fd_lock);
        list_del_init(&lcc->lcc_list);
index 6aedd06..7ae14df 100644 (file)
@@ -485,7 +485,7 @@ out:
 static int ll_prepare_partial_page(const struct lu_env *env, struct cl_io *io,
                                   struct cl_page *pg)
 {
-       struct cl_attr *attr   = ccc_env_thread_attr(env);
+       struct cl_attr *attr   = vvp_env_thread_attr(env);
        struct cl_object *obj  = io->ci_obj;
        struct vvp_page *vpg   = cl_object_page_slice(obj, pg);
        loff_t          offset = cl_offset(obj, vvp_index(vpg));
index fb08e11..e091ffb 100644 (file)
@@ -45,6 +45,7 @@
 #include <linux/fs.h>
 #include <lprocfs_status.h>
 #include "llite_internal.h"
+#include "vvp_internal.h"
 
 static struct kmem_cache *ll_inode_cachep;
 
@@ -176,9 +177,16 @@ static int __init init_lustre_lite(void)
        if (rc != 0)
                GOTO(out_capa, rc);
 
+       cl_inode_fini_env = cl_env_alloc(&cl_inode_fini_refcheck,
+                                        LCT_REMEMBER | LCT_NOREF);
+       if (IS_ERR(cl_inode_fini_env))
+               GOTO(out_vvp, rc = PTR_ERR(cl_inode_fini_env));
+
+       cl_inode_fini_env->le_ctx.lc_cookie = 0x4;
+
        rc = ll_xattr_init();
        if (rc != 0)
-               GOTO(out_vvp, rc);
+               GOTO(out_inode_fini_env, rc);
 
        lustre_register_client_fill_super(ll_fill_super);
        lustre_register_kill_super_cb(ll_kill_super);
@@ -186,6 +194,8 @@ static int __init init_lustre_lite(void)
 
        RETURN(0);
 
+out_inode_fini_env:
+       cl_env_put(cl_inode_fini_env, &cl_inode_fini_refcheck);
 out_vvp:
        vvp_global_fini();
 out_capa:
@@ -218,6 +228,7 @@ static void __exit exit_lustre_lite(void)
        lprocfs_remove(&proc_lustre_fs_root);
 
        ll_xattr_fini();
+       cl_env_put(cl_inode_fini_env, &cl_inode_fini_refcheck);
        vvp_global_fini();
        del_timer(&ll_capa_timer);
        ll_capa_thread_stop();
index 12d4d2f..2ffdd59 100644 (file)
@@ -41,7 +41,6 @@
 
 #define DEBUG_SUBSYSTEM S_LLITE
 
-
 #include <obd.h>
 #include "llite_internal.h"
 #include "vvp_internal.h"
  * "llite_" (var. "ll_") prefix.
  */
 
+static struct kmem_cache *ll_thread_kmem;
 struct kmem_cache *vvp_lock_kmem;
 struct kmem_cache *vvp_object_kmem;
 struct kmem_cache *vvp_req_kmem;
-static struct kmem_cache *vvp_thread_kmem;
 static struct kmem_cache *vvp_session_kmem;
+static struct kmem_cache *vvp_thread_kmem;
+
 static struct lu_kmem_descr vvp_caches[] = {
        {
+               .ckd_cache = &ll_thread_kmem,
+               .ckd_name  = "ll_thread_kmem",
+               .ckd_size  = sizeof(struct ll_thread_info),
+       },
+       {
                .ckd_cache = &vvp_lock_kmem,
                .ckd_name  = "vvp_lock_kmem",
                .ckd_size  = sizeof(struct vvp_lock),
@@ -79,38 +85,46 @@ static struct lu_kmem_descr vvp_caches[] = {
                .ckd_size  = sizeof(struct vvp_req),
        },
         {
-                .ckd_cache = &vvp_thread_kmem,
-                .ckd_name  = "vvp_thread_kmem",
-                .ckd_size  = sizeof (struct vvp_thread_info),
-        },
-        {
                 .ckd_cache = &vvp_session_kmem,
                 .ckd_name  = "vvp_session_kmem",
                 .ckd_size  = sizeof (struct vvp_session)
         },
+       {
+               .ckd_cache = &vvp_thread_kmem,
+               .ckd_name  = "vvp_thread_kmem",
+               .ckd_size  = sizeof(struct vvp_thread_info),
+       },
         {
                 .ckd_cache = NULL
         }
 };
 
-static void *vvp_key_init(const struct lu_context *ctx,
-                         struct lu_context_key *key)
+static void *ll_thread_key_init(const struct lu_context *ctx,
+                               struct lu_context_key *key)
 {
-       struct vvp_thread_info *info;
+       struct ll_thread_info *lti;
+
+       OBD_SLAB_ALLOC_PTR_GFP(lti, ll_thread_kmem, GFP_NOFS);
+       if (lti == NULL)
+               lti = ERR_PTR(-ENOMEM);
 
-       OBD_SLAB_ALLOC_PTR_GFP(info, vvp_thread_kmem, GFP_NOFS);
-       if (info == NULL)
-               info = ERR_PTR(-ENOMEM);
-       return info;
+       return lti;
 }
 
-static void vvp_key_fini(const struct lu_context *ctx,
-                         struct lu_context_key *key, void *data)
+static void ll_thread_key_fini(const struct lu_context *ctx,
+                              struct lu_context_key *key, void *data)
 {
-        struct vvp_thread_info *info = data;
-        OBD_SLAB_FREE_PTR(info, vvp_thread_kmem);
+       struct ll_thread_info *lti = data;
+
+       OBD_SLAB_FREE_PTR(lti, ll_thread_kmem);
 }
 
+struct lu_context_key ll_thread_key = {
+       .lct_tags = LCT_CL_THREAD,
+       .lct_init = ll_thread_key_init,
+       .lct_fini = ll_thread_key_fini,
+};
+
 static void *vvp_session_key_init(const struct lu_context *ctx,
                                  struct lu_context_key *key)
 {
@@ -129,21 +143,38 @@ static void vvp_session_key_fini(const struct lu_context *ctx,
         OBD_SLAB_FREE_PTR(session, vvp_session_kmem);
 }
 
-
-struct lu_context_key vvp_key = {
-        .lct_tags = LCT_CL_THREAD,
-        .lct_init = vvp_key_init,
-        .lct_fini = vvp_key_fini
-};
-
 struct lu_context_key vvp_session_key = {
         .lct_tags = LCT_SESSION,
         .lct_init = vvp_session_key_init,
         .lct_fini = vvp_session_key_fini
 };
 
+static void *vvp_thread_key_init(const struct lu_context *ctx,
+                                struct lu_context_key *key)
+{
+       struct vvp_thread_info *vti;
+
+       OBD_SLAB_ALLOC_PTR_GFP(vti, vvp_thread_kmem, GFP_NOFS);
+       if (vti == NULL)
+               vti = ERR_PTR(-ENOMEM);
+       return vti;
+}
+
+static void vvp_thread_key_fini(const struct lu_context *ctx,
+                               struct lu_context_key *key, void *data)
+{
+       struct vvp_thread_info *vti = data;
+       OBD_SLAB_FREE_PTR(vti, vvp_thread_kmem);
+}
+
+struct lu_context_key vvp_thread_key = {
+       .lct_tags = LCT_CL_THREAD,
+       .lct_init = vvp_thread_key_init,
+       .lct_fini = vvp_thread_key_fini,
+};
+
 /* type constructor/destructor: vvp_type_{init,fini,start,stop}(). */
-LU_TYPE_INIT_FINI(vvp, &ccc_key, &vvp_key, &vvp_session_key);
+LU_TYPE_INIT_FINI(vvp, &ll_thread_key, &vvp_session_key, &vvp_thread_key);
 
 static const struct lu_device_operations vvp_lu_ops = {
         .ldo_object_alloc      = vvp_object_alloc
@@ -261,24 +292,30 @@ struct lu_device_type vvp_device_type = {
  */
 int vvp_global_init(void)
 {
-        int result;
+       int rc;
 
-        result = lu_kmem_init(vvp_caches);
-        if (result == 0) {
-                result = ccc_global_init(&vvp_device_type);
-                if (result != 0)
-                        lu_kmem_fini(vvp_caches);
-        }
-        return result;
+       rc = lu_kmem_init(vvp_caches);
+       if (rc != 0)
+               return rc;
+
+       rc = lu_device_type_init(&vvp_device_type);
+       if (rc != 0)
+               goto out_kmem;
+
+       return 0;
+
+out_kmem:
+       lu_kmem_fini(vvp_caches);
+
+       return rc;
 }
 
 void vvp_global_fini(void)
 {
-        ccc_global_fini(&vvp_device_type);
-        lu_kmem_fini(vvp_caches);
+       lu_device_type_fini(&vvp_device_type);
+       lu_kmem_fini(vvp_caches);
 }
 
-
 /*****************************************************************************
  *
  * mirror obd-devices into cl devices.
index 16a869f..7d98e49 100644 (file)
@@ -53,34 +53,6 @@ struct obd_device;
 struct obd_export;
 struct page;
 
-blkcnt_t dirty_cnt(struct inode *inode);
-
-int cl_glimpse_size0(struct inode *inode, int agl);
-int cl_glimpse_lock(const struct lu_env *env, struct cl_io *io,
-                   struct inode *inode, struct cl_object *clob, int agl);
-
-static inline int cl_glimpse_size(struct inode *inode)
-{
-       return cl_glimpse_size0(inode, 0);
-}
-
-static inline int cl_agl(struct inode *inode)
-{
-       return cl_glimpse_size0(inode, 1);
-}
-
-/**
- * Locking policy for setattr.
- */
-enum ccc_setattr_lock_type {
-       /** Locking is done by server */
-       SETATTR_NOLOCK,
-       /** Extent lock is enqueued */
-       SETATTR_EXTENT_LOCK,
-       /** Existing local extent lock is used */
-       SETATTR_MATCH_LOCK
-};
-
 enum vvp_io_subtype {
        /** normal IO */
        IO_NORMAL,
@@ -139,9 +111,6 @@ struct vvp_io {
                        bool                     ft_flags_valid;
                } fault;
                struct {
-                       enum ccc_setattr_lock_type vui_local_lock;
-               } setattr;
-               struct {
                        struct pipe_inode_info  *vui_pipe;
                        unsigned int             vui_flags;
                } splice;
@@ -172,51 +141,53 @@ struct vvp_io {
        bool            vui_ra_valid;
 };
 
-extern struct lu_context_key ccc_key;
+extern struct lu_device_type vvp_device_type;
+
 extern struct lu_context_key vvp_session_key;
+extern struct lu_context_key vvp_thread_key;
 
 extern struct kmem_cache *vvp_lock_kmem;
 extern struct kmem_cache *vvp_object_kmem;
 extern struct kmem_cache *vvp_req_kmem;
 
-struct ccc_thread_info {
-       struct cl_lock          cti_lock;
-       struct cl_lock_descr    cti_descr;
-       struct cl_io            cti_io;
-       struct cl_attr          cti_attr;
+struct vvp_thread_info {
+       struct cl_lock          vti_lock;
+       struct cl_lock_descr    vti_descr;
+       struct cl_io            vti_io;
+       struct cl_attr          vti_attr;
 };
 
-static inline struct ccc_thread_info *ccc_env_info(const struct lu_env *env)
+static inline struct vvp_thread_info *vvp_env_info(const struct lu_env *env)
 {
-       struct ccc_thread_info      *info;
+       struct vvp_thread_info *vti;
 
-       info = lu_context_key_get(&env->le_ctx, &ccc_key);
-       LASSERT(info != NULL);
+       vti = lu_context_key_get(&env->le_ctx, &vvp_thread_key);
+       LASSERT(vti != NULL);
 
-       return info;
+       return vti;
 }
 
-static inline struct cl_lock *ccc_env_lock(const struct lu_env *env)
+static inline struct cl_lock *vvp_env_lock(const struct lu_env *env)
 {
-       struct cl_lock *lock = &ccc_env_info(env)->cti_lock;
+       struct cl_lock *lock = &vvp_env_info(env)->vti_lock;
 
        memset(lock, 0, sizeof(*lock));
 
        return lock;
 }
 
-static inline struct cl_attr *ccc_env_thread_attr(const struct lu_env *env)
+static inline struct cl_attr *vvp_env_thread_attr(const struct lu_env *env)
 {
-       struct cl_attr *attr = &ccc_env_info(env)->cti_attr;
+       struct cl_attr *attr = &vvp_env_info(env)->vti_attr;
 
        memset(attr, 0, sizeof(*attr));
 
        return attr;
 }
 
-static inline struct cl_io *ccc_env_thread_io(const struct lu_env *env)
+static inline struct cl_io *vvp_env_thread_io(const struct lu_env *env)
 {
-       struct cl_io *io = &ccc_env_info(env)->cti_io;
+       struct cl_io *io = &vvp_env_info(env)->vti_io;
 
        memset(io, 0, sizeof(*io));
 
@@ -224,7 +195,7 @@ static inline struct cl_io *ccc_env_thread_io(const struct lu_env *env)
 }
 
 struct vvp_session {
-       struct vvp_io cs_ios;
+       struct vvp_io vs_ios;
 };
 
 static inline struct vvp_session *vvp_env_session(const struct lu_env *env)
@@ -239,11 +210,11 @@ static inline struct vvp_session *vvp_env_session(const struct lu_env *env)
 
 static inline struct vvp_io *vvp_env_io(const struct lu_env *env)
 {
-       return &vvp_env_session(env)->cs_ios;
+       return &vvp_env_session(env)->vs_ios;
 }
 
 /**
- * ccc-private object state.
+ * VPP-private object state.
  */
 struct vvp_object {
        struct cl_object_header vob_header;
@@ -311,14 +282,6 @@ struct vvp_req {
        struct cl_req_slice vrq_cl;
 };
 
-void *ccc_key_init(const struct lu_context *ctx, struct lu_context_key *key);
-void ccc_key_fini(const struct lu_context *ctx, struct lu_context_key *key,
-                 void *data);
-
-void ccc_umount(const struct lu_env *env, struct cl_device *dev);
-int ccc_global_init(struct lu_device_type *device_type);
-void ccc_global_fini(struct lu_device_type *device_type);
-
 static inline struct lu_device *vvp2lu_dev(struct vvp_device *vdv)
 {
        return &vdv->vdv_cl.cd_lu_dev;
@@ -362,17 +325,6 @@ static inline struct vvp_lock *cl2vvp_lock(const struct cl_lock_slice *slice)
        return container_of(slice, struct vvp_lock, vlk_cl);
 }
 
-int cl_setattr_ost(struct inode *inode, const struct iattr *attr,
-                  struct obd_capa *capa);
-
-int cl_file_inode_init(struct inode *inode, struct lustre_md *md);
-void cl_inode_fini(struct inode *inode);
-int cl_local_size(struct inode *inode);
-
-__u16 ll_dirent_type_get(struct lu_dirent *ent);
-__u64 cl_fid_build_ino(const struct lu_fid *fid, int api32);
-__u32 cl_fid_build_gen(const struct lu_fid *fid);
-
 #ifdef CONFIG_LUSTRE_DEBUG_EXPENSIVE_CHECK
 # define CLOBINVRNT(env, clob, expr)                                   \
        do {                                                            \
@@ -387,22 +339,6 @@ __u32 cl_fid_build_gen(const struct lu_fid *fid);
        ((void)sizeof(env), (void)sizeof(clob), (void)sizeof !!(expr))
 #endif /* CONFIG_LUSTRE_DEBUG_EXPENSIVE_CHECK */
 
-int cl_init_ea_size(struct obd_export *md_exp, struct obd_export *dt_exp);
-int cl_ocd_update(struct obd_device *host,
-                 struct obd_device *watched,
-                 enum obd_notify_event ev, void *owner, void *data);
-
-struct ccc_grouplock {
-       struct lu_env   *cg_env;
-       struct cl_io    *cg_io;
-       struct cl_lock  *cg_lock;
-       unsigned long    cg_gid;
-};
-
-int cl_get_grouplock(struct cl_object *obj, unsigned long gid, int nonblock,
-                    struct ccc_grouplock *cg);
-void cl_put_grouplock(struct ccc_grouplock *cg);
-
 /**
  * New interfaces to get and put lov_stripe_md from lov layer. This violates
  * layering because lov_stripe_md is supposed to be a private data in lov.
@@ -417,14 +353,6 @@ int lov_read_and_clear_async_rc(struct cl_object *clob);
 struct lov_stripe_md *ccc_inode_lsm_get(struct inode *inode);
 void ccc_inode_lsm_put(struct inode *inode, struct lov_stripe_md *lsm);
 
-enum {
-       LUSTRE_OPC_MKDIR        = 0,
-       LUSTRE_OPC_SYMLINK      = 1,
-       LUSTRE_OPC_MKNOD        = 2,
-       LUSTRE_OPC_CREATE       = 3,
-       LUSTRE_OPC_ANY          = 5,
-};
-
 int vvp_io_init(const struct lu_env *env, struct cl_object *obj,
                struct cl_io *io);
 int vvp_io_write_commit(const struct lu_env *env, struct cl_io *io);
@@ -438,6 +366,9 @@ struct lu_object *vvp_object_alloc(const struct lu_env *env,
                                   const struct lu_object_header *hdr,
                                   struct lu_device *dev);
 
+int vvp_global_init(void);
+void vvp_global_fini(void);
+
 extern const struct file_operations vvp_dump_pgcache_file_ops;
 
 #endif /* VVP_INTERNAL_H */
index 3e75ffd..76cbb0d 100644 (file)
@@ -133,7 +133,7 @@ static int vvp_prep_size(const struct lu_env *env, struct cl_object *obj,
                         struct cl_io *io, loff_t start, size_t count,
                         int *exceed)
 {
-       struct cl_attr *attr  = ccc_env_thread_attr(env);
+       struct cl_attr *attr  = vvp_env_thread_attr(env);
        struct inode   *inode = vvp_object_inode(obj);
        loff_t          pos   = start + count - 1;
        loff_t kms;
@@ -236,7 +236,7 @@ static int vvp_io_one_lock_index(const struct lu_env *env, struct cl_io *io,
 
        if (vio->vui_fd && (vio->vui_fd->fd_flags & LL_FILE_GROUP_LOCKED)) {
                descr->cld_mode = CLM_GROUP;
-               descr->cld_gid  = vio->vui_fd->fd_grouplock.cg_gid;
+               descr->cld_gid  = vio->vui_fd->fd_grouplock.lg_gid;
        } else {
                descr->cld_mode  = mode;
        }
@@ -387,10 +387,10 @@ static enum cl_lock_mode vvp_mode_from_vma(struct vm_area_struct *vma)
 static int vvp_mmap_locks(const struct lu_env *env,
                          struct vvp_io *vio, struct cl_io *io)
 {
-        struct ccc_thread_info *cti = ccc_env_info(env);
+       struct vvp_thread_info *vti = vvp_env_info(env);
         struct mm_struct       *mm = current->mm;
         struct vm_area_struct  *vma;
-        struct cl_lock_descr   *descr = &cti->cti_descr;
+       struct cl_lock_descr   *descr = &vti->vti_descr;
         ldlm_policy_data_t      policy;
         unsigned long           addr;
         unsigned long           seg;
@@ -619,7 +619,6 @@ static int vvp_io_setattr_iter_init(const struct lu_env *env,
 static int vvp_io_setattr_lock(const struct lu_env *env,
                                const struct cl_io_slice *ios)
 {
-       struct vvp_io *vio = vvp_env_io(env);
        struct cl_io  *io  = ios->cis_io;
        __u64 new_size;
        __u32 enqflags = 0;
@@ -637,8 +636,6 @@ static int vvp_io_setattr_lock(const struct lu_env *env,
                 new_size = 0;
         }
 
-       vio->u.setattr.vui_local_lock = SETATTR_EXTENT_LOCK;
-
        return vvp_io_one_lock(env, io, enqflags, CLM_WRITE,
                               new_size, OBD_OBJECT_EOF);
 }
@@ -676,7 +673,7 @@ static int vvp_io_setattr_time(const struct lu_env *env,
 {
         struct cl_io       *io    = ios->cis_io;
         struct cl_object   *obj   = io->ci_obj;
-        struct cl_attr     *attr  = ccc_env_thread_attr(env);
+       struct cl_attr     *attr  = vvp_env_thread_attr(env);
         int result;
         unsigned valid = CAT_CTIME;