Whamcloud - gitweb
LU-9771 ptlrpc: use lu_extent in layout_intent 87/29087/12
authorJinshan Xiong <jinshan.xiong@intel.com>
Sun, 6 Aug 2017 05:27:24 +0000 (22:27 -0700)
committerJinshan Xiong <jinshan.xiong@intel.com>
Fri, 17 Nov 2017 08:01:00 +0000 (08:01 +0000)
This way it will be easier to check and print the extent
of layout.

Test-Parameters: testlist=sanity-flr

Signed-off-by: Jinshan Xiong <jinshan.xiong@intel.com>
Change-Id: Ie99142388310a8e321899c1795bc16bee97657be
Reviewed-on: https://review.whamcloud.com/29087
Reviewed-by: Lai Siyao <lai.siyao@intel.com>
Reviewed-by: Bobi Jam <bobijam@hotmail.com>
Tested-by: Jenkins
Tested-by: Maloo <hpdd-maloo@intel.com>
lustre/include/uapi/linux/lustre/lustre_idl.h
lustre/include/uapi/linux/lustre/lustre_user.h
lustre/llite/file.c
lustre/lod/lod_object.c
lustre/mdt/mdt_handler.c
lustre/ptlrpc/pack_generic.c
lustre/ptlrpc/wiretest.c
lustre/utils/wirecheck.c
lustre/utils/wiretest.c

