Whamcloud - gitweb
LU-12702 quota: wait pending write before acquiring remotely
[fs/lustre-release.git] / lustre / include / dt_object.h
index 601b918..e1d574a 100644 (file)
@@ -88,6 +88,7 @@ struct dt_device_param {
        unsigned int       ddp_brw_size;        /* optimal RPC size */
        /* T10PI checksum type, zero if not supported */
        enum cksum_types   ddp_t10_cksum_type;
+       bool               ddp_has_lseek_data_hole;
 };
 
 /**
@@ -297,6 +298,17 @@ struct dt_device_operations {
                       struct dt_device *dev);
 
        /**
+        * Wait pending quota update finish
+        *
+        * There might be a window that quota usage has been updated,
+        * but commit callback to reduce pending write have not been
+        * finished, this is used to wait all pending update done.
+        *
+        * \param[in] dev       dt device
+        */
+       void (*dt_wait_quota_pending)(struct dt_device *dev);
+
+       /**
         * Start transaction commit asynchronously.
         *
 
@@ -2256,7 +2268,8 @@ static inline int dt_declare_record_write(const struct lu_env *env,
 
        LASSERTF(dt != NULL, "dt is NULL when we want to write record\n");
        LASSERT(th != NULL);
-       LASSERT(dt->do_body_ops);
+       LASSERTF(dt->do_body_ops, DFID" doesn't exit\n",
+                PFID(lu_object_fid(&dt->do_lu)));
        LASSERT(dt->do_body_ops->dbo_declare_write);
        rc = dt->do_body_ops->dbo_declare_write(env, dt, buf, pos, th);
        return rc;
@@ -2586,9 +2599,9 @@ static inline int dt_ladvise(const struct lu_env *env, struct dt_object *dt,
        return dt->do_body_ops->dbo_ladvise(env, dt, start, end, advice);
 }
 
-static inline int dt_declare_falloc(const struct lu_env *env,
-                                   struct dt_object *dt, __u64 start,
-                                   __u64 end, int mode, struct thandle *th)
+static inline int dt_declare_fallocate(const struct lu_env *env,
+                                      struct dt_object *dt, __u64 start,
+                                      __u64 end, int mode, struct thandle *th)
 {
        LASSERT(dt);
        if (!dt->do_body_ops)
@@ -2695,6 +2708,14 @@ static inline int dt_ro(const struct lu_env *env, struct dt_device *dev)
         return dev->dd_ops->dt_ro(env, dev);
 }
 
+static inline void dt_wait_quota_pending(struct dt_device *dev)
+{
+       LASSERT(dev);
+       LASSERT(dev->dd_ops);
+       if (dev->dd_ops->dt_wait_quota_pending)
+               dev->dd_ops->dt_wait_quota_pending(dev);
+}
+
 static inline int dt_declare_insert(const struct lu_env *env,
                                     struct dt_object *dt,
                                     const struct dt_rec *rec,