Whamcloud - gitweb
LU-8753 osp: add rpc generation
[fs/lustre-release.git] / lustre / include / dt_object.h
index aeaca2a..588d0c3 100644 (file)
  *
  * You should have received a copy of the GNU General Public License
  * version 2 along with this program; If not, see
- * http://www.sun.com/software/products/lustre/docs/GPLv2.pdf
- *
- * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
- * CA 95054 USA or visit www.sun.com if you need additional information or
- * have any questions.
+ * http://www.gnu.org/licenses/gpl-2.0.html
  *
  * GPL HEADER END
  */
@@ -27,7 +23,7 @@
  * Copyright (c) 2007, 2010, Oracle and/or its affiliates. All rights reserved.
  * Use is subject to license terms.
  *
- * Copyright (c) 2011, 2013, Intel Corporation.
+ * Copyright (c) 2011, 2016, Intel Corporation.
  */
 /*
  * This file is part of Lustre, http://www.lustre.org/
@@ -75,20 +71,20 @@ typedef enum {
 } mntopt_t;
 
 struct dt_device_param {
-        unsigned           ddp_max_name_len;
-        unsigned           ddp_max_nlink;
-        unsigned           ddp_block_shift;
-        mntopt_t           ddp_mntopts;
-        unsigned           ddp_max_ea_size;
-        int                ddp_mount_type;
-        unsigned long long ddp_maxbytes;
-        /* percentage of available space to reserve for grant error margin */
-        int                ddp_grant_reserved;
-        /* per-inode space consumption */
-        short              ddp_inodespace;
-        /* per-fragment grant overhead to be used by client for grant
-         * calculation */
-        int                ddp_grant_frag;
+       unsigned           ddp_max_name_len;
+       unsigned           ddp_max_nlink;
+       unsigned           ddp_symlink_max;
+       mntopt_t           ddp_mntopts;
+       unsigned           ddp_max_ea_size;
+       unsigned           ddp_mount_type;
+       unsigned long long ddp_maxbytes;
+       /* per-inode space consumption */
+       short              ddp_inodespace;
+       /* maximum number of blocks in an extent */
+       unsigned           ddp_max_extent_blks;
+       /* per-extent insertion overhead to be used by client for grant
+        * calculation */
+       unsigned           ddp_extent_tax;
 };
 
 /**
@@ -104,10 +100,13 @@ typedef void (*dt_cb_t)(struct lu_env *env, struct thandle *th,
 #define TRANS_COMMIT_CB_MAGIC  0xa0a00a0a
 #define MAX_COMMIT_CB_STR_LEN  32
 
+#define DCB_TRANS_STOP         0x1
 struct dt_txn_commit_cb {
        struct list_head        dcb_linkage;
        dt_cb_t                 dcb_func;
+       void                    *dcb_data;
        __u32                   dcb_magic;
+       __u32                   dcb_flags;
        char                    dcb_name[MAX_COMMIT_CB_STR_LEN];
 };
 
@@ -304,16 +303,6 @@ struct dt_device_operations {
         */
          int   (*dt_commit_async)(const struct lu_env *env,
                                   struct dt_device *dev);
