Whamcloud - gitweb
LU-6245 libcfs: remove cfs_fs_time handling
[fs/lustre-release.git] / lustre / mdd / mdd_internal.h
index 12929d6..44e97ce 100644 (file)
@@ -42,6 +42,7 @@
 #define _MDD_INTERNAL_H
 
 #include <lustre_acl.h>
+#include <lustre_compat.h>
 #include <lustre_eacl.h>
 #include <md_object.h>
 #include <dt_object.h>
@@ -74,10 +75,11 @@ struct mdd_changelog {
        int                     mc_lastuser;
 };
 
-static inline __u64 cl_time(void) {
-       cfs_fs_time_t time;
+static inline __u64 cl_time(void)
+{
+       struct timespec64 time;
 
-       cfs_fs_time_current(&time);
+       ktime_get_real_ts64(&time);
        return (((__u64)time.tv_sec) << 30) + time.tv_nsec;
 }
 
@@ -302,6 +304,7 @@ int mdd_changelog_ns_store(const struct lu_env *env, struct mdd_device *mdd,
                           const struct lu_name *tname,
                           const struct lu_name *sname,
                           struct thandle *handle);
+int mdd_invalidate(const struct lu_env *env, struct md_object *obj);
 int mdd_declare_object_create_internal(const struct lu_env *env,
                                       struct mdd_object *p,
                                       struct mdd_object *c,
@@ -571,39 +574,34 @@ mdo_xattr_list(const struct lu_env *env, struct mdd_object *obj,
        return dt_xattr_list(env, next, buf);
 }
 
+static inline int
+mdo_invalidate(const struct lu_env *env, struct mdd_object *obj)
+{
+       return dt_invalidate(env, mdd_object_child(obj));
+}
+
 static inline
 int mdo_declare_index_insert(const struct lu_env *env, struct mdd_object *obj,
                             const struct lu_fid *fid, __u32 type,
                             const char *name, struct thandle *handle)
 {
        struct dt_object *next  = mdd_object_child(obj);
-       int               rc    = 0;
+       int               rc;
 
        /*
         * if the object doesn't exist yet, then it's supposed to be created
         * and declaration of the creation should be enough to insert ./..
         */
 
-        /* FIXME: remote object should not be awared by MDD layer, but local
-         * creation does not declare insert ./.. (comments above), which
-         * is required by remote directory creation.
-         * This remote check should be removed when mdd_object_exists check is
-         * removed.
-         */
-       if (mdd_object_exists(obj) || mdd_object_remote(obj)) {
-               rc = -ENOTDIR;
-               if (dt_try_as_dir(env, next)) {
-                       struct dt_insert_rec *rec =
-                                       &mdd_env_info(env)->mti_dt_rec;
-
-                       rec->rec_fid = fid;
-                       rec->rec_type = type;
-                       rc = dt_declare_insert(env, next,
-                                              (const struct dt_rec *)rec,
-                                              (const struct dt_key *)name,
-                                              handle);
-               }
-        }
+       rc = -ENOTDIR;
+       if (dt_try_as_dir(env, next)) {
+               struct dt_insert_rec *rec = &mdd_env_info(env)->mti_dt_rec;
+
+               rec->rec_fid = fid;
+               rec->rec_type = type;
+               rc = dt_declare_insert(env, next, (const struct dt_rec *)rec,
+                                      (const struct dt_key *)name, handle);
+       }
 
         return rc;
 }