Whamcloud - gitweb
LU-8731 utils: propagate errors in lfs df
[fs/lustre-release.git] / lustre / osd-zfs / osd_index.c
index 8c1ffbf..07c5eb2 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
  */
@@ -165,7 +161,6 @@ static struct dt_it *osd_index_it_init(const struct lu_env *env,
 
        LASSERT(lu_object_exists(lo));
        LASSERT(obj->oo_db);
-       LASSERT(osd_object_is_zap(obj->oo_db));
        LASSERT(info);
 
        OBD_SLAB_ALLOC_PTR_GFP(it, osd_zapit_cachep, GFP_NOFS);
@@ -302,7 +297,7 @@ found:
        if (unlikely((lma->lma_incompat & ~LMA_INCOMPAT_SUPP) ||
                     CFS_FAIL_CHECK(OBD_FAIL_OSD_LMA_INCOMPAT))) {
                CWARN("%s: unsupported incompat LMA feature(s) %#x for "
-                     "oid = "LPX64"\n", osd->od_svname,
+                     "oid = %#llx\n", osd->od_svname,
                      lma->lma_incompat & ~LMA_INCOMPAT_SUPP, oid);
                GOTO(out, rc = -EOPNOTSUPP);
        } else {
@@ -425,8 +420,6 @@ static int osd_dir_lookup(const struct lu_env *env, struct dt_object *dt,
        int                 rc;
        ENTRY;
 
-       LASSERT(osd_object_is_zap(obj->oo_db));
-
        if (name[0] == '.') {
                if (name[1] == 0) {
                        const struct lu_fid *f = lu_object_fid(&dt->do_lu);
@@ -476,8 +469,10 @@ static int osd_declare_dir_insert(const struct lu_env *env,
        else
                object = obj->oo_db->db_object;
 
-       dmu_tx_hold_bonus(oh->ot_tx, object);
-       dmu_tx_hold_zap(oh->ot_tx, object, TRUE, (char *)key);
+       /* do not specify the key as then DMU is trying to look it up
+        * which is very expensive. usually the layers above lookup
+        * before insertion */
+       dmu_tx_hold_zap(oh->ot_tx, object, TRUE, NULL);
 
        RETURN(0);
 }
@@ -564,7 +559,7 @@ static int osd_seq_exists(const struct lu_env *env, struct osd_device *osd,
        rc = osd_fld_lookup(env, osd, seq, range);
        if (rc != 0) {
                if (rc != -ENOENT)
-                       CERROR("%s: Can not lookup fld for "LPX64"\n",
+                       CERROR("%s: Can not lookup fld for %#llx\n",
                               osd_name(osd), seq);
                RETURN(0);
        }
@@ -624,7 +619,6 @@ static int osd_dir_insert(const struct lu_env *env, struct dt_object *dt,
        ENTRY;
 
        LASSERT(parent->oo_db);
-       LASSERT(osd_object_is_zap(parent->oo_db));
 
        LASSERT(dt_object_exists(dt));
        LASSERT(osd_invariant(parent));
@@ -726,12 +720,15 @@ static int osd_declare_dir_delete(const struct lu_env *env,
 
        if (dt_object_exists(dt)) {
                LASSERT(obj->oo_db);
-               LASSERT(osd_object_is_zap(obj->oo_db));
                dnode = obj->oo_db->db_object;
        } else {
                dnode = DMU_NEW_OBJECT;
        }
-       dmu_tx_hold_zap(oh->ot_tx, dnode, TRUE, (char *)key);
+
+       /* do not specify the key as then DMU is trying to look it up
+        * which is very expensive. usually the layers above lookup
+        * before deletion */
+       dmu_tx_hold_zap(oh->ot_tx, dnode, FALSE, NULL);
 
        RETURN(0);
 }
@@ -748,7 +745,6 @@ static int osd_dir_delete(const struct lu_env *env, struct dt_object *dt,
        ENTRY;
 
        LASSERT(zap_db);
-       LASSERT(osd_object_is_zap(zap_db));
 
        LASSERT(th != NULL);
        oh = container_of0(th, struct osd_thandle, ot_super);
@@ -1212,9 +1208,9 @@ static int osd_declare_index_insert(const struct lu_env *env,
 
        dmu_tx_hold_bonus(oh->ot_tx, obj->oo_db->db_object);
 
-       /* It is not clear what API should be used for binary keys, so we pass
-        * a null name which has the side effect of over-reserving space,
-        * accounting for the worst case. See zap_count_write() */
+       /* do not specify the key as then DMU is trying to look it up
+        * which is very expensive. usually the layers above lookup
+        * before insertion */
        dmu_tx_hold_zap(oh->ot_tx, obj->oo_db->db_object, TRUE, NULL);
 
        RETURN(0);
@@ -1262,7 +1258,11 @@ static int osd_declare_index_delete(const struct lu_env *env,
        LASSERT(obj->oo_db);
 
        oh = container_of0(th, struct osd_thandle, ot_super);
-       dmu_tx_hold_zap(oh->ot_tx, obj->oo_db->db_object, TRUE, NULL);
+
+       /* do not specify the key as then DMU is trying to look it up
+        * which is very expensive. usually the layers above lookup
+        * before deletion */
+       dmu_tx_hold_zap(oh->ot_tx, obj->oo_db->db_object, FALSE, NULL);
 
        RETURN(0);
 }
@@ -1304,7 +1304,7 @@ static int osd_index_it_get(const struct lu_env *env, struct dt_it *di,
         * XXX: we need a binary version of zap_cursor_move_to_key()
         *      to implement this API */
        if (*((const __u64 *)key) != 0)
-               CERROR("NOT IMPLEMETED YET (move to "LPX64")\n",
+               CERROR("NOT IMPLEMETED YET (move to %#llx)\n",
                       *((__u64 *)key));
 
        zap_cursor_fini(it->ozi_zc);