-
-        /**
-         * Not used, subject to removal.
-         */
-        int   (*dt_init_capa_ctxt)(const struct lu_env *env,
-                                   struct dt_device *dev,
-                                   int mode,
-                                   unsigned long timeout,
-                                   __u32 alg,
-                                   struct lustre_capa_key *keys);
 };
 
 struct dt_index_features {
@@ -353,8 +342,9 @@ enum dt_index_flags {
  */
 extern const struct dt_index_features dt_directory_features;
 extern const struct dt_index_features dt_otable_features;
-extern const struct dt_index_features dt_lfsck_orphan_features;
-extern const struct dt_index_features dt_lfsck_features;
+extern const struct dt_index_features dt_lfsck_layout_orphan_features;
+extern const struct dt_index_features dt_lfsck_layout_dangling_features;
+extern const struct dt_index_features dt_lfsck_namespace_features;
 
 /* index features supported by the accounting objects */
 extern const struct dt_index_features dt_acct_features;
@@ -365,6 +355,9 @@ extern const struct dt_index_features dt_quota_glb_features;
 /* index features supported by the quota slave indexes */
 extern const struct dt_index_features dt_quota_slv_features;
 
+/* index features supported by the nodemap index */
+extern const struct dt_index_features dt_nodemap_features;
+
 /**
  * This is a general purpose dt allocation hint.
  * It now contains the parent object.
@@ -501,14 +494,12 @@ struct dt_object_operations {
         *
         * \param[in] env       execution environment for this thread
         * \param[in] dt        object
-        * \param[in] capa      unused
         *
         * \retval 0            on success
         * \retval negative     negated errno on error
         */
        int   (*do_declare_attr_get)(const struct lu_env *env,
-                                    struct dt_object *dt,
-                                    struct lustre_capa *capa);
+                                    struct dt_object *dt);
 
        /**
         * Return regular attributes.
@@ -522,15 +513,13 @@ struct dt_object_operations {
         * \param[in] env       execution environment for this thread
         * \param[in] dt        object
         * \param[out] attr     attributes to fill
-        * \param[in] capa      unused
         *
         * \retval 0            on success
         * \retval negative     negated errno on error
         */
        int   (*do_attr_get)(const struct lu_env *env,
                             struct dt_object *dt,
-                            struct lu_attr *attr,
-                            struct lustre_capa *capa);
+                            struct lu_attr *attr);
 
        /**
         * Declare intention to change regular object's attributes.
@@ -568,7 +557,6 @@ struct dt_object_operations {
         * \param[in] dt        object
         * \param[in] attr      new attributes to apply
         * \param[in] th        transaction handle
-        * \param[in] capa      unused
         *
         * \retval 0            on success
         * \retval negative     negated errno on error
@@ -576,8 +564,7 @@ struct dt_object_operations {
         int   (*do_attr_set)(const struct lu_env *env,
                              struct dt_object *dt,
                              const struct lu_attr *attr,
-                            struct thandle *th,
-                             struct lustre_capa *capa);
+                            struct thandle *th);
 
        /**
         * Declare intention to request extented attribute.
@@ -593,7 +580,6 @@ struct dt_object_operations {
         * \param[in] dt        object
         * \param[in] buf       unused, may be removed in the future
         * \param[in] name      name of the extended attribute
-        * \param[in] capa      unused, may be removed in the future
         *
         * \retval 0            on success
         * \retval negative     negated errno on error
@@ -601,8 +587,7 @@ struct dt_object_operations {
        int   (*do_declare_xattr_get)(const struct lu_env *env,
                                      struct dt_object *dt,
                                      struct lu_buf *buf,
-                                     const char *name,
-                                     struct lustre_capa *capa);
+                                     const char *name);
 
        /**
         * Return a value of an extended attribute.
@@ -614,7 +599,6 @@ struct dt_object_operations {
         * \param[in] dt        object
         * \param[out] buf      buffer in which to store the value
         * \param[in] name      name of the extended attribute
-        * \param[in] capa      unused
         *
         * \retval 0            on success
         * \retval -ERANGE      if \a buf is too small
@@ -624,8 +608,7 @@ struct dt_object_operations {
        int   (*do_xattr_get)(const struct lu_env *env,
                              struct dt_object *dt,
                              struct lu_buf *buf,
-                             const char *name,
-                             struct lustre_capa *capa);
+                             const char *name);
 
        /**
         * Declare intention to change an extended attribute.
@@ -670,7 +653,6 @@ struct dt_object_operations {
         * \param[in] name      name of the attribute
         * \param[in] fl        flags indicating EA creation or replacement
         * \param[in] th        transaction handle
-        * \param[in] capa      unused
         *
         * \retval 0            on success
         * \retval negative     negated errno on error
@@ -680,8 +662,7 @@ struct dt_object_operations {
                              const struct lu_buf *buf,
                              const char *name,
                              int fl,
-                             struct thandle *th,
-                             struct lustre_capa *capa);
+                             struct thandle *th);
 
        /**
         * Declare intention to delete an extended attribute.
@@ -715,7 +696,6 @@ struct dt_object_operations {
         * \param[in] dt        object
         * \param[in] name      name of the attribute
         * \param[in] th        transaction handle
-        * \param[in] capa      unused
         *
         * \retval 0            on success
         * \retval negative     negated errno on error
@@ -723,8 +703,7 @@ struct dt_object_operations {
        int   (*do_xattr_del)(const struct lu_env *env,
                              struct dt_object *dt,
                              const char *name,
-                             struct thandle *th,
-                             struct lustre_capa *capa);
+                             struct thandle *th);
 
        /**
         * Return a list of the extended attributes.
@@ -736,15 +715,13 @@ struct dt_object_operations {
         * \param[in] env       execution environment for this thread
         * \param[in] dt        object
         * \param[out] buf      buffer to put the list in
-        * \param[in] capa      unused
         *
         * \retval positive     bytes used/required in the buffer
         * \retval negative     negated errno on error
          */
        int   (*do_xattr_list)(const struct lu_env *env,
                               struct dt_object *dt,
-                              struct lu_buf *buf,
-                              struct lustre_capa *capa);
+                              const struct lu_buf *buf);
 
        /**
         * Prepare allocation hint for a new object.
@@ -969,14 +946,6 @@ struct dt_object_operations {
                            struct thandle *th);
 
        /**
-        * Not used, subject to removal.
-        */
-       struct obd_capa *(*do_capa_get)(const struct lu_env *env,
-                                       struct dt_object *dt,
-                                       struct lustre_capa *old,
-                                       __u64 opc);
-
-       /**
         * Sync obect.
         *
         * The method is called to sync specified range of the object to a
@@ -1003,13 +972,6 @@ struct dt_object_operations {
                              __u64 end);
 
        /**
-        * Not used, subject to removal.
-        */
-       int (*do_data_get)(const struct lu_env *env,
-                          struct dt_object *dt,
-                          void **data);
-
-       /**
         * Lock object.
         *
         * Lock object(s) using Distributed Lock Manager (LDLM).
@@ -1050,6 +1012,20 @@ struct dt_object_operations {
                                struct dt_object *dt,
                                struct ldlm_enqueue_info *einfo,
                                union ldlm_policy_data *policy);
+
+       /**
+        * Invalidate attribute cache.
+        *
+        * This method invalidate attribute cache of the object, which is on OSP
+        * only.
+        *
+        * \param[in] env       execution envionment for this thread
+        * \param[in] dt        object
+        *
+        * \retval 0            on success
+        * \retval negative     negated errno on error
+        */
+       int   (*do_invalidate)(const struct lu_env *env, struct dt_object *dt);
 };
 
 /**
@@ -1067,7 +1043,6 @@ struct dt_body_operations {
         * \param[out] buf      buffer (including size) to copy data in
         * \param[in] pos       position in the object to start
         * \param[out] pos      original value of \a pos + bytes returned
-        * \param[in] capa      unused
         *
         * \retval positive     bytes read on success
         * \retval negative     negated errno on error
@@ -1075,8 +1050,7 @@ struct dt_body_operations {
        ssize_t (*dbo_read)(const struct lu_env *env,
                            struct dt_object *dt,
                            struct lu_buf *buf,
-                           loff_t *pos,
-                           struct lustre_capa *capa);
+                           loff_t *pos);
 
        /**
         * Declare intention to write data to object.
@@ -1122,7 +1096,6 @@ struct dt_body_operations {
         * \param[in] pos       position in the object to start
         * \param[out] pos      \a pos + bytes written
         * \param[in] th        transaction handle
-        * \param[in] capa      unused
         * \param[in] ignore    unused (was used to request quota ignorance)
         *
         * \retval positive     bytes written on success
@@ -1133,7 +1106,6 @@ struct dt_body_operations {
                             const struct lu_buf *buf,
                             loff_t *pos,
                             struct thandle *th,
-                            struct lustre_capa *capa,
                             int ignore);
 
        /**
@@ -1152,7 +1124,7 @@ struct dt_body_operations {
         * at object's offset lnb_file_offset.
         *
         * The memory referenced by the descriptors can't change its purpose
-        * until the complimentary ->dbo_bufs_put() is called. The caller should
+        * until the complementary ->dbo_bufs_put() is called. The caller should
         * specify if the buffers are used to read or modify data so that OSD
         * can decide how to initialize the buffers: bring all the data for
         * reads or just bring partial buffers for write. Note: the method does
@@ -1164,7 +1136,6 @@ struct dt_body_operations {
         * \param[in] len       size of region in bytes
         * \param[out] lb       array of descriptors to fill
         * \param[in] rw        0 if used to read, 1 if used for write
-        * \param[in] capa      unused
         *
         * \retval positive     number of descriptors on success
         * \retval negative     negated errno on error
@@ -1174,8 +1145,7 @@ struct dt_body_operations {
                            loff_t pos,
                            ssize_t len,
                            struct niobuf_local *lb,
-                           int rw,
-                           struct lustre_capa *capa);
+                           int rw);
 
        /**
         * Release reference granted by ->dbo_bufs_get().
@@ -1312,7 +1282,7 @@ struct dt_body_operations {
         */
        int (*dbo_fiemap_get)(const struct lu_env *env,
                              struct dt_object *dt,
-                             struct ll_user_fiemap *fm);
+                             struct fiemap *fm);
 
        /**
         * Declare intention to deallocate space from an object.
@@ -1350,7 +1320,6 @@ struct dt_body_operations {
         * \param[in] start     the start of the region to deallocate
         * \param[in] end       the end of the region to deallocate
         * \param[in] th        transaction handle
-        * \param[in] capa      unused
         *
         * \retval 0            on success
         * \retval negative     negated errno on error
@@ -1359,8 +1328,28 @@ struct dt_body_operations {
                           struct dt_object *dt,
                           __u64 start,
                           __u64 end,
-                          struct thandle *th,
-                          struct lustre_capa *capa);
+                          struct thandle *th);
+       /**
+        * Give advices on specified region in an object.
+        *
+        * This method is used to give advices about access pattern on an
+        * given region of the object. The disk filesystem understands
+        * the advices and tunes cache/read-ahead policies.
+        *
+        * \param[in] env       execution environment for this thread
+        * \param[in] dt        object
+        * \param[in] start     the start of the region affected
+        * \param[in] end       the end of the region affected
+        * \param[in] advice    advice type
+        *
+        * \retval 0            on success
+        * \retval negative     negated errno on error
+        */
+       int   (*dbo_ladvise)(const struct lu_env *env,
+                            struct dt_object *dt,
+                            __u64 start,
+                            __u64 end,
+                            enum lu_ladvise_type advice);
 };
 
 /**
@@ -1401,7 +1390,6 @@ struct dt_index_operations {
         * \param[in] dt        object
         * \param[out] rec      buffer where value will be stored
         * \param[in] key       key
-        * \param[in] capa      unused
         *
         * \retval 0            on success
         * \retval -ENOENT      if key isn't found
@@ -1410,8 +1398,7 @@ struct dt_index_operations {
        int (*dio_lookup)(const struct lu_env *env,
                          struct dt_object *dt,
                          struct dt_rec *rec,
-                         const struct dt_key *key,
-                         struct lustre_capa *capa);
+                         const struct dt_key *key);
 
        /**
         * Declare intention to insert a key/value into an index.
@@ -1452,7 +1439,6 @@ struct dt_index_operations {
         * \param[in] rec       buffer storing value
         * \param[in] key       key
         * \param[in] th        transaction handle
-        * \param[in] capa      unused
         * \param[in] ignore    unused (was used to request quota ignorance)
         *
         * \retval 0            on success
@@ -1463,7 +1449,6 @@ struct dt_index_operations {
                          const struct dt_rec *rec,
                          const struct dt_key *key,
                          struct thandle *th,
-                         struct lustre_capa *capa,
                          int ignore);
 
        /**
@@ -1501,7 +1486,6 @@ struct dt_index_operations {
         * \param[in] dt        object
         * \param[in] key       key
         * \param[in] th        transaction handle
-        * \param[in] capa      unused
         *
         * \retval 0            on success
         * \retval negative     negated errno on error
@@ -1509,8 +1493,7 @@ struct dt_index_operations {
        int (*dio_delete)(const struct lu_env *env,
                          struct dt_object *dt,
                          const struct dt_key *key,
-                         struct thandle *th,
-                         struct lustre_capa *capa);
+                         struct thandle *th);
 
         /**
         * Iterator interface.
@@ -1531,15 +1514,13 @@ struct dt_index_operations {
                 * \param[in] dt        object
                 * \param[in] attr      ask the iterator to return part of
                                        the records, see LUDA_* for details
-                * \param[in] capa      unused
                 *
                 * \retval pointer      iterator pointer on success
                 * \retval ERR_PTR(errno)       on error
                  */
                 struct dt_it *(*init)(const struct lu_env *env,
-                                      struct dt_object *dt,
-                                      __u32 attr,
-                                      struct lustre_capa *capa);
+                                     struct dt_object *dt,
+                                     __u32 attr);
 
                /**
                 * Release iterator.
@@ -1738,7 +1719,7 @@ enum dt_otable_it_flags {
        DOIF_DRYRUN     = 0x0008,
 };
 
-/* otable based iteration needs to use the common DT interation APIs.
+/* otable based iteration needs to use the common DT iteration APIs.
  * To initialize the iteration, it needs call dio_it::init() firstly.
  * Here is how the otable based iteration should prepare arguments to
  * call dt_it_ops::init().
@@ -1833,18 +1814,11 @@ static inline struct dt_object *lu2dt_obj(struct lu_object *o)
        return container_of0(o, struct dt_object, do_lu);
 }
 
-struct thandle_update {
-       /* In DNE, one transaction can be disassembled into
-        * updates on several different MDTs, and these updates
-        * will be attached to tu_remote_update_list per target.
-        * Only single thread will access the list, no need lock
-        */
-       struct list_head        tu_remote_update_list;
-
-       /* sent after or before local transaction */
-       unsigned int            tu_sent_after_local_trans:1,
-                               tu_only_remote_trans:1;
-};
+static inline struct dt_object *dt_object_child(struct dt_object *o)
+{
+       return container_of0(lu_object_next(&(o)->do_lu),
+                            struct dt_object, do_lu);
+}
 
 /**
  * This is the general purpose transaction handle.
@@ -1864,10 +1838,13 @@ struct thandle {
        /** the dt device on which the transactions are executed */
        struct dt_device *th_dev;
 
