Whamcloud - gitweb
LU-6943 clio: get rid of cl_req
[fs/lustre-release.git] / lustre / llite / vvp_object.c
index f1a97f7..30dd2c7 100644 (file)
 
 #define DEBUG_SUBSYSTEM S_LLITE
 
-
+#include <linux/user_namespace.h>
+#ifdef HAVE_UIDGID_HEADER
+# include <linux/uidgid.h>
+#endif
 #include <libcfs/libcfs.h>
 
 #include <obd.h>
@@ -69,8 +72,7 @@ static int vvp_object_print(const struct lu_env *env, void *cookie,
        struct inode         *inode = obj->vob_inode;
        struct ll_inode_info *lli;
 
-       (*p)(env, cookie, "(%s %d %d) inode: %p ",
-            list_empty(&obj->vob_pending_list) ? "-" : "+",
+       (*p)(env, cookie, "(%d %d) inode: %p ",
             atomic_read(&obj->vob_transient_pages),
             atomic_read(&obj->vob_mmap_cnt),
             inode);
@@ -106,8 +108,8 @@ static int vvp_attr_get(const struct lu_env *env, struct cl_object *obj,
        return 0; /* layers below have to fill in the rest */
 }
 
-static int vvp_attr_set(const struct lu_env *env, struct cl_object *obj,
-                        const struct cl_attr *attr, unsigned valid)
+static int vvp_attr_update(const struct lu_env *env, struct cl_object *obj,
+                          const struct cl_attr *attr, unsigned valid)
 {
        struct inode *inode = vvp_object_inode(obj);
 
@@ -138,7 +140,7 @@ static int vvp_conf_set(const struct lu_env *env, struct cl_object *obj,
                CDEBUG(D_VFSTRACE, DFID ": losing layout lock\n",
                       PFID(&lli->lli_fid));
 
-               ll_layout_version_set(lli, LL_LAYOUT_GEN_NONE);
+               ll_layout_version_set(lli, CL_LAYOUT_GEN_NONE);
 
                /* Clean up page mmap for this inode.
                 * The reason for us to do this is that if the page has
@@ -192,15 +194,36 @@ static int vvp_object_glimpse(const struct lu_env *env,
        RETURN(0);
 }
 
+static void vvp_req_attr_set(const struct lu_env *env, struct cl_object *obj,
+                            struct cl_req_attr *attr)
+{
+       struct inode *inode;
+       struct obdo  *oa;
+       u64 valid_flags = OBD_MD_FLTYPE;
+
+       oa = attr->cra_oa;
+       inode = vvp_object_inode(obj);
+
+       if (attr->cra_type == CRT_WRITE)
+               valid_flags |= OBD_MD_FLMTIME | OBD_MD_FLCTIME |
+                              OBD_MD_FLUID | OBD_MD_FLGID;
+       obdo_from_inode(oa, inode, valid_flags & attr->cra_flags);
+       obdo_set_parent_fid(oa, &ll_i2info(inode)->lli_fid);
+       if (OBD_FAIL_CHECK(OBD_FAIL_LFSCK_INVALID_PFID))
+               oa->o_parent_oid++;
+       memcpy(attr->cra_jobid, ll_i2info(inode)->lli_jobid, LUSTRE_JOBID_SIZE);
+}
+
 static const struct cl_object_operations vvp_ops = {
-       .coo_page_init = vvp_page_init,
-       .coo_lock_init = vvp_lock_init,
-       .coo_io_init   = vvp_io_init,
-       .coo_attr_get  = vvp_attr_get,
-       .coo_attr_set  = vvp_attr_set,
-       .coo_conf_set  = vvp_conf_set,
-       .coo_prune     = vvp_prune,
-       .coo_glimpse   = vvp_object_glimpse
+       .coo_page_init    = vvp_page_init,
+       .coo_lock_init    = vvp_lock_init,
+       .coo_io_init      = vvp_io_init,
+       .coo_attr_get     = vvp_attr_get,
+       .coo_attr_update  = vvp_attr_update,
+       .coo_conf_set     = vvp_conf_set,
+       .coo_prune        = vvp_prune,
+       .coo_glimpse      = vvp_object_glimpse,
+       .coo_req_attr_set = vvp_req_attr_set
 };
 
 static int vvp_object_init0(const struct lu_env *env,
@@ -209,7 +232,7 @@ static int vvp_object_init0(const struct lu_env *env,
 {
        vob->vob_inode = conf->coc_inode;
        atomic_set(&vob->vob_transient_pages, 0);
-       cl_object_page_init(&vob->vob_cl, sizeof(struct ccc_page));
+       cl_object_page_init(&vob->vob_cl, sizeof(struct vvp_page));
        return 0;
 }
 
@@ -228,7 +251,6 @@ static int vvp_object_init(const struct lu_env *env, struct lu_object *obj,
                const struct cl_object_conf *cconf;
 
                cconf = lu2cl_conf(conf);
-               INIT_LIST_HEAD(&vob->vob_pending_list);
                lu_object_add(obj, below);
                result = vvp_object_init0(env, vob, cconf);
        } else