Whamcloud - gitweb
LU-6698 kernel: kernel update RHEL 6.6 [2.6.32-504.23.4.el6]
[fs/lustre-release.git] / lustre / mdd / mdd_compat.c
index 91b97ea..5a19c3c 100644 (file)
@@ -20,7 +20,7 @@
  * GPL HEADER END
  */
 /*
- * Copyright (c) 2012, Intel Corporation.
+ * Copyright (c) 2013, 2014, Intel Corporation.
  */
 #define DEBUG_SUBSYSTEM S_MDS
 
@@ -56,7 +56,7 @@ static int mdd_convert_remove_dots(const struct lu_env *env,
                                   struct mdd_device *mdd,
                                   struct mdd_object *o)
 {
-       struct thandle          *th = NULL;
+       struct thandle          *th;
        const struct dt_key     *dot = (const struct dt_key *)".";
        const struct dt_key     *dotdot = (const struct dt_key *)"..";
        int                      rc;
@@ -68,6 +68,7 @@ static int mdd_convert_remove_dots(const struct lu_env *env,
        th = dt_trans_create(env, mdd->mdd_child);
        if (IS_ERR(th))
                RETURN(PTR_ERR(th));
+
        rc = dt_declare_delete(env, mdd_object_child(o), dot, th);
        if (rc)
                GOTO(out, rc);
@@ -79,20 +80,19 @@ static int mdd_convert_remove_dots(const struct lu_env *env,
                GOTO(out, rc);
        /* ignore non-existing "."/".." - we stored them on disk for
         * pre-production systems, but this is not how regular ZFS works */
-       rc = dt_delete(env, mdd_object_child(o), dot, th, BYPASS_CAPA);
+       rc = dt_delete(env, mdd_object_child(o), dot, th);
        if (rc == -ENOENT)
                rc = 0;
        if (rc)
                GOTO(out, rc);
-       rc = dt_delete(env, mdd_object_child(o), dotdot, th, BYPASS_CAPA);
+       rc = dt_delete(env, mdd_object_child(o), dotdot, th);
        if (rc == -ENOENT)
                rc = 0;
        if (rc)
                GOTO(out, rc);
 
 out:
-       if (th)
-               dt_trans_stop(env, mdd->mdd_child, th);
+       dt_trans_stop(env, mdd->mdd_child, th);
        RETURN(rc);
 }
 
@@ -101,13 +101,16 @@ static int mdd_convert_linkea(const struct lu_env *env,
                              struct mdd_object *o,
                              const struct lu_name *name)
 {
-       struct thandle  *th = NULL;
+       struct thandle  *th;
        struct lu_fid    oldfid;
        int              rc;
        ENTRY;
 
        th = dt_trans_create(env, mdd->mdd_child);
-       rc = mdd_declare_links_add(env, o, th, NULL);
+       if (IS_ERR(th))
+               RETURN(PTR_ERR(th));
+
+       rc = mdd_declare_links_add(env, o, th, NULL, MLAO_IGNORE);
        if (rc)
                GOTO(out, rc);
        rc = dt_trans_start_local(env, mdd->mdd_child, th);
@@ -123,8 +126,7 @@ static int mdd_convert_linkea(const struct lu_env *env,
                rc = 0;
 
 out:
-       if (th)
-               dt_trans_stop(env, mdd->mdd_child, th);
+       dt_trans_stop(env, mdd->mdd_child, th);
        RETURN(rc);
 }
 
@@ -134,7 +136,7 @@ static int mdd_convert_object(const struct lu_env *env,
                              const struct lu_name *name)
 {
        struct mdd_object       *o;
-       struct lu_attr          *la = &mdd_env_info(env)->mti_la;
+       struct lu_attr          *la = MDD_ENV_VAR(env, cattr);
        int                      rc;
        ENTRY;
 
@@ -145,7 +147,7 @@ static int mdd_convert_object(const struct lu_env *env,
                RETURN(PTR_ERR(o));
        }
 
-       rc = mdo_attr_get(env, o, la, BYPASS_CAPA);
+       rc = mdo_attr_get(env, o, la);
        if (rc)
                GOTO(out, rc);
 
@@ -171,7 +173,7 @@ static int mdd_convert_lma(const struct lu_env *env, struct mdd_device *mdd,
                           struct mdd_object *o)
 {
        struct lustre_mdt_attrs *lma;
-       struct thandle          *th = NULL;
+       struct thandle          *th;
        struct lu_fid            fid;
        struct lu_buf            buf;
        int                      rc;
@@ -180,7 +182,7 @@ static int mdd_convert_lma(const struct lu_env *env, struct mdd_device *mdd,
        lu_root_fid(&fid);
 
        lma = (struct lustre_mdt_attrs *)&mdd_env_info(env)->mti_xattr_buf;
-       lustre_lma_init(lma, &fid, 0);
+       lustre_lma_init(lma, &fid, 0, 0);
        lustre_lma_swab(lma);
        buf.lb_buf = lma;
        buf.lb_len = sizeof(*lma);
@@ -194,10 +196,9 @@ static int mdd_convert_lma(const struct lu_env *env, struct mdd_device *mdd,
        rc = dt_trans_start_local(env, mdd->mdd_child, th);
        if (rc)
                GOTO(out, rc);
-       rc = mdo_xattr_set(env, o, &buf, XATTR_NAME_LMA, 0, th, BYPASS_CAPA);
+       rc = mdo_xattr_set(env, o, &buf, XATTR_NAME_LMA, 0, th);
 out:
-       if (th)
-               dt_trans_stop(env, mdd->mdd_child, th);
+       dt_trans_stop(env, mdd->mdd_child, th);
        RETURN(rc);
 }
 
@@ -217,7 +218,7 @@ static int mdd_fix_children(const struct lu_env *env,
        ent = (struct lu_dirent *)&info->mti_xattr_buf;
        iops = &o->do_index_ops->dio_it;
 
-       it = iops->init(env, o, LUDA_64BITHASH, BYPASS_CAPA);
+       it = iops->init(env, o, LUDA_64BITHASH);
        if (IS_ERR(it)) {
                rc = PTR_ERR(it);
                CERROR("%s: can't initialize the iterator: rc = %d\n",
@@ -230,13 +231,15 @@ static int mdd_fix_children(const struct lu_env *env,
                GOTO(out_put, rc);
 
        do {
+               size_t lu_dirent_size;
+
                rc = iops->key_size(env, it);
                if (rc == 0)
                        goto next;
 
                /* calculate max space required for lu_dirent */
-               rc = lu_dirent_calc_size(rc, 0);
-               LASSERT(rc <= sizeof(info->mti_xattr_buf));
+               lu_dirent_size = lu_dirent_calc_size(rc, 0);
+               LASSERT(lu_dirent_size <= sizeof(info->mti_xattr_buf));
 
                rc = iops->rec(env, it, (struct dt_rec *)ent, LUDA_TYPE);
                if (rc == 0) {
@@ -338,7 +341,7 @@ int mdd_compat_fixes(const struct lu_env *env, struct mdd_device *mdd)
        CLASSERT(sizeof(info->mti_xattr_buf) >= LMA_OLD_SIZE);
        buf.lb_len = LMA_OLD_SIZE;
        buf.lb_buf = lma;
-       rc = mdo_xattr_get(env, root, &buf, XATTR_NAME_LMA, BYPASS_CAPA);
+       rc = mdo_xattr_get(env, root, &buf, XATTR_NAME_LMA);
        if (rc < 0 && rc != -ENODATA) {
                CERROR("%s: can't fetch LMA: rc = %d\n",
                       mdd2obd_dev(mdd)->obd_name, rc);