Whamcloud - gitweb
LU-3105 osc: remove capa support 40/14640/6
authorJohn L. Hammond <john.hammond@intel.com>
Wed, 29 Apr 2015 14:27:05 +0000 (09:27 -0500)
committerOleg Drokin <oleg.drokin@intel.com>
Fri, 5 Jun 2015 01:50:00 +0000 (01:50 +0000)
Remove capa support from the OSC layer. Convert the OBD getattr and
setattr paths to use struct obdo rather than struct obd_info. Remove
the oi_policy, oi_oa, and oi_capa members from struct obd_info.

Signed-off-by: John L. Hammond <john.hammond@intel.com>
Change-Id: I3c7b3a8b5a5f330291e0096f65782f028fd4b5d8
Reviewed-on: http://review.whamcloud.com/14640
Tested-by: Jenkins
Tested-by: Maloo <hpdd-maloo@intel.com>
Reviewed-by: Andreas Dilger <andreas.dilger@intel.com>
Reviewed-by: Alex Zhuravlev <alexey.zhuravlev@intel.com>
Reviewed-by: James Simmons <uja.ornl@yahoo.com>
20 files changed:
lustre/include/cl_object.h
lustre/include/obd.h
lustre/include/obd_class.h
lustre/llite/file.c
lustre/llite/lcommon_cl.c
lustre/llite/llite_capa.c
lustre/llite/llite_internal.h
lustre/llite/llite_lib.c
lustre/llite/rw.c
lustre/llite/vvp_req.c
lustre/lov/lov_io.c
lustre/lov/lov_obd.c
lustre/lov/lov_request.c
lustre/obdecho/echo.c
lustre/obdecho/echo_client.c
lustre/ofd/ofd_obd.c
lustre/osc/osc_cl_internal.h
lustre/osc/osc_internal.h
lustre/osc/osc_io.c
lustre/osc/osc_request.c

