Whamcloud - gitweb
LU-2886 obdclass: use common way to store lastid
[fs/lustre-release.git] / lustre / mdt / mdt_lib.c
index 051421b..d2e6e45 100644 (file)
@@ -27,7 +27,7 @@
  * Copyright (c) 2007, 2010, Oracle and/or its affiliates. All rights reserved.
  * Use is subject to license terms.
  *
- * Copyright (c) 2011, 2012, Intel Corporation.
+ * Copyright (c) 2011, 2013, Intel Corporation.
  */
 /*
  * This file is part of Lustre, http://www.lustre.org/
@@ -537,19 +537,21 @@ void mdt_dump_lmm(int level, const struct lov_mds_md *lmm)
 
         count = le16_to_cpu(((struct lov_user_md*)lmm)->lmm_stripe_count);
 
-        CDEBUG(level, "objid "LPX64", magic 0x%08X, pattern %#X\n",
-               le64_to_cpu(lmm->lmm_object_id), le32_to_cpu(lmm->lmm_magic),
-               le32_to_cpu(lmm->lmm_pattern));
+       CDEBUG(level, "objid "DOSTID", magic 0x%08X, pattern %#X\n",
+              POSTID(&lmm->lmm_oi), le32_to_cpu(lmm->lmm_magic),
+              le32_to_cpu(lmm->lmm_pattern));
         CDEBUG(level,"stripe_size=0x%x, stripe_count=0x%x\n",
                le32_to_cpu(lmm->lmm_stripe_size), count);
         if (count == LOV_ALL_STRIPES)
                 return;
-        LASSERT(count <= LOV_MAX_STRIPE_COUNT);
-        for (i = 0, lod = lmm->lmm_objects; i < count; i++, lod++)
-                CDEBUG(level, "stripe %u idx %u subobj "LPX64"/"LPX64"\n",
-                       i, le32_to_cpu(lod->l_ost_idx),
-                       le64_to_cpu(lod->l_object_seq),
-                       le64_to_cpu(lod->l_object_id));
+
+       LASSERT(count <= LOV_MAX_STRIPE_COUNT);
+       for (i = 0, lod = lmm->lmm_objects; i < count; i++, lod++) {
+               struct ost_id   oi;
+               ostid_le_to_cpu((struct ost_id *)&lod->l_ost_oi, &oi);
+               CDEBUG(level, "stripe %u idx %u subobj "DOSTID"\n",
+                      i, le32_to_cpu(lod->l_ost_idx), POSTID(&oi));
+       }
 }
 
 /* Shrink and/or grow reply buffers */
@@ -690,9 +692,9 @@ int mdt_handle_last_unlink(struct mdt_thread_info *info, struct mdt_object *mo,
                 repbody->valid |= OBD_MD_FLCOOKIE;
         }
 
-        if (info->mti_mdt->mdt_opts.mo_oss_capa &&
-            info->mti_exp->exp_connect_flags & OBD_CONNECT_OSS_CAPA &&
-            repbody->valid & OBD_MD_FLEASIZE) {
+       if (info->mti_mdt->mdt_opts.mo_oss_capa &&
+           exp_connect_flags(info->mti_exp) & OBD_CONNECT_OSS_CAPA &&
+           repbody->valid & OBD_MD_FLEASIZE) {
                 struct lustre_capa *capa;
 
                 capa = req_capsule_server_get(info->mti_pill, &RMF_CAPA2);
@@ -1081,12 +1083,18 @@ static int mdt_unlink_unpack(struct mdt_thread_info *info)
         else
                 ma->ma_attr_flags &= ~MDS_VTX_BYPASS;
 
-        info->mti_spec.no_create = !!req_is_replay(mdt_info_req(info));
+       info->mti_spec.no_create = !!req_is_replay(mdt_info_req(info));
 
         rc = mdt_dlmreq_unpack(info);
         RETURN(rc);
 }
 
+static int mdt_rmentry_unpack(struct mdt_thread_info *info)
+{
+       info->mti_spec.sp_rm_entry = 1;
+       return mdt_unlink_unpack(info);
+}
+
 static int mdt_rename_unpack(struct mdt_thread_info *info)
 {
        struct lu_ucred         *uc = mdt_ucred(info);
@@ -1329,13 +1337,14 @@ static int mdt_setxattr_unpack(struct mdt_thread_info *info)
 typedef int (*reint_unpacker)(struct mdt_thread_info *info);
 
 static reint_unpacker mdt_reint_unpackers[REINT_MAX] = {
-        [REINT_SETATTR]  = mdt_setattr_unpack,
-        [REINT_CREATE]   = mdt_create_unpack,
-        [REINT_LINK]     = mdt_link_unpack,
-        [REINT_UNLINK]   = mdt_unlink_unpack,
-        [REINT_RENAME]   = mdt_rename_unpack,
-        [REINT_OPEN]     = mdt_open_unpack,
-        [REINT_SETXATTR] = mdt_setxattr_unpack
+       [REINT_SETATTR]  = mdt_setattr_unpack,
+       [REINT_CREATE]   = mdt_create_unpack,
+       [REINT_LINK]     = mdt_link_unpack,
+       [REINT_UNLINK]   = mdt_unlink_unpack,
+       [REINT_RENAME]   = mdt_rename_unpack,
+       [REINT_OPEN]     = mdt_open_unpack,
+       [REINT_SETXATTR] = mdt_setxattr_unpack,
+       [REINT_RMENTRY]  = mdt_rmentry_unpack,
 };
 
 int mdt_reint_unpack(struct mdt_thread_info *info, __u32 op)