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));
/**
__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,
{
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;
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.
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) {
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);
}
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)
(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",
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);
(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",