index 2654ec4..24d8314 100644 (file)
@@ -1809,7 +1809,6 @@ struct cl_io {
                        unsigned int             sa_valid;
                        int                      sa_stripe_index;
                        const struct lu_fid     *sa_parent_fid;
-                       struct obd_capa         *sa_capa;
                } ci_setattr;
                struct cl_data_version_io {
                        u64 dv_data_version;
@@ -1832,7 +1831,6 @@ struct cl_io {
                struct cl_fsync_io {
                        loff_t             fi_start;
                        loff_t             fi_end;
-                       struct obd_capa   *fi_capa;
                        /** file system level fid */
                        struct lu_fid     *fi_fid;
                        enum cl_fsync_mode fi_mode;
@@ -1951,8 +1949,6 @@ struct cl_io {
 struct cl_req_attr {
        /** Generic attributes for the server consumption. */
        struct obdo     *cra_oa;
-       /** Capability. */
-       struct obd_capa *cra_capa;
        /** Jobid */
        char             cra_jobid[LUSTRE_JOBID_SIZE];
 };
index ff5e8c5..4cbce88 100644 (file)
@@ -134,19 +134,8 @@ typedef int (*obd_enqueue_update_f)(void *cookie, int rc);
 
 /* obd info for a particular level (lov, osc). */
 struct obd_info {
-        /* Lock policy. It keeps an extent which is specific for a particular
-         * OSC. (e.g. lov_prep_enqueue_set initialises extent of the policy,
-         * and osc_enqueue passes it into ldlm_lock_match & ldlm_cli_enqueue. */
-        ldlm_policy_data_t      oi_policy;
-        /* Flags used for set request specific flags:
-           - while lock handling, the flags obtained on the enqueue
-           request are set here.
-           - while stats, the flags used for control delay/resend.
-           - while setattr, the flags used for distinguish punch operation
-         */
+       /* OBD_STATFS_* flags */
        __u64                   oi_flags;
-        /* obdo data specific for every OSC, if needed at all. */
-        struct obdo            *oi_oa;
         /* statfs data specific for every OSC, if needed at all. */
         struct obd_statfs      *oi_osfs;
         /* An update callback which is called to update some data on upper
@@ -154,9 +143,6 @@ struct obd_info {
          * request in osc level for enqueue requests. It is also possible to
          * update some caller data from LOV layer if needed. */
         obd_enqueue_update_f    oi_cb_up;
-        /* oss capability, its type is obd_capa in client to avoid copy.
-         * in contrary its type is lustre_capa in OSS. */
-        void                   *oi_capa;
 };
 
 struct obd_type {
@@ -925,9 +911,9 @@ struct obd_ops {
        int (*o_destroy)(const struct lu_env *env, struct obd_export *exp,
                         struct obdo *oa);
        int (*o_setattr)(const struct lu_env *, struct obd_export *exp,
-                        struct obd_info *oinfo);
-        int (*o_getattr)(const struct lu_env *env, struct obd_export *exp,
-                         struct obd_info *oinfo);
+                        struct obdo *oa);
+       int (*o_getattr)(const struct lu_env *env, struct obd_export *exp,
+                        struct obdo *oa);
        int (*o_preprw)(const struct lu_env *env, int cmd,
                        struct obd_export *exp, struct obdo *oa, int objcount,
                        struct obd_ioobj *obj, struct niobuf_remote *remote,
index 9e05ebc..29f2a96 100644 (file)
@@ -786,27 +786,27 @@ static inline int obd_destroy(const struct lu_env *env, struct obd_export *exp,
 }
 
 static inline int obd_getattr(const struct lu_env *env, struct obd_export *exp,
-                              struct obd_info *oinfo)
+                             struct obdo *oa)
 {
-        int rc;
-        ENTRY;
+       int rc;
 
-        EXP_CHECK_DT_OP(exp, getattr);
-        EXP_COUNTER_INCREMENT(exp, getattr);
+       ENTRY;
+       EXP_CHECK_DT_OP(exp, getattr);
+       EXP_COUNTER_INCREMENT(exp, getattr);
+       rc = OBP(exp->exp_obd, getattr)(env, exp, oa);
 
-        rc = OBP(exp->exp_obd, getattr)(env, exp, oinfo);
-        RETURN(rc);
+       RETURN(rc);
 }
 
 static inline int obd_setattr(const struct lu_env *env, struct obd_export *exp,
-                             struct obd_info *oinfo)
+                             struct obdo *oa)
 {
        int rc;
 
        ENTRY;
        EXP_CHECK_DT_OP(exp, setattr);
        EXP_COUNTER_INCREMENT(exp, setattr);
-       rc = OBP(exp->exp_obd, setattr)(env, exp, oinfo);
+       rc = OBP(exp->exp_obd, setattr)(env, exp, oa);
 
        RETURN(rc);
 }
@@ -1098,22 +1098,26 @@ static inline int obd_statfs_rqset(struct obd_export *exp,
                                    struct obd_statfs *osfs, __u64 max_age,
                                    __u32 flags)
 {
-        struct ptlrpc_request_set *set = NULL;
-        struct obd_info oinfo = { { { 0 } } };
-        int rc = 0;
-        ENTRY;
+       struct ptlrpc_request_set *set = NULL;
+       struct obd_info oinfo = {
+               .oi_osfs = osfs,
+               .oi_flags = flags,
+       };
+       int rc = 0;
+
+       ENTRY;
 
-        set =  ptlrpc_prep_set();
-        if (set == NULL)
-                RETURN(-ENOMEM);
+       set = ptlrpc_prep_set();
+       if (set == NULL)
+               RETURN(-ENOMEM);
 
-        oinfo.oi_osfs = osfs;
-        oinfo.oi_flags = flags;
-        rc = obd_statfs_async(exp, &oinfo, max_age, set);
-        if (rc == 0)
-                rc = ptlrpc_set_wait(set);
-        ptlrpc_set_destroy(set);
-        RETURN(rc);
+       rc = obd_statfs_async(exp, &oinfo, max_age, set);
+       if (rc == 0)
+               rc = ptlrpc_set_wait(set);
+
+       ptlrpc_set_destroy(set);
+
+       RETURN(rc);
 }
 
 /* @max_age is the oldest time in jiffies that we accept using a cached data.
index e7aff29..ffbdc92 100644 (file)
@@ -2608,7 +2608,6 @@ int cl_sync_file_range(struct inode *inode, loff_t start, loff_t end,
        struct cl_env_nest nest;
        struct lu_env *env;
        struct cl_io *io;
-       struct obd_capa *capa = NULL;
        struct cl_fsync_io *fio;
        int result;
        ENTRY;
@@ -2621,15 +2620,12 @@ int cl_sync_file_range(struct inode *inode, loff_t start, loff_t end,
        if (IS_ERR(env))
                RETURN(PTR_ERR(env));
 
-       capa = ll_osscapa_get(inode, CAPA_OPC_OSS_WRITE);
-
        io = vvp_env_thread_io(env);
        io->ci_obj = ll_i2info(inode)->lli_clob;
        io->ci_ignore_layout = ignore_layout;
 
        /* initialize parameters for sync */
        fio = &io->u.ci_fsync;
-       fio->fi_capa = capa;
        fio->fi_start = start;
        fio->fi_end = end;
        fio->fi_fid = ll_inode2fid(inode);
@@ -2645,8 +2641,6 @@ int cl_sync_file_range(struct inode *inode, loff_t start, loff_t end,
        cl_io_fini(env, io);
        cl_env_nested_put(&nest, env);
 
-       capa_put(capa);
-
        RETURN(result);
 }
 
index 96ce4f2..9b5b0ed 100644 (file)
@@ -73,7 +73,7 @@ int cl_inode_fini_refcheck;
 static DEFINE_MUTEX(cl_inode_fini_guard);
 
 int cl_setattr_ost(struct cl_object *obj, const struct iattr *attr,
-                  unsigned int attr_flags, struct obd_capa *capa)
+                  unsigned int attr_flags)
 {
         struct lu_env *env;
         struct cl_io  *io;
@@ -96,7 +96,6 @@ int cl_setattr_ost(struct cl_object *obj, const struct iattr *attr,
        io->u.ci_setattr.sa_attr_flags = attr_flags;
        io->u.ci_setattr.sa_valid = attr->ia_valid;
        io->u.ci_setattr.sa_parent_fid = lu_object_fid(&obj->co_lu);
-       io->u.ci_setattr.sa_capa = capa;
 
 again:
         if (cl_io_init(env, io, CIT_SETATTR, io->ci_obj) == 0) {
index c96ad8a..f8ec905 100644 (file)
@@ -318,62 +318,6 @@ void ll_capa_thread_stop(void)
                       thread_is_stopped(&ll_capa_thread));
 }
 
-struct obd_capa *ll_osscapa_get(struct inode *inode, __u64 opc)
-{
-        struct ll_inode_info *lli = ll_i2info(inode);
-        struct obd_capa *ocapa;
-        int found = 0;
-
-        ENTRY;
-
-        if ((ll_i2sbi(inode)->ll_flags & LL_SBI_OSS_CAPA) == 0)
-                RETURN(NULL);
-
-        LASSERT(opc == CAPA_OPC_OSS_WRITE || opc == CAPA_OPC_OSS_RW ||
-                opc == CAPA_OPC_OSS_TRUNC);
-
-       spin_lock(&capa_lock);
-       list_for_each_entry(ocapa, &lli->lli_oss_capas, u.cli.lli_list) {
-                if (capa_is_expired(ocapa))
-                        continue;
-                if ((opc & CAPA_OPC_OSS_WRITE) &&
-                    capa_opc_supported(&ocapa->c_capa, CAPA_OPC_OSS_WRITE)) {
-                        found = 1;
-                        break;
-                } else if ((opc & CAPA_OPC_OSS_READ) &&
-                           capa_opc_supported(&ocapa->c_capa,
-                                              CAPA_OPC_OSS_READ)) {
-                        found = 1;
-                        break;
-                } else if ((opc & CAPA_OPC_OSS_TRUNC) &&
-                           capa_opc_supported(&ocapa->c_capa, opc)) {
-                        found = 1;
-                        break;
-                }
-        }
-
-        if (found) {
-                LASSERT(lu_fid_eq(capa_fid(&ocapa->c_capa),
-                                  ll_inode2fid(inode)));
-                LASSERT(ocapa->c_site == CAPA_SITE_CLIENT);
-
-                capa_get(ocapa);
-
-                DEBUG_CAPA(D_SEC, &ocapa->c_capa, "found client");
-       } else {
-               ocapa = NULL;
-
-               if (atomic_read(&ll_capa_debug)) {
-                       CERROR("no capability for "DFID" opc "LPX64"\n",
-                              PFID(&lli->lli_fid), opc);
-                       atomic_set(&ll_capa_debug, 0);
-               }
-       }
-       spin_unlock(&capa_lock);
-
-       RETURN(ocapa);
-}
-
 struct obd_capa *ll_mdscapa_get(struct inode *inode)
 {
        struct ll_inode_info *lli = ll_i2info(inode);
index c2b0361..a81b062 100644 (file)
@@ -1125,7 +1125,6 @@ void ll_capa_open(struct inode *inode);
 void ll_capa_close(struct inode *inode);
 
 struct obd_capa *ll_mdscapa_get(struct inode *inode);
-struct obd_capa *ll_osscapa_get(struct inode *inode, __u64 opc);
 
 void ll_truncate_free_capa(struct obd_capa *ocapa);
 void ll_clear_inode_capas(struct inode *inode);
@@ -1331,8 +1330,6 @@ typedef enum llioc_iter (*llioc_callback_t)(struct inode *inode,
 void *ll_iocontrol_register(llioc_callback_t cb, int count, unsigned int *cmd);
 void ll_iocontrol_unregister(void *magic);
 
-struct obd_capa *cl_capa_lookup(struct inode *inode, enum cl_req_type crt);
-
 int cl_sync_file_range(struct inode *inode, loff_t start, loff_t end,
                       enum cl_fsync_mode mode, int ignore_layout);
 
@@ -1489,7 +1486,7 @@ int ll_getparent(struct file *file, struct getparent __user *arg);
 
 /* lcommon_cl.c */
 int cl_setattr_ost(struct cl_object *obj, const struct iattr *attr,
-                  unsigned int attr_flags, struct obd_capa *capa);
+                  unsigned int attr_flags);
 
 extern struct lu_env *cl_inode_fini_env;
 extern int cl_inode_fini_refcheck;
index 07168c5..61f41a6 100644 (file)
@@ -1519,26 +1519,6 @@ static int ll_md_setattr(struct dentry *dentry, struct md_op_data *op_data)
        RETURN(rc);
 }
 
-static int ll_setattr_ost(struct inode *inode, struct iattr *attr)
-{
-        struct obd_capa *capa;
-        int rc;
-
-        if (attr->ia_valid & ATTR_SIZE)
-                capa = ll_osscapa_get(inode, CAPA_OPC_OSS_TRUNC);
-        else
-                capa = ll_mdscapa_get(inode);
-
-       rc = cl_setattr_ost(ll_i2info(inode)->lli_clob, attr, 0, capa);
-
-        if (attr->ia_valid & ATTR_SIZE)
-                ll_truncate_free_capa(capa);
-        else
-                capa_put(capa);
-
-        return rc;
-}
-
 /* If this inode has objects allocated to it (lsm != NULL), then the OST
  * object(s) determine the file size and mtime.  Otherwise, the MDS will
  * keep these values until such a time that objects are allocated for it.
@@ -1703,7 +1683,7 @@ int ll_setattr_raw(struct dentry *dentry, struct iattr *attr, bool hsm_import)
                 * excessive to send mtime/atime updates to OSTs when not
                 * setting times to past, but it is necessary due to possible
                 * time de-synchronization between MDT inode and OST objects */
-               rc = ll_setattr_ost(inode, attr);
+               rc = cl_setattr_ost(lli->lli_clob, attr, 0);
        }
        EXIT;
 out:
@@ -2106,7 +2086,6 @@ int ll_iocontrol(struct inode *inode, struct file *file,
                struct iattr *attr;
                struct md_op_data *op_data;
                struct cl_object *obj;
-               struct obd_capa *capa;
 
                if (get_user(flags, (int __user *)arg))
                        RETURN(-EFAULT);
@@ -2135,10 +2114,7 @@ int ll_iocontrol(struct inode *inode, struct file *file,
                        RETURN(-ENOMEM);
 
                attr->ia_valid = ATTR_ATTR_FLAG;
-
-               capa = ll_mdscapa_get(inode);
-               rc = cl_setattr_ost(obj, attr, flags, capa);
-               capa_put(capa);
+               rc = cl_setattr_ost(obj, attr, flags);
 
                OBD_FREE_PTR(attr);
                RETURN(rc);
index be4a94f..6ca07f7 100644 (file)
 #include "llite_internal.h"
 #include <lustre_compat.h>
 
-struct obd_capa *cl_capa_lookup(struct inode *inode, enum cl_req_type crt)
-{
-        __u64 opc;
-
-        opc = crt == CRT_WRITE ? CAPA_OPC_OSS_WRITE : CAPA_OPC_OSS_RW;
-        return ll_osscapa_get(inode, opc);
-}
-
 static void ll_ra_stats_inc_sbi(struct ll_sb_info *sbi, enum ra_stat which);
 
 /**
index e78e0b2..d070d9d 100644 (file)
@@ -55,8 +55,6 @@ static inline struct vvp_req *cl2vvp_req(const struct cl_req_slice *slice)
  *    - o_parent_oid
  *
  *    - o_parent_ver
- *
- *  and capability.
  */
 static void vvp_req_attr_set(const struct lu_env *env,
                             const struct cl_req_slice *slice,
@@ -70,12 +68,6 @@ static void vvp_req_attr_set(const struct lu_env *env,
        oa = attr->cra_oa;
        inode = vvp_object_inode(obj);
 
-       if ((flags & OBD_MD_FLOSSCAPA) != 0) {
-               LASSERT(attr->cra_capa == NULL);
-               attr->cra_capa = cl_capa_lookup(inode,
-                                               slice->crs_req->crq_type);
-       }
-
        if (slice->crs_req->crq_type == CRT_WRITE) {
                valid_flags |= OBD_MD_FLMTIME | OBD_MD_FLCTIME |
                               OBD_MD_FLUID | OBD_MD_FLGID;
index f227c6e..81d5d75 100644 (file)
@@ -97,7 +97,6 @@ static void lov_io_sub_inherit(struct cl_io *io, struct lov_io *lio,
                io->u.ci_setattr.sa_stripe_index = stripe;
                io->u.ci_setattr.sa_parent_fid =
                                        parent->u.ci_setattr.sa_parent_fid;
-               io->u.ci_setattr.sa_capa = parent->u.ci_setattr.sa_capa;
                 if (cl_io_is_trunc(io)) {
                         loff_t new_size = parent->u.ci_setattr.sa_attr.lvb_size;
 
@@ -124,7 +123,6 @@ static void lov_io_sub_inherit(struct cl_io *io, struct lov_io *lio,
        case CIT_FSYNC: {
                io->u.ci_fsync.fi_start = start;
                io->u.ci_fsync.fi_end = end;
-               io->u.ci_fsync.fi_capa = parent->u.ci_fsync.fi_capa;
                io->u.ci_fsync.fi_fid = parent->u.ci_fsync.fi_fid;
                io->u.ci_fsync.fi_mode = parent->u.ci_fsync.fi_mode;
                break;
index bea5c2b..9afa7aa 100644 (file)
@@ -1084,28 +1084,30 @@ static int lov_statfs_async(struct obd_export *exp, struct obd_info *oinfo,
 }
 
 static int lov_statfs(const struct lu_env *env, struct obd_export *exp,
-                      struct obd_statfs *osfs, __u64 max_age, __u32 flags)
+                     struct obd_statfs *osfs, __u64 max_age, __u32 flags)
 {
-        struct ptlrpc_request_set *set = NULL;
-        struct obd_info oinfo = { { { 0 } } };
-        int rc = 0;
-        ENTRY;
+       struct ptlrpc_request_set *set = NULL;
+       struct obd_info oinfo = {
+               .oi_osfs = osfs,
+               .oi_flags = flags,
+       };
+       int rc = 0;
+
+       ENTRY;
 
+       /* for obdclass we forbid using obd_statfs_rqset, but prefer using async
+        * statfs requests */
+       set = ptlrpc_prep_set();
+       if (set == NULL)
+               RETURN(-ENOMEM);
 
-        /* for obdclass we forbid using obd_statfs_rqset, but prefer using async
-         * statfs requests */
-        set = ptlrpc_prep_set();
-        if (set == NULL)
-                RETURN(-ENOMEM);
+       rc = lov_statfs_async(exp, &oinfo, max_age, set);
+       if (rc == 0)
+               rc = ptlrpc_set_wait(set);
 
-        oinfo.oi_osfs = osfs;
-        oinfo.oi_flags = flags;
-        rc = lov_statfs_async(exp, &oinfo, max_age, set);
-        if (rc == 0)
-                rc = ptlrpc_set_wait(set);
-        ptlrpc_set_destroy(set);
+       ptlrpc_set_destroy(set);
 
-        RETURN(rc);
+       RETURN(rc);
 }
 
 static int lov_iocontrol(unsigned int cmd, struct obd_export *exp, int len,
index d95e486..9e7847c 100644 (file)
@@ -65,9 +65,6 @@ void lov_finish_set(struct lov_request_set *set)
                req = list_entry(pos, struct lov_request, rq_link);
                list_del_init(&req->rq_link);
 
-               if (req->rq_oi.oi_oa != NULL)
-                       OBDO_FREE(req->rq_oi.oi_oa);
-
                if (req->rq_oi.oi_osfs != NULL)
                        OBD_FREE_PTR(req->rq_oi.oi_osfs);
 
index ac0a9eb..e9e7697 100644 (file)
@@ -170,50 +170,48 @@ static int echo_destroy(const struct lu_env *env, struct obd_export *exp,
 }
 
 static int echo_getattr(const struct lu_env *env, struct obd_export *exp,
-                        struct obd_info *oinfo)
+                       struct obdo *oa)
 {
        struct obd_device *obd = class_exp2obd(exp);
-       u64 id = ostid_id(&oinfo->oi_oa->o_oi);
+       u64 id = ostid_id(&oa->o_oi);
 
-        ENTRY;
-        if (!obd) {
-                CERROR("invalid client cookie "LPX64"\n",
-                       exp->exp_handle.h_cookie);
-                RETURN(-EINVAL);
-        }
+       ENTRY;
+       if (!obd) {
+               CERROR("invalid client cookie "LPX64"\n",
+                      exp->exp_handle.h_cookie);
+               RETURN(-EINVAL);
+       }
 
-        if (!(oinfo->oi_oa->o_valid & OBD_MD_FLID)) {
-                CERROR("obdo missing FLID valid flag: "LPX64"\n",
-                       oinfo->oi_oa->o_valid);
-                RETURN(-EINVAL);
-        }
+       if (!(oa->o_valid & OBD_MD_FLID)) {
+               CERROR("obdo missing FLID valid flag: "LPX64"\n", oa->o_valid);
+               RETURN(-EINVAL);
+       }
 
-       obdo_cpy_md(oinfo->oi_oa, &obd->u.echo.eo_oa, oinfo->oi_oa->o_valid);
-       ostid_set_seq_echo(&oinfo->oi_oa->o_oi);
-       ostid_set_id(&oinfo->oi_oa->o_oi, id);
+       obdo_cpy_md(oa, &obd->u.echo.eo_oa, oa->o_valid);
+       ostid_set_seq_echo(&oa->o_oi);
+       ostid_set_id(&oa->o_oi, id);
 
        RETURN(0);
 }
 
 static int echo_setattr(const struct lu_env *env, struct obd_export *exp,
-                       struct obd_info *oinfo)
+                       struct obdo *oa)
 {
-        struct obd_device *obd = class_exp2obd(exp);
+       struct obd_device *obd = class_exp2obd(exp);
 
-        ENTRY;
-        if (!obd) {
-                CERROR("invalid client cookie "LPX64"\n",
-                       exp->exp_handle.h_cookie);
-                RETURN(-EINVAL);
-        }
+       ENTRY;
+       if (!obd) {
+               CERROR("invalid client cookie "LPX64"\n",
+                      exp->exp_handle.h_cookie);
+               RETURN(-EINVAL);
+       }
 
-        if (!(oinfo->oi_oa->o_valid & OBD_MD_FLID)) {
-                CERROR("obdo missing FLID valid flag: "LPX64"\n",
-                       oinfo->oi_oa->o_valid);
-                RETURN(-EINVAL);
-        }
+       if (!(oa->o_valid & OBD_MD_FLID)) {
+               CERROR("obdo missing FLID valid flag: "LPX64"\n", oa->o_valid);
+               RETURN(-EINVAL);
+       }
 
-        memcpy(&obd->u.echo.eo_oa, oinfo->oi_oa, sizeof(*oinfo->oi_oa));
+       obd->u.echo.eo_oa = *oa;
 
        RETURN(0);
 }
index ef50745..5388768 100644 (file)
@@ -2706,11 +2706,7 @@ echo_client_iocontrol(unsigned int cmd, struct obd_export *exp, int len,
         case OBD_IOC_GETATTR:
                 rc = echo_get_object(&eco, ed, oa);
                 if (rc == 0) {
-                       struct obd_info oinfo = {
-                               .oi_oa = oa,
-                       };
-
-                        rc = obd_getattr(env, ec->ec_exp, &oinfo);
+                       rc = obd_getattr(env, ec->ec_exp, oa);
                         echo_put_object(eco);
                 }
                 GOTO(out, rc);
@@ -2721,11 +2717,7 @@ echo_client_iocontrol(unsigned int cmd, struct obd_export *exp, int len,
 
                 rc = echo_get_object(&eco, ed, oa);
                 if (rc == 0) {
-                       struct obd_info oinfo = {
-                               .oi_oa = oa,
-                       };
-
-                       rc = obd_setattr(env, ec->ec_exp, &oinfo);
+                       rc = obd_setattr(env, ec->ec_exp, oa);
                         echo_put_object(eco);
                 }
                 GOTO(out, rc);
index ff047ca..da99fb0 100644 (file)
@@ -877,20 +877,19 @@ out:
 
  * \param[in] env      execution environment
  * \param[in] exp      OBD export of OFD device
- * \param[in] oinfo    obd_info with setattr parameters
+ * \param[in] oa       setattr parameters
  *
  * \retval             0 if successful
  * \retval             negative value on error
  */
 static int ofd_echo_setattr(const struct lu_env *env, struct obd_export *exp,
-                           struct obd_info *oinfo)
+                           struct obdo *oa)
 {
        struct ofd_thread_info  *info;
        struct ofd_device       *ofd = ofd_exp(exp);
        struct ldlm_namespace   *ns = ofd->ofd_namespace;
        struct ldlm_resource    *res;
        struct ofd_object       *fo;
-       struct obdo             *oa = oinfo->oi_oa;
        struct lu_fid           *fid = &oa->o_oi.oi_fid;
        struct filter_fid       *ff = NULL;
        int                      rc = 0;
@@ -903,8 +902,7 @@ static int ofd_echo_setattr(const struct lu_env *env, struct obd_export *exp,
 
        /* This would be very bad - accidentally truncating a file when
         * changing the time or similar - bug 12203. */
-       if (oa->o_valid & OBD_MD_FLSIZE &&
-           oinfo->oi_policy.l_extent.end != OBD_OBJECT_EOF) {
+       if (oa->o_valid & OBD_MD_FLSIZE) {
                static char mdsinum[48];
 
                if (oa->o_valid & OBD_MD_FLFID)
@@ -1153,18 +1151,18 @@ out_sem:
  *
  * \param[in]    env   execution environment
  * \param[in]    exp   OBD export of OFD device
- * \param[in,out] oinfo        contains FID of object to get attributes from and
+ * \param[in,out] oa   contains FID of object to get attributes from and
  *                     is used to return attributes back
  *
  * \retval             0 if successful
  * \retval             negative value on error
  */
 static int ofd_echo_getattr(const struct lu_env *env, struct obd_export *exp,
-                           struct obd_info *oinfo)
+                           struct obdo *oa)
 {
        struct ofd_device       *ofd = ofd_exp(exp);
        struct ofd_thread_info  *info;
-       struct lu_fid           *fid = &oinfo->oi_oa->o_oi.oi_fid;
+       struct lu_fid           *fid = &oa->o_oi.oi_fid;
        struct ofd_object       *fo;
        int                      rc = 0;
 
@@ -1178,18 +1176,18 @@ static int ofd_echo_getattr(const struct lu_env *env, struct obd_export *exp,
 
        LASSERT(fo != NULL);
        rc = ofd_attr_get(env, fo, &info->fti_attr);
-       oinfo->oi_oa->o_valid = OBD_MD_FLID;
+       oa->o_valid = OBD_MD_FLID;
        if (rc == 0) {
                __u64 curr_version;
 
-               obdo_from_la(oinfo->oi_oa, &info->fti_attr,
+               obdo_from_la(oa, &info->fti_attr,
                             OFD_VALID_FLAGS | LA_UID | LA_GID);
 
                /* Store object version in reply */
                curr_version = dt_version_get(env, ofd_object_child(fo));
                if ((__s64)curr_version != -EOPNOTSUPP) {
-                       oinfo->oi_oa->o_valid |= OBD_MD_FLDATAVERSION;
-                       oinfo->oi_oa->o_data_version = curr_version;
+                       oa->o_valid |= OBD_MD_FLDATAVERSION;
+                       oa->o_data_version = curr_version;
                }
        }
 
index cd4962f..24db084 100644 (file)
@@ -77,8 +77,6 @@ struct osc_io {
        struct osc_extent *oi_trunc;
        /** write osc_lock for this IO, used by osc_extent_find(). */
        struct osc_lock   *oi_write_osclock;
-
-       struct obd_info    oi_info;
        struct obdo        oi_oa;
        struct osc_async_cbargs {
                bool              opc_rpc_sent;
index e13eadf..01854e9 100644 (file)
@@ -116,13 +116,13 @@ int osc_match_base(struct obd_export *exp, struct ldlm_res_id *res_id,
                   __u64 *flags, void *data, struct lustre_handle *lockh,
                   int unref);
 
-int osc_setattr_async(struct obd_export *exp, struct obd_info *oinfo,
+int osc_setattr_async(struct obd_export *exp, struct obdo *oa,
                      obd_enqueue_update_f upcall, void *cookie,
                      struct ptlrpc_request_set *rqset);
-int osc_punch_base(struct obd_export *exp, struct obd_info *oinfo,
+int osc_punch_base(struct obd_export *exp, struct obdo *oa,
                    obd_enqueue_update_f upcall, void *cookie,
                    struct ptlrpc_request_set *rqset);
-int osc_sync_base(struct obd_export *exp, struct obd_info *oinfo,
+int osc_sync_base(struct obd_export *exp, struct obdo *oa,
                  obd_enqueue_update_f upcall, void *cookie,
                  struct ptlrpc_request_set *rqset);
 
@@ -226,7 +226,6 @@ enum osc_dap_flags {
 struct ldlm_lock *osc_dlmlock_at_pgoff(const struct lu_env *env,
                                       struct osc_object *obj, pgoff_t index,
                                       enum osc_dap_flags flags);
-void osc_pack_req_body(struct ptlrpc_request *req, struct obd_info *oinfo);
-void osc_set_capa_size(struct ptlrpc_request *req,
-                      const struct req_msg_field *field, struct obd_capa *oc);
+void osc_pack_req_body(struct ptlrpc_request *req, struct obdo *oa);
+
 #endif /* OSC_INTERNAL_H */
index 34679c9..1dfebe3 100644 (file)
@@ -489,7 +489,6 @@ static int osc_io_setattr_start(const struct lu_env *env,
        __u64                    size   = io->u.ci_setattr.sa_attr.lvb_size;
        unsigned int             ia_valid = io->u.ci_setattr.sa_valid;
        int                      result = 0;
-       struct obd_info          oinfo = { { { 0 } } };
 
        /* truncate cache dirty pages first */
        if (cl_io_is_trunc(io))
@@ -559,22 +558,21 @@ static int osc_io_setattr_start(const struct lu_env *env,
                        oa->o_valid |= OBD_MD_FLFLAGS;
                }
 
-                oinfo.oi_oa = oa;
-                oinfo.oi_capa = io->u.ci_setattr.sa_capa;
                init_completion(&cbargs->opc_sync);
 
-                if (ia_valid & ATTR_SIZE)
-                        result = osc_punch_base(osc_export(cl2osc(obj)),
-                                               &oinfo, osc_async_upcall,
-                                                cbargs, PTLRPCD_SET);
-                else
+               if (ia_valid & ATTR_SIZE)
+                       result = osc_punch_base(osc_export(cl2osc(obj)),
+                                               oa, osc_async_upcall,
+                                               cbargs, PTLRPCD_SET);
+               else
                        result = osc_setattr_async(osc_export(cl2osc(obj)),
-                                                  &oinfo,
-                                                  osc_async_upcall,
+                                                  oa, osc_async_upcall,
                                                   cbargs, PTLRPCD_SET);
+
                cbargs->opc_rpc_sent = result == 0;
-        }
-        return result;
+       }
+
+       return result;
 }
 
 static void osc_io_setattr_end(const struct lu_env *env,
@@ -756,7 +754,6 @@ static int osc_fsync_ost(const struct lu_env *env, struct osc_object *obj,
 {
        struct osc_io    *oio   = osc_env_io(env);
        struct obdo      *oa    = &oio->oi_oa;
-       struct obd_info  *oinfo = &oio->oi_info;
        struct lov_oinfo *loi   = obj->oo_oinfo;
        struct osc_async_cbargs *cbargs = &oio->oi_cbarg;
        int rc = 0;
@@ -773,12 +770,9 @@ static int osc_fsync_ost(const struct lu_env *env, struct osc_object *obj,
 
        obdo_set_parent_fid(oa, fio->fi_fid);
 
-       memset(oinfo, 0, sizeof(*oinfo));
-       oinfo->oi_oa = oa;
-       oinfo->oi_capa = fio->fi_capa;
        init_completion(&cbargs->opc_sync);
 
-       rc = osc_sync_base(osc_export(obj), oinfo, osc_async_upcall, cbargs,
+       rc = osc_sync_base(osc_export(obj), oa, osc_async_upcall, cbargs,
                           PTLRPCD_SET);
        RETURN(rc);
 }
index 28a7106..f03dfaa 100644 (file)
@@ -62,7 +62,6 @@ struct osc_brw_async_args {
        struct client_obd        *aa_cli;
        struct list_head          aa_oaps;
        struct list_head          aa_exts;
-       struct obd_capa  *aa_ocapa;
        struct cl_req            *aa_clerq;
 };
 
@@ -75,7 +74,7 @@ struct osc_setattr_args {
 };
 
 struct osc_fsync_args {
-       struct obd_info *fa_oi;
+       struct obdo             *fa_oa;
        obd_enqueue_update_f     fa_upcall;
        void                    *fa_cookie;
 };
@@ -96,129 +95,98 @@ static void osc_release_ppga(struct brw_page **ppga, size_t count);
 static int brw_interpret(const struct lu_env *env, struct ptlrpc_request *req,
                         void *data, int rc);
 
-static inline void osc_pack_capa(struct ptlrpc_request *req,
-                                 struct ost_body *body, void *capa)
-{
-        struct obd_capa *oc = (struct obd_capa *)capa;
-        struct lustre_capa *c;
-
-        if (!capa)
-                return;
-
-        c = req_capsule_client_get(&req->rq_pill, &RMF_CAPA1);
-        LASSERT(c);
-        capa_cpy(c, oc);
-        body->oa.o_valid |= OBD_MD_FLOSSCAPA;
-        DEBUG_CAPA(D_SEC, c, "pack");
-}
-
-void osc_pack_req_body(struct ptlrpc_request *req, struct obd_info *oinfo)
+void osc_pack_req_body(struct ptlrpc_request *req, struct obdo *oa)
 {
        struct ost_body *body;
 
        body = req_capsule_client_get(&req->rq_pill, &RMF_OST_BODY);
        LASSERT(body);
 
-       lustre_set_wire_obdo(&req->rq_import->imp_connect_data, &body->oa,
-                            oinfo->oi_oa);
-       osc_pack_capa(req, body, oinfo->oi_capa);
-}
-
-void osc_set_capa_size(struct ptlrpc_request *req,
-                      const struct req_msg_field *field,
-                      struct obd_capa *oc)
-{
-        if (oc == NULL)
-                req_capsule_set_size(&req->rq_pill, field, RCL_CLIENT, 0);
-        else
-                /* it is already calculated as sizeof struct obd_capa */
-                ;
+       lustre_set_wire_obdo(&req->rq_import->imp_connect_data, &body->oa, oa);
 }
 
 static int osc_getattr(const struct lu_env *env, struct obd_export *exp,
-                       struct obd_info *oinfo)
+                      struct obdo *oa)
 {
-        struct ptlrpc_request *req;
-        struct ost_body       *body;
-        int                    rc;
-        ENTRY;
+       struct ptlrpc_request   *req;
+       struct ost_body         *body;
+       int                      rc;
 
-        req = ptlrpc_request_alloc(class_exp2cliimp(exp), &RQF_OST_GETATTR);
-        if (req == NULL)
-                RETURN(-ENOMEM);
+       ENTRY;
+       req = ptlrpc_request_alloc(class_exp2cliimp(exp), &RQF_OST_GETATTR);
+       if (req == NULL)
+               RETURN(-ENOMEM);
 
-        osc_set_capa_size(req, &RMF_CAPA1, oinfo->oi_capa);
-        rc = ptlrpc_request_pack(req, LUSTRE_OST_VERSION, OST_GETATTR);
-        if (rc) {
-                ptlrpc_request_free(req);
-                RETURN(rc);
-        }
+       rc = ptlrpc_request_pack(req, LUSTRE_OST_VERSION, OST_GETATTR);
+       if (rc) {
+               ptlrpc_request_free(req);
+               RETURN(rc);
+       }
 
-        osc_pack_req_body(req, oinfo);
+       osc_pack_req_body(req, oa);
 
-        ptlrpc_request_set_replen(req);
+       ptlrpc_request_set_replen(req);
 
-        rc = ptlrpc_queue_wait(req);
-        if (rc)
-                GOTO(out, rc);
+       rc = ptlrpc_queue_wait(req);
+       if (rc)
+               GOTO(out, rc);
 
-        body = req_capsule_server_get(&req->rq_pill, &RMF_OST_BODY);
-        if (body == NULL)
-                GOTO(out, rc = -EPROTO);
+       body = req_capsule_server_get(&req->rq_pill, &RMF_OST_BODY);
+       if (body == NULL)
+               GOTO(out, rc = -EPROTO);
 
        CDEBUG(D_INODE, "mode: %o\n", body->oa.o_mode);
-       lustre_get_wire_obdo(&req->rq_import->imp_connect_data, oinfo->oi_oa,
-                            &body->oa);
+       lustre_get_wire_obdo(&req->rq_import->imp_connect_data, oa, &body->oa);
 
-       oinfo->oi_oa->o_blksize = cli_brw_size(exp->exp_obd);
-       oinfo->oi_oa->o_valid |= OBD_MD_FLBLKSZ;
+       oa->o_blksize = cli_brw_size(exp->exp_obd);
+       oa->o_valid |= OBD_MD_FLBLKSZ;
 
-        EXIT;
- out:
-        ptlrpc_req_finished(req);
-        return rc;
+       EXIT;
+out:
+       ptlrpc_req_finished(req);
+
+       return rc;
 }
 
 static int osc_setattr(const struct lu_env *env, struct obd_export *exp,
-                      struct obd_info *oinfo)
+                      struct obdo *oa)
 {
-        struct ptlrpc_request *req;
-        struct ost_body       *body;
-        int                    rc;
-        ENTRY;
+       struct ptlrpc_request   *req;
+       struct ost_body         *body;
+       int                      rc;
 
-        LASSERT(oinfo->oi_oa->o_valid & OBD_MD_FLGROUP);
+       ENTRY;
+       LASSERT(oa->o_valid & OBD_MD_FLGROUP);
 
-        req = ptlrpc_request_alloc(class_exp2cliimp(exp), &RQF_OST_SETATTR);
-        if (req == NULL)
-                RETURN(-ENOMEM);
+       req = ptlrpc_request_alloc(class_exp2cliimp(exp), &RQF_OST_SETATTR);
+       if (req == NULL)
+               RETURN(-ENOMEM);
 
-        osc_set_capa_size(req, &RMF_CAPA1, oinfo->oi_capa);
-        rc = ptlrpc_request_pack(req, LUSTRE_OST_VERSION, OST_SETATTR);
-        if (rc) {
-                ptlrpc_request_free(req);
-                RETURN(rc);
-        }
+       rc = ptlrpc_request_pack(req, LUSTRE_OST_VERSION, OST_SETATTR);
+       if (rc) {
+               ptlrpc_request_free(req);
+               RETURN(rc);
+       }
 
-        osc_pack_req_body(req, oinfo);
+       osc_pack_req_body(req, oa);
 
-        ptlrpc_request_set_replen(req);
+       ptlrpc_request_set_replen(req);
 
-        rc = ptlrpc_queue_wait(req);
-        if (rc)
-                GOTO(out, rc);
+       rc = ptlrpc_queue_wait(req);
+       if (rc)
+               GOTO(out, rc);
 
-        body = req_capsule_server_get(&req->rq_pill, &RMF_OST_BODY);
-        if (body == NULL)
-                GOTO(out, rc = -EPROTO);
+       body = req_capsule_server_get(&req->rq_pill, &RMF_OST_BODY);
+       if (body == NULL)
+               GOTO(out, rc = -EPROTO);
 
-       lustre_get_wire_obdo(&req->rq_import->imp_connect_data, oinfo->oi_oa,
-                            &body->oa);
+       lustre_get_wire_obdo(&req->rq_import->imp_connect_data, oa, &body->oa);
 
-        EXIT;
+       EXIT;
 out:
-        ptlrpc_req_finished(req);
-        RETURN(rc);
+       ptlrpc_req_finished(req);
+
+       RETURN(rc);
 }
 
 static int osc_setattr_interpret(const struct lu_env *env,
@@ -242,51 +210,51 @@ out:
         RETURN(rc);
 }
 
-int osc_setattr_async(struct obd_export *exp, struct obd_info *oinfo,
+int osc_setattr_async(struct obd_export *exp, struct obdo *oa,
                      obd_enqueue_update_f upcall, void *cookie,
                      struct ptlrpc_request_set *rqset)
 {
-        struct ptlrpc_request   *req;
-        struct osc_setattr_args *sa;
-        int                      rc;
-        ENTRY;
+       struct ptlrpc_request   *req;
+       struct osc_setattr_args *sa;
+       int                      rc;
 
-        req = ptlrpc_request_alloc(class_exp2cliimp(exp), &RQF_OST_SETATTR);
-        if (req == NULL)
-                RETURN(-ENOMEM);
+       ENTRY;
 
-        osc_set_capa_size(req, &RMF_CAPA1, oinfo->oi_capa);
-        rc = ptlrpc_request_pack(req, LUSTRE_OST_VERSION, OST_SETATTR);
-        if (rc) {
-                ptlrpc_request_free(req);
-                RETURN(rc);
-        }
+       req = ptlrpc_request_alloc(class_exp2cliimp(exp), &RQF_OST_SETATTR);
+       if (req == NULL)
+               RETURN(-ENOMEM);
 
-        osc_pack_req_body(req, oinfo);
+       rc = ptlrpc_request_pack(req, LUSTRE_OST_VERSION, OST_SETATTR);
+       if (rc) {
+               ptlrpc_request_free(req);
+               RETURN(rc);
+       }
 
-        ptlrpc_request_set_replen(req);
+       osc_pack_req_body(req, oa);
 
-        /* do mds to ost setattr asynchronously */
-        if (!rqset) {
-                /* Do not wait for response. */
-                ptlrpcd_add_req(req, PDL_POLICY_ROUND, -1);
-        } else {
-                req->rq_interpret_reply =
-                        (ptlrpc_interpterer_t)osc_setattr_interpret;
-
-                CLASSERT (sizeof(*sa) <= sizeof(req->rq_async_args));
-                sa = ptlrpc_req_async_args(req);
-                sa->sa_oa = oinfo->oi_oa;
-                sa->sa_upcall = upcall;
-                sa->sa_cookie = cookie;
-
-                if (rqset == PTLRPCD_SET)
-                        ptlrpcd_add_req(req, PDL_POLICY_ROUND, -1);
-                else
-                        ptlrpc_set_add_req(rqset, req);
-        }
+       ptlrpc_request_set_replen(req);
 
-        RETURN(0);
+       /* do mds to ost setattr asynchronously */
+       if (!rqset) {
+               /* Do not wait for response. */
+               ptlrpcd_add_req(req, PDL_POLICY_ROUND, -1);
+       } else {
+               req->rq_interpret_reply =
+                       (ptlrpc_interpterer_t)osc_setattr_interpret;
+
+               CLASSERT(sizeof(*sa) <= sizeof(req->rq_async_args));
+               sa = ptlrpc_req_async_args(req);
+               sa->sa_oa = oa;
+               sa->sa_upcall = upcall;
+               sa->sa_cookie = cookie;
+
+               if (rqset == PTLRPCD_SET)
+                       ptlrpcd_add_req(req, PDL_POLICY_ROUND, -1);
+               else
+                       ptlrpc_set_add_req(rqset, req);
+       }
+
+       RETURN(0);
 }
 
 static int osc_create(const struct lu_env *env, struct obd_export *exp,
@@ -340,7 +308,7 @@ out:
        RETURN(rc);
 }
 
-int osc_punch_base(struct obd_export *exp, struct obd_info *oinfo,
+int osc_punch_base(struct obd_export *exp, struct obdo *oa,
                    obd_enqueue_update_f upcall, void *cookie,
                    struct ptlrpc_request_set *rqset)
 {
@@ -354,7 +322,6 @@ int osc_punch_base(struct obd_export *exp, struct obd_info *oinfo,
         if (req == NULL)
                 RETURN(-ENOMEM);
 
-        osc_set_capa_size(req, &RMF_CAPA1, oinfo->oi_capa);
         rc = ptlrpc_request_pack(req, LUSTRE_OST_VERSION, OST_PUNCH);
         if (rc) {
                 ptlrpc_request_free(req);
@@ -365,16 +332,14 @@ int osc_punch_base(struct obd_export *exp, struct obd_info *oinfo,
 
        body = req_capsule_client_get(&req->rq_pill, &RMF_OST_BODY);
        LASSERT(body);
-       lustre_set_wire_obdo(&req->rq_import->imp_connect_data, &body->oa,
-                            oinfo->oi_oa);
-       osc_pack_capa(req, body, oinfo->oi_capa);
+       lustre_set_wire_obdo(&req->rq_import->imp_connect_data, &body->oa, oa);
 
-        ptlrpc_request_set_replen(req);
+       ptlrpc_request_set_replen(req);
 
-        req->rq_interpret_reply = (ptlrpc_interpterer_t)osc_setattr_interpret;
-        CLASSERT (sizeof(*sa) <= sizeof(req->rq_async_args));
-        sa = ptlrpc_req_async_args(req);
-        sa->sa_oa     = oinfo->oi_oa;
+       req->rq_interpret_reply = (ptlrpc_interpterer_t)osc_setattr_interpret;
+       CLASSERT(sizeof(*sa) <= sizeof(req->rq_async_args));
+       sa = ptlrpc_req_async_args(req);
+       sa->sa_oa = oa;
         sa->sa_upcall = upcall;
         sa->sa_cookie = cookie;
         if (rqset == PTLRPCD_SET)
@@ -402,13 +367,13 @@ static int osc_sync_interpret(const struct lu_env *env,
                 GOTO(out, rc = -EPROTO);
         }
 
-       *fa->fa_oi->oi_oa = body->oa;
+       *fa->fa_oa = body->oa;
 out:
        rc = fa->fa_upcall(fa->fa_cookie, rc);
        RETURN(rc);
 }
 
-int osc_sync_base(struct obd_export *exp, struct obd_info *oinfo,
+int osc_sync_base(struct obd_export *exp, struct obdo *oa,
                  obd_enqueue_update_f upcall, void *cookie,
                   struct ptlrpc_request_set *rqset)
 {
@@ -422,7 +387,6 @@ int osc_sync_base(struct obd_export *exp, struct obd_info *oinfo,
         if (req == NULL)
                 RETURN(-ENOMEM);
 
-        osc_set_capa_size(req, &RMF_CAPA1, oinfo->oi_capa);
         rc = ptlrpc_request_pack(req, LUSTRE_OST_VERSION, OST_SYNC);
         if (rc) {
                 ptlrpc_request_free(req);
@@ -432,16 +396,14 @@ int osc_sync_base(struct obd_export *exp, struct obd_info *oinfo,
        /* overload the size and blocks fields in the oa with start/end */
        body = req_capsule_client_get(&req->rq_pill, &RMF_OST_BODY);
        LASSERT(body);
-       lustre_set_wire_obdo(&req->rq_import->imp_connect_data, &body->oa,
-                            oinfo->oi_oa);
-       osc_pack_capa(req, body, oinfo->oi_capa);
+       lustre_set_wire_obdo(&req->rq_import->imp_connect_data, &body->oa, oa);
 
-        ptlrpc_request_set_replen(req);
-        req->rq_interpret_reply = osc_sync_interpret;
+       ptlrpc_request_set_replen(req);
+       req->rq_interpret_reply = osc_sync_interpret;
 
        CLASSERT(sizeof(*fa) <= sizeof(req->rq_async_args));
        fa = ptlrpc_req_async_args(req);
-       fa->fa_oi = oinfo;
+       fa->fa_oa = oa;
        fa->fa_upcall = upcall;
        fa->fa_cookie = cookie;
 
@@ -541,7 +503,6 @@ static int osc_destroy(const struct lu_env *env, struct obd_export *exp,
                 RETURN(-ENOMEM);
         }
 
-       osc_set_capa_size(req, &RMF_CAPA1, NULL);
         rc = ldlm_prep_elc_req(exp, req, LUSTRE_OST_VERSION, OST_DESTROY,
                                0, &cancels, count);
         if (rc) {
@@ -1002,8 +963,7 @@ static u32 osc_checksum_bulk(int nob, size_t pg_count,
 static int
 osc_brw_prep_request(int cmd, struct client_obd *cli, struct obdo *oa,
                     u32 page_count, struct brw_page **pga,
-                    struct ptlrpc_request **reqp, struct obd_capa *ocapa,
-                    int reserve, int resend)
+                    struct ptlrpc_request **reqp, int resend)
 {
         struct ptlrpc_request   *req;
         struct ptlrpc_bulk_desc *desc;
@@ -1043,7 +1003,6 @@ osc_brw_prep_request(int cmd, struct client_obd *cli, struct obdo *oa,
                              sizeof(*ioobj));
         req_capsule_set_size(pill, &RMF_NIOBUF_REMOTE, RCL_CLIENT,
                              niocount * sizeof(*niobuf));
-        osc_set_capa_size(req, &RMF_CAPA1, ocapa);
 
         rc = ptlrpc_request_pack(req, LUSTRE_OST_VERSION, opc);
         if (rc) {
@@ -1080,7 +1039,6 @@ osc_brw_prep_request(int cmd, struct client_obd *cli, struct obdo *oa,
         * "max - 1" for old client compatibility sending "0", and also so the
         * the actual maximum is a power-of-two number, not one less. LU-1431 */
        ioobj_max_brw_set(ioobj, desc->bd_md_max_brw);
-       osc_pack_capa(req, body, ocapa);
        LASSERT(page_count > 0);
        pg_prev = pga[0];
         for (requested_nob = i = 0; i < page_count; i++, niobuf++) {
@@ -1190,8 +1148,6 @@ osc_brw_prep_request(int cmd, struct client_obd *cli, struct obdo *oa,
         aa->aa_ppga = pga;
         aa->aa_cli = cli;
        INIT_LIST_HEAD(&aa->aa_oaps);
-        if (ocapa && reserve)
-                aa->aa_ocapa = capa_get(ocapa);
 
        *reqp = req;
        niobuf = req_capsule_client_get(pill, &RMF_NIOBUF_REMOTE);
@@ -1411,11 +1367,10 @@ static int osc_brw_redo_request(struct ptlrpc_request *request,
        DEBUG_REQ(rc == -EINPROGRESS ? D_RPCTRACE : D_ERROR, request,
                  "redo for recoverable error %d", rc);
 
-        rc = osc_brw_prep_request(lustre_msg_get_opc(request->rq_reqmsg) ==
-                                        OST_WRITE ? OBD_BRW_WRITE :OBD_BRW_READ,
-                                  aa->aa_cli, aa->aa_oa,
-                                  aa->aa_page_count, aa->aa_ppga,
-                                  &new_req, aa->aa_ocapa, 0, 1);
+       rc = osc_brw_prep_request(lustre_msg_get_opc(request->rq_reqmsg) ==
+                               OST_WRITE ? OBD_BRW_WRITE : OBD_BRW_READ,
+                                 aa->aa_cli, aa->aa_oa, aa->aa_page_count,
+                                 aa->aa_ppga, &new_req, 1);
         if (rc)
                 RETURN(rc);
 
@@ -1460,9 +1415,6 @@ static int osc_brw_redo_request(struct ptlrpc_request *request,
                 }
         }
 
-        new_aa->aa_ocapa = aa->aa_ocapa;
-        aa->aa_ocapa = NULL;
-
        /* XXX: This code will run into problem if we're going to support
         * to add a series of BRW RPCs into a self-defined ptlrpc_request_set
         * and wait for all of them to be finished. We should inherit request
@@ -1546,11 +1498,6 @@ static int brw_interpret(const struct lu_env *env,
                        rc = -EIO;
        }
 
-        if (aa->aa_ocapa) {
-                capa_put(aa->aa_ocapa);
-                aa->aa_ocapa = NULL;
-        }
-
        if (rc == 0) {
                struct obdo *oa = aa->aa_oa;
                struct cl_attr *attr = &osc_env_info(env)->oti_attr;
@@ -1755,8 +1702,7 @@ int osc_build_rpc(const struct lu_env *env, struct client_obd *cli,
        }
 
        sort_brw_pages(pga, page_count);
-       rc = osc_brw_prep_request(cmd, cli, oa, page_count, pga, &req,
-                                 crattr->cra_capa, 1, 0);
+       rc = osc_brw_prep_request(cmd, cli, oa, page_count, pga, &req, 0);
        if (rc != 0) {
                CERROR("prep_req failed: %d\n", rc);
                GOTO(out, rc);
@@ -1845,10 +1791,8 @@ out:
        if (mem_tight != 0)
                cfs_memory_pressure_restore(mpflag);
 
-       if (crattr != NULL) {
-               capa_put(crattr->cra_capa);
+       if (crattr != NULL)
                OBD_FREE(crattr, sizeof(*crattr));
-       }
 
        if (rc != 0) {
                LASSERT(req == NULL);