Whamcloud - gitweb
LU-3335 osd: use local transaction directly inside OSD
[fs/lustre-release.git] / lustre / osd-ldiskfs / osd_oi.c
index 786e85b..54a016f 100644 (file)
@@ -571,11 +571,10 @@ int osd_oi_lookup(struct osd_thread_info *info, struct osd_device *osd,
 
 static int osd_oi_iam_refresh(struct osd_thread_info *oti, struct osd_oi *oi,
                             const struct dt_rec *rec, const struct dt_key *key,
-                            struct thandle *th, bool insert)
+                            handle_t *th, bool insert)
 {
        struct iam_container    *bag;
        struct iam_path_descr   *ipd;
-       struct osd_thandle      *oh;
        int                     rc;
        ENTRY;
 
@@ -588,14 +587,13 @@ static int osd_oi_iam_refresh(struct osd_thread_info *oti, struct osd_oi *oi,
        if (unlikely(ipd == NULL))
                RETURN(-ENOMEM);
 
-       oh = container_of0(th, struct osd_thandle, ot_super);
-       LASSERT(oh->ot_handle != NULL);
-       LASSERT(oh->ot_handle->h_transaction != NULL);
+       LASSERT(th != NULL);
+       LASSERT(th->h_transaction != NULL);
        if (insert)
-               rc = iam_insert(oh->ot_handle, bag, (const struct iam_key *)key,
+               rc = iam_insert(th, bag, (const struct iam_key *)key,
                                (const struct iam_rec *)rec, ipd);
        else
-               rc = iam_update(oh->ot_handle, bag, (const struct iam_key *)key,
+               rc = iam_update(th, bag, (const struct iam_key *)key,
                                (const struct iam_rec *)rec, ipd);
        osd_ipd_put(oti->oti_env, bag, ipd);
        LINVRNT(osd_invariant(obj));
@@ -604,7 +602,7 @@ static int osd_oi_iam_refresh(struct osd_thread_info *oti, struct osd_oi *oi,
 
 int osd_oi_insert(struct osd_thread_info *info, struct osd_device *osd,
                  const struct lu_fid *fid, const struct osd_inode_id *id,
-                 struct thandle *th, enum oi_check_flags flags)
+                 handle_t *th, enum oi_check_flags flags)
 {
        struct lu_fid       *oi_fid = &info->oti_fid2;
        struct osd_inode_id *oi_id  = &info->oti_id2;
@@ -677,36 +675,34 @@ update:
 }
 
 static int osd_oi_iam_delete(struct osd_thread_info *oti, struct osd_oi *oi,
-                             const struct dt_key *key, struct thandle *handle)
+                            const struct dt_key *key, handle_t *th)
 {
-        struct iam_container  *bag;
-        struct iam_path_descr *ipd;
-        struct osd_thandle    *oh;
-        int                    rc;
-        ENTRY;
+       struct iam_container    *bag;
+       struct iam_path_descr   *ipd;
+       int                      rc;
+       ENTRY;
 
-        LASSERT(oi);
+       LASSERT(oi);
        LASSERT(oi->oi_inode);
        ll_vfs_dq_init(oi->oi_inode);
 
-        bag = &oi->oi_dir.od_container;
-        ipd = osd_idx_ipd_get(oti->oti_env, bag);
-        if (unlikely(ipd == NULL))
-                RETURN(-ENOMEM);
+       bag = &oi->oi_dir.od_container;
+       ipd = osd_idx_ipd_get(oti->oti_env, bag);
+       if (unlikely(ipd == NULL))
+               RETURN(-ENOMEM);
 
-        oh = container_of0(handle, struct osd_thandle, ot_super);
-        LASSERT(oh->ot_handle != NULL);
-        LASSERT(oh->ot_handle->h_transaction != NULL);
+       LASSERT(th != NULL);
+       LASSERT(th->h_transaction != NULL);
 
-        rc = iam_delete(oh->ot_handle, bag, (const struct iam_key *)key, ipd);
-        osd_ipd_put(oti->oti_env, bag, ipd);
-        LINVRNT(osd_invariant(obj));
-        RETURN(rc);
+       rc = iam_delete(th, bag, (const struct iam_key *)key, ipd);
+       osd_ipd_put(oti->oti_env, bag, ipd);
+       LINVRNT(osd_invariant(obj));
+       RETURN(rc);
 }
 
 int osd_oi_delete(struct osd_thread_info *info,
                  struct osd_device *osd, const struct lu_fid *fid,
-                 struct thandle *th, enum oi_check_flags flags)
+                 handle_t *th, enum oi_check_flags flags)
 {
        struct lu_fid *oi_fid = &info->oti_fid2;
 
@@ -727,7 +723,7 @@ int osd_oi_delete(struct osd_thread_info *info,
 
 int osd_oi_update(struct osd_thread_info *info, struct osd_device *osd,
                  const struct lu_fid *fid, const struct osd_inode_id *id,
-                 struct thandle *th, enum oi_check_flags flags)
+                 handle_t *th, enum oi_check_flags flags)
 {
        struct lu_fid       *oi_fid = &info->oti_fid2;
        struct osd_inode_id *oi_id  = &info->oti_id2;