-       atomic_t        th_refc;
-       /* the size of transaction */
-       int             th_alloc_size;
-
+       /* point to the top thandle, XXX this is a bit hacky right now,
+        * but normal device trans callback triggered by the bottom
+        * device (OSP/OSD == sub thandle layer) needs to get the
+        * top_thandle (see dt_txn_hook_start/stop()), so we put the
+        * top thandle here for now, will fix it when we have better
+        * callback mechanism */
+       struct thandle  *th_top;
        /** context for this transaction, tag is LCT_TX_HANDLE */
        struct lu_context th_ctx;
 
@@ -1879,27 +1856,17 @@ struct thandle {
        __s32             th_result;
 
        /** whether we need sync commit */
-       unsigned int            th_sync:1;
-
+       unsigned int            th_sync:1,
        /* local transation, no need to inform other layers */
-       unsigned int            th_local:1;
-
-       struct thandle_update   *th_update;
+                               th_local:1,
+       /* Whether we need wait the transaction to be submitted
+        * (send to remote target) */
+                               th_wait_submit:1,
+       /* complex transaction which will track updates on all targets,
+        * including OSTs */
+                               th_complex:1;
 };
 
-static inline void thandle_get(struct thandle *thandle)
-{
-       atomic_inc(&thandle->th_refc);
-}
-
-static inline void thandle_put(struct thandle *thandle)
-{
-       if (atomic_dec_and_test(&thandle->th_refc)) {
-               if (thandle->th_update != NULL)
-                       OBD_FREE_PTR(thandle->th_update);
-               OBD_FREE(thandle, thandle->th_alloc_size);
-       }
-}
 /**
  * Transaction call-backs.
  *
@@ -1976,6 +1943,18 @@ dt_locate(const struct lu_env *env, struct dt_device *dev,
                            dev->dd_lu_dev.ld_site->ls_top_dev, NULL);
 }
 
+static inline struct dt_object *
+dt_object_locate(struct dt_object *dto, struct dt_device *dt_dev)
+{
+       struct lu_object *lo;
+
+       list_for_each_entry(lo, &dto->do_lu.lo_header->loh_layers, lo_linkage) {
+               if (lo->lo_dev == &dt_dev->dd_lu_dev)
+                       return container_of(lo, struct dt_object, do_lu);
+       }
+       return NULL;
+}
+
 int local_oid_storage_init(const struct lu_env *env, struct dt_device *dev,
                           const struct lu_fid *first_fid,
                           struct local_oid_storage **los);
@@ -2069,7 +2048,7 @@ int dt_record_read(const struct lu_env *env, struct dt_object *dt,
 int dt_record_write(const struct lu_env *env, struct dt_object *dt,
                     const struct lu_buf *buf, loff_t *pos, struct thandle *th);
 typedef int (*dt_index_page_build_t)(const struct lu_env *env,
-                                    union lu_page *lp, int nob,
+                                    union lu_page *lp, size_t nob,
                                     const struct dt_it_ops *iops,
                                     struct dt_it *it, __u32 attr, void *arg);
 int dt_index_walk(const struct lu_env *env, struct dt_object *obj,
@@ -2244,8 +2223,7 @@ static inline int dt_write_locked(const struct lu_env *env,
 }
 
 static inline int dt_declare_attr_get(const struct lu_env *env,
-                                     struct dt_object *dt,
-                                     struct lustre_capa *capa)
+                                     struct dt_object *dt)
 {
        LASSERT(dt);
        LASSERT(dt->do_ops);
@@ -2254,11 +2232,11 @@ static inline int dt_declare_attr_get(const struct lu_env *env,
        if (CFS_FAULT_CHECK(OBD_FAIL_DT_DECLARE_ATTR_GET))
                return cfs_fail_err;
 
-       return dt->do_ops->do_declare_attr_get(env, dt, capa);
+       return dt->do_ops->do_declare_attr_get(env, dt);
 }
 
 static inline int dt_attr_get(const struct lu_env *env, struct dt_object *dt,
-                              struct lu_attr *la, void *arg)
+                             struct lu_attr *la)
 {
         LASSERT(dt);
         LASSERT(dt->do_ops);
@@ -2267,7 +2245,7 @@ static inline int dt_attr_get(const struct lu_env *env, struct dt_object *dt,
        if (CFS_FAULT_CHECK(OBD_FAIL_DT_ATTR_GET))
                return cfs_fail_err;
 
-        return dt->do_ops->do_attr_get(env, dt, la, arg);
+       return dt->do_ops->do_attr_get(env, dt, la);
 }
 
 static inline int dt_declare_attr_set(const struct lu_env *env,
@@ -2286,8 +2264,7 @@ static inline int dt_declare_attr_set(const struct lu_env *env,
 }
 
 static inline int dt_attr_set(const struct lu_env *env, struct dt_object *dt,
-                              const struct lu_attr *la, struct thandle *th,
-                              struct lustre_capa *capa)
+                             const struct lu_attr *la, struct thandle *th)
 {
         LASSERT(dt);
         LASSERT(dt->do_ops);
@@ -2296,7 +2273,7 @@ static inline int dt_attr_set(const struct lu_env *env, struct dt_object *dt,
        if (CFS_FAULT_CHECK(OBD_FAIL_DT_ATTR_SET))
                return cfs_fail_err;
 
-        return dt->do_ops->do_attr_set(env, dt, la, th, capa);
+       return dt->do_ops->do_attr_set(env, dt, la, th);
 }
 
 static inline int dt_declare_ref_add(const struct lu_env *env,
@@ -2351,26 +2328,15 @@ static inline int dt_ref_del(const struct lu_env *env,
         return dt->do_ops->do_ref_del(env, dt, th);
 }
 
-static inline struct obd_capa *dt_capa_get(const struct lu_env *env,
-                                           struct dt_object *dt,
-                                           struct lustre_capa *old, __u64 opc)
-{
-        LASSERT(dt);
-        LASSERT(dt->do_ops);
-       LASSERT(dt->do_ops->do_capa_get);
-        return dt->do_ops->do_capa_get(env, dt, old, opc);
-}
-
 static inline int dt_bufs_get(const struct lu_env *env, struct dt_object *d,
                              struct niobuf_remote *rnb,
-                             struct niobuf_local *lnb, int rw,
-                             struct lustre_capa *capa)
+                             struct niobuf_local *lnb, int rw)
 {
        LASSERT(d);
        LASSERT(d->do_body_ops);
        LASSERT(d->do_body_ops->dbo_bufs_get);
        return d->do_body_ops->dbo_bufs_get(env, d, rnb->rnb_offset,
-                                           rnb->rnb_len, lnb, rw, capa);
+                                           rnb->rnb_len, lnb, rw);
 }
 
 static inline int dt_bufs_put(const struct lu_env *env, struct dt_object *d,
@@ -2421,6 +2387,27 @@ static inline int dt_read_prep(const struct lu_env *env, struct dt_object *d,
         return d->do_body_ops->dbo_read_prep(env, d, lnb, n);
 }
 
+static inline int dt_declare_write(const struct lu_env *env,
+                                  struct dt_object *dt,
+                                  const struct lu_buf *buf, loff_t pos,
+                                  struct thandle *th)
+{
+       LASSERT(dt);
+       LASSERT(dt->do_body_ops);
+       LASSERT(dt->do_body_ops->dbo_declare_write);
+       return dt->do_body_ops->dbo_declare_write(env, dt, buf, pos, th);
+}
+
+static inline ssize_t dt_write(const struct lu_env *env, struct dt_object *dt,
+                              const struct lu_buf *buf, loff_t *pos,
+                              struct thandle *th, int rq)
+{
+       LASSERT(dt);
+       LASSERT(dt->do_body_ops);
+       LASSERT(dt->do_body_ops->dbo_write);
+       return dt->do_body_ops->dbo_write(env, dt, buf, pos, th, rq);
+}
+
 static inline int dt_declare_punch(const struct lu_env *env,
                                    struct dt_object *dt, __u64 start,
                                    __u64 end, struct thandle *th)
@@ -2432,17 +2419,25 @@ static inline int dt_declare_punch(const struct lu_env *env,
 }
 
 static inline int dt_punch(const struct lu_env *env, struct dt_object *dt,
-                           __u64 start, __u64 end, struct thandle *th,
-                           struct lustre_capa *capa)
+                          __u64 start, __u64 end, struct thandle *th)
 {
         LASSERT(dt);
         LASSERT(dt->do_body_ops);
         LASSERT(dt->do_body_ops->dbo_punch);
-        return dt->do_body_ops->dbo_punch(env, dt, start, end, th, capa);
+       return dt->do_body_ops->dbo_punch(env, dt, start, end, th);
+}
+
+static inline int dt_ladvise(const struct lu_env *env, struct dt_object *dt,
+                            __u64 start, __u64 end, int advice)
+{
+       LASSERT(dt);
+       LASSERT(dt->do_body_ops);
+       LASSERT(dt->do_body_ops->dbo_ladvise);
+       return dt->do_body_ops->dbo_ladvise(env, dt, start, end, advice);
 }
 
 static inline int dt_fiemap_get(const struct lu_env *env, struct dt_object *d,
-                                struct ll_user_fiemap *fm)
+                               struct fiemap *fm)
 {
         LASSERT(d);
         if (d->do_body_ops == NULL)
@@ -2509,7 +2504,7 @@ static inline int dt_declare_insert(const struct lu_env *env,
        if (CFS_FAULT_CHECK(OBD_FAIL_DT_DECLARE_INSERT))
                return cfs_fail_err;
 
-        return dt->do_index_ops->dio_declare_insert(env, dt, rec, key, th);
+       return dt->do_index_ops->dio_declare_insert(env, dt, rec, key, th);
 }
 
 static inline int dt_insert(const struct lu_env *env,
@@ -2517,7 +2512,6 @@ static inline int dt_insert(const struct lu_env *env,
                                     const struct dt_rec *rec,
                                     const struct dt_key *key,
                                     struct thandle *th,
-                                    struct lustre_capa *capa,
                                     int noquota)
 {
         LASSERT(dt);
@@ -2527,8 +2521,7 @@ static inline int dt_insert(const struct lu_env *env,
        if (CFS_FAULT_CHECK(OBD_FAIL_DT_INSERT))
                return cfs_fail_err;
 
-        return dt->do_index_ops->dio_insert(env, dt, rec, key, th,
-                                            capa, noquota);
+       return dt->do_index_ops->dio_insert(env, dt, rec, key, th, noquota);
 }
 
 static inline int dt_declare_xattr_del(const struct lu_env *env,
@@ -2547,9 +2540,8 @@ static inline int dt_declare_xattr_del(const struct lu_env *env,
 }
 
 static inline int dt_xattr_del(const struct lu_env *env,
-                               struct dt_object *dt, const char *name,
-                               struct thandle *th,
-                               struct lustre_capa *capa)
+                              struct dt_object *dt, const char *name,
+                              struct thandle *th)
 {
         LASSERT(dt);
         LASSERT(dt->do_ops);
@@ -2558,7 +2550,7 @@ static inline int dt_xattr_del(const struct lu_env *env,
        if (CFS_FAULT_CHECK(OBD_FAIL_DT_XATTR_DEL))
                return cfs_fail_err;
 
-        return dt->do_ops->do_xattr_del(env, dt, name, th, capa);
+       return dt->do_ops->do_xattr_del(env, dt, name, th);
 }
 
 static inline int dt_declare_xattr_set(const struct lu_env *env,
@@ -2578,9 +2570,8 @@ static inline int dt_declare_xattr_set(const struct lu_env *env,
 }
 
 static inline int dt_xattr_set(const struct lu_env *env,
-                              struct dt_object *dt, const struct lu_buf *buf,
-                              const char *name, int fl, struct thandle *th,
-                              struct lustre_capa *capa)
+                              struct dt_object *dt, const struct lu_buf *buf,
+                              const char *name, int fl, struct thandle *th)
 {
         LASSERT(dt);
         LASSERT(dt->do_ops);
@@ -2589,14 +2580,13 @@ static inline int dt_xattr_set(const struct lu_env *env,
        if (CFS_FAULT_CHECK(OBD_FAIL_DT_XATTR_SET))
                return cfs_fail_err;
 
-        return dt->do_ops->do_xattr_set(env, dt, buf, name, fl, th, capa);
+       return dt->do_ops->do_xattr_set(env, dt, buf, name, fl, th);
 }
 
 static inline int dt_declare_xattr_get(const struct lu_env *env,
                                       struct dt_object *dt,
                                       struct lu_buf *buf,
-                                      const char *name,
-                                      struct lustre_capa *capa)
+                                      const char *name)
 {
        LASSERT(dt);
        LASSERT(dt->do_ops);
@@ -2605,12 +2595,12 @@ static inline int dt_declare_xattr_get(const struct lu_env *env,
        if (CFS_FAULT_CHECK(OBD_FAIL_DT_DECLARE_XATTR_GET))
                return cfs_fail_err;
 
-       return dt->do_ops->do_declare_xattr_get(env, dt, buf, name, capa);
+       return dt->do_ops->do_declare_xattr_get(env, dt, buf, name);
 }
 
 static inline int dt_xattr_get(const struct lu_env *env,
-                              struct dt_object *dt, struct lu_buf *buf,
-                              const char *name, struct lustre_capa *capa)
+                              struct dt_object *dt, struct lu_buf *buf,
+                              const char *name)
 {
         LASSERT(dt);
         LASSERT(dt->do_ops);
@@ -2619,12 +2609,11 @@ static inline int dt_xattr_get(const struct lu_env *env,
        if (CFS_FAULT_CHECK(OBD_FAIL_DT_XATTR_GET))
                return cfs_fail_err;
 
-        return dt->do_ops->do_xattr_get(env, dt, buf, name, capa);
+       return dt->do_ops->do_xattr_get(env, dt, buf, name);
 }
 
-static inline int dt_xattr_list(const struct lu_env *env,
-                               struct dt_object *dt, struct lu_buf *buf,
-                               struct lustre_capa *capa)
+static inline int dt_xattr_list(const struct lu_env *env, struct dt_object *dt,
+                               const struct lu_buf *buf)
 {
         LASSERT(dt);
         LASSERT(dt->do_ops);
@@ -2633,7 +2622,16 @@ static inline int dt_xattr_list(const struct lu_env *env,
        if (CFS_FAULT_CHECK(OBD_FAIL_DT_XATTR_LIST))
                return cfs_fail_err;
 
-        return dt->do_ops->do_xattr_list(env, dt, buf, capa);
+       return dt->do_ops->do_xattr_list(env, dt, buf);
+}
+
+static inline int dt_invalidate(const struct lu_env *env, struct dt_object *dt)
+{
+       LASSERT(dt);
+       LASSERT(dt->do_ops);
+       LASSERT(dt->do_ops->do_invalidate);
+
+       return dt->do_ops->do_invalidate(env, dt);
 }
 
 static inline int dt_declare_delete(const struct lu_env *env,
@@ -2652,10 +2650,9 @@ static inline int dt_declare_delete(const struct lu_env *env,
 }
 
 static inline int dt_delete(const struct lu_env *env,
-                            struct dt_object *dt,
-                            const struct dt_key *key,
-                            struct thandle *th,
-                            struct lustre_capa *capa)
+                           struct dt_object *dt,
+                           const struct dt_key *key,
+                           struct thandle *th)
 {
         LASSERT(dt);
         LASSERT(dt->do_index_ops);
@@ -2664,7 +2661,7 @@ static inline int dt_delete(const struct lu_env *env,
        if (CFS_FAULT_CHECK(OBD_FAIL_DT_DELETE))
                return cfs_fail_err;
 
-        return dt->do_index_ops->dio_delete(env, dt, key, th, capa);
+       return dt->do_index_ops->dio_delete(env, dt, key, th);
 }
 
 static inline int dt_commit_async(const struct lu_env *env,
@@ -2676,23 +2673,10 @@ static inline int dt_commit_async(const struct lu_env *env,
         return dev->dd_ops->dt_commit_async(env, dev);
 }
 
-static inline int dt_init_capa_ctxt(const struct lu_env *env,
-                                   struct dt_device *dev,
-                                   int mode, unsigned long timeout,
-                                   __u32 alg, struct lustre_capa_key *keys)
-{
-       LASSERT(dev);
-       LASSERT(dev->dd_ops);
-       LASSERT(dev->dd_ops->dt_init_capa_ctxt);
-       return dev->dd_ops->dt_init_capa_ctxt(env, dev, mode,
-                                             timeout, alg, keys);
-}
-
 static inline int dt_lookup(const struct lu_env *env,
-                            struct dt_object *dt,
-                            struct dt_rec *rec,
-                            const struct dt_key *key,
-                            struct lustre_capa *capa)
+                           struct dt_object *dt,
+                           struct dt_rec *rec,
+                           const struct dt_key *key)
 {
         int ret;
 
@@ -2703,7 +2687,7 @@ static inline int dt_lookup(const struct lu_env *env,
        if (CFS_FAULT_CHECK(OBD_FAIL_DT_LOOKUP))
                return cfs_fail_err;
 
-        ret = dt->do_index_ops->dio_lookup(env, dt, rec, key, capa);
+       ret = dt->do_index_ops->dio_lookup(env, dt, rec, key);
         if (ret > 0)
                 ret = 0;
         else if (ret == 0)
@@ -2711,8 +2695,6 @@ static inline int dt_lookup(const struct lu_env *env,
         return ret;
 }
 
-#define LU221_BAD_TIME (0x80000000U + 24 * 3600)
-
 struct dt_find_hint {
        struct lu_fid        *dfh_fid;
        struct dt_device     *dfh_dt;
@@ -2760,27 +2742,13 @@ static inline struct dt_thread_info *dt_info(const struct lu_env *env)
 int dt_global_init(void);
 void dt_global_fini(void);
 
-# ifdef LPROCFS
-#ifndef HAVE_ONLY_PROCFS_SEQ
-int lprocfs_dt_rd_blksize(char *page, char **start, off_t off,
-                         int count, int *eof, void *data);
-int lprocfs_dt_rd_kbytestotal(char *page, char **start, off_t off,
-                             int count, int *eof, void *data);
-int lprocfs_dt_rd_kbytesfree(char *page, char **start, off_t off,
-                            int count, int *eof, void *data);
-int lprocfs_dt_rd_kbytesavail(char *page, char **start, off_t off,
-                             int count, int *eof, void *data);
-int lprocfs_dt_rd_filestotal(char *page, char **start, off_t off,
-                            int count, int *eof, void *data);
-int lprocfs_dt_rd_filesfree(char *page, char **start, off_t off,
-                           int count, int *eof, void *data);
-#endif
+# ifdef CONFIG_PROC_FS
 int lprocfs_dt_blksize_seq_show(struct seq_file *m, void *v);
 int lprocfs_dt_kbytestotal_seq_show(struct seq_file *m, void *v);
 int lprocfs_dt_kbytesfree_seq_show(struct seq_file *m, void *v);
 int lprocfs_dt_kbytesavail_seq_show(struct seq_file *m, void *v);
 int lprocfs_dt_filestotal_seq_show(struct seq_file *m, void *v);
 int lprocfs_dt_filesfree_seq_show(struct seq_file *m, void *v);
-# endif /* LPROCFS */
+# endif /* CONFIG_PROC_FS */
 
 #endif /* __LUSTRE_DT_OBJECT_H */