index 0b44ba4..d8aa186 100644 (file)
@@ -3218,8 +3218,7 @@ enum {
 struct layout_intent {
        __u32 li_opc;   /* intent operation for enqueue, read, write etc */
        __u32 li_flags;
-       __u64 li_start;
-       __u64 li_end;
+       struct lu_extent li_extent;
 } __attribute__((packed));
 
 /**
index 314cb97..c400d20 100644 (file)
@@ -524,7 +524,7 @@ struct lu_extent {
        __u64   e_end;
 };
 
-#define DEXT "[ %#llx , %#llx )"
+#define DEXT "[%#llx, %#llx)"
 #define PEXT(ext) (ext)->e_start, (ext)->e_end
 
 static inline bool lu_extent_is_overlapped(struct lu_extent *e1,
index 542a026..8b516bb 100644 (file)
@@ -4709,8 +4709,8 @@ int ll_layout_write_intent(struct inode *inode, __u64 start, __u64 end)
 {
        struct layout_intent intent = {
                .li_opc = LAYOUT_INTENT_WRITE,
-               .li_start = start,
-               .li_end = end,
+               .li_extent.e_start = start,
+               .li_extent.e_end = end,
        };
        int rc;
        ENTRY;
index ef65469..7b54498 100644 (file)
@@ -5041,15 +5041,19 @@ static int lod_declare_layout_change(const struct lu_env *env,
        lod_comp = &lo->ldo_comp_entries[lo->ldo_comp_cnt - 1];
        if (lo->ldo_comp_cnt > 1 &&
            lod_comp->llc_extent.e_end != OBD_OBJECT_EOF &&
-           lod_comp->llc_extent.e_end < layout->li_end) {
+           lod_comp->llc_extent.e_end < layout->li_extent.e_end) {
                CDEBUG(replay ? D_ERROR : D_LAYOUT,
                       "%s: the defined layout [0, %#llx) does not covers "
-                      "the write range [%#llx, %#llx).\n",
+                      "the write range "DEXT"\n",
                       lod2obd(d)->obd_name, lod_comp->llc_extent.e_end,
-                      layout->li_start, layout->li_end);
+                      PEXT(&layout->li_extent));
                GOTO(out, rc = -EINVAL);
        }
 
+       CDEBUG(D_LAYOUT, "%s: "DFID": instantiate components "DEXT"\n",
+              lod2obd(d)->obd_name, PFID(lu_object_fid(&dt->do_lu)),
+              PEXT(&layout->li_extent));
+
        /*
         * Iterate ld->ldo_comp_entries, find the component whose extent under
         * the write range and not instantianted.
@@ -5057,7 +5061,7 @@ static int lod_declare_layout_change(const struct lu_env *env,
        for (i = 0; i < lo->ldo_comp_cnt; i++) {
                lod_comp = &lo->ldo_comp_entries[i];
 
-               if (lod_comp->llc_extent.e_start >= layout->li_end)
+               if (lod_comp->llc_extent.e_start >= layout->li_extent.e_end)
                        break;
 
                if (!replay) {
index 53fd951..9f34149 100644 (file)
@@ -1357,13 +1357,14 @@ static int mdt_layout_change(struct mdt_thread_info *info,
        ENTRY;
 
        CDEBUG(D_INFO, "got layout change request from client: "
-              "opc:%u flags:%#x extent[%#llx,%#llx)\n",
+              "opc:%u flags:%#x extent "DEXT"\n",
               layout->li_opc, layout->li_flags,
-              layout->li_start, layout->li_end);
-       if (layout->li_start >= layout->li_end) {
-               CERROR("Recieved an invalid layout change range [%llu, %llu) "
-                      "for "DFID"\n", layout->li_start, layout->li_end,
-                      PFID(mdt_object_fid(obj)));
+              PEXT(&layout->li_extent));
+
+       if (layout->li_extent.e_start >= layout->li_extent.e_end) {
+               CERROR("Recieved an invalid layout change range "DEXT
+                      "for "DFID"\n",
+                      PEXT(&layout->li_extent), PFID(mdt_object_fid(obj)));
                RETURN(-EINVAL);
        }
 
index 7c80969..2f07e36 100644 (file)
@@ -2630,12 +2630,17 @@ void lustre_swab_hsm_user_item(struct hsm_user_item *hui)
        lustre_swab_hsm_extent(&hui->hui_extent);
 }
 
+void lustre_swab_lu_extent(struct lu_extent *le)
+{
+       __swab64s(&le->e_start);
+       __swab64s(&le->e_end);
+}
+
 void lustre_swab_layout_intent(struct layout_intent *li)
 {
        __swab32s(&li->li_opc);
        __swab32s(&li->li_flags);
-       __swab64s(&li->li_start);
-       __swab64s(&li->li_end);
+       lustre_swab_lu_extent(&li->li_extent);
 }
 
 void lustre_swab_hsm_progress_kernel(struct hsm_progress_kernel *hpk)
index cdb23de..ec8b4d8 100644 (file)
@@ -4514,14 +4514,10 @@ void lustre_assert_wire_constants(void)
                 (long long)(int)offsetof(struct layout_intent, li_flags));
        LASSERTF((int)sizeof(((struct layout_intent *)0)->li_flags) == 4, "found %lld\n",
                 (long long)(int)sizeof(((struct layout_intent *)0)->li_flags));
-       LASSERTF((int)offsetof(struct layout_intent, li_start) == 8, "found %lld\n",
-                (long long)(int)offsetof(struct layout_intent, li_start));
-       LASSERTF((int)sizeof(((struct layout_intent *)0)->li_start) == 8, "found %lld\n",
-                (long long)(int)sizeof(((struct layout_intent *)0)->li_start));
-       LASSERTF((int)offsetof(struct layout_intent, li_end) == 16, "found %lld\n",
-                (long long)(int)offsetof(struct layout_intent, li_end));
-       LASSERTF((int)sizeof(((struct layout_intent *)0)->li_end) == 8, "found %lld\n",
-                (long long)(int)sizeof(((struct layout_intent *)0)->li_end));
+       LASSERTF((int)offsetof(struct layout_intent, li_extent) == 8, "found %lld\n",
+                (long long)(int)offsetof(struct layout_intent, li_extent));
+       LASSERTF((int)sizeof(((struct layout_intent *)0)->li_extent) == 16, "found %lld\n",
+                (long long)(int)sizeof(((struct layout_intent *)0)->li_extent));
        LASSERTF(LAYOUT_INTENT_ACCESS == 0, "found %lld\n",
                 (long long)LAYOUT_INTENT_ACCESS);
        LASSERTF(LAYOUT_INTENT_READ == 1, "found %lld\n",
index 3c42583..a2e0c10 100644 (file)
@@ -2161,12 +2161,11 @@ check_hsm_copy(void)
 
 static void check_layout_intent(void)
 {
-        BLANK_LINE();
-        CHECK_STRUCT(layout_intent);
-        CHECK_MEMBER(layout_intent, li_opc);
-        CHECK_MEMBER(layout_intent, li_flags);
-        CHECK_MEMBER(layout_intent, li_start);
-        CHECK_MEMBER(layout_intent, li_end);
+       BLANK_LINE();
+       CHECK_STRUCT(layout_intent);
+       CHECK_MEMBER(layout_intent, li_opc);
+       CHECK_MEMBER(layout_intent, li_flags);
+       CHECK_MEMBER(layout_intent, li_extent);
 
        CHECK_VALUE(LAYOUT_INTENT_ACCESS);
        CHECK_VALUE(LAYOUT_INTENT_READ);
index 54fdbf5..0cbe43c 100644 (file)
@@ -4533,14 +4533,10 @@ void lustre_assert_wire_constants(void)
                 (long long)(int)offsetof(struct layout_intent, li_flags));
        LASSERTF((int)sizeof(((struct layout_intent *)0)->li_flags) == 4, "found %lld\n",
                 (long long)(int)sizeof(((struct layout_intent *)0)->li_flags));
-       LASSERTF((int)offsetof(struct layout_intent, li_start) == 8, "found %lld\n",
-                (long long)(int)offsetof(struct layout_intent, li_start));
-       LASSERTF((int)sizeof(((struct layout_intent *)0)->li_start) == 8, "found %lld\n",
-                (long long)(int)sizeof(((struct layout_intent *)0)->li_start));
-       LASSERTF((int)offsetof(struct layout_intent, li_end) == 16, "found %lld\n",
-                (long long)(int)offsetof(struct layout_intent, li_end));
-       LASSERTF((int)sizeof(((struct layout_intent *)0)->li_end) == 8, "found %lld\n",
-                (long long)(int)sizeof(((struct layout_intent *)0)->li_end));
+       LASSERTF((int)offsetof(struct layout_intent, li_extent) == 8, "found %lld\n",
+                (long long)(int)offsetof(struct layout_intent, li_extent));
+       LASSERTF((int)sizeof(((struct layout_intent *)0)->li_extent) == 16, "found %lld\n",
+                (long long)(int)sizeof(((struct layout_intent *)0)->li_extent));
        LASSERTF(LAYOUT_INTENT_ACCESS == 0, "found %lld\n",
                 (long long)LAYOUT_INTENT_ACCESS);
        LASSERTF(LAYOUT_INTENT_READ == 1, "found %lld\n",