} __attribute__((packed));
#define lov_user_md lov_user_md_v1
-#define lmm_stripe_offset u.lum_stripe_offset
struct lov_user_md_v1 { /* LOV EA user data (host-endian) */
- __u32 lmm_magic; /* magic number = LOV_USER_MAGIC_V1 */
- __u32 lmm_pattern; /* LOV_PATTERN_RAID0, LOV_PATTERN_RAID1 */
- __u64 lmm_object_id; /* LOV object ID */
- __u64 lmm_object_seq; /* LOV object seq */
- __u32 lmm_stripe_size; /* size of stripe in bytes */
- __u16 lmm_stripe_count; /* num stripes in use for this object */
- union {
- __u16 lum_stripe_offset; /* starting stripe offset in
- * lmm_objects, use when writing */
- __u16 lum_layout_gen; /* layout generation number
- * used when reading */
- } u;
- struct lov_user_ost_data_v1 lmm_objects[0]; /* per-stripe data */
+ __u32 lmm_magic; /* magic number = LOV_USER_MAGIC_V1 */
+ __u32 lmm_pattern; /* LOV_PATTERN_RAID0, LOV_PATTERN_RAID1 */
+ __u64 lmm_object_id; /* LOV object ID */
+ __u64 lmm_object_seq; /* LOV object seq */
+ __u32 lmm_stripe_size; /* size of stripe in bytes */
+ __u16 lmm_stripe_count; /* num stripes in use for this object */
+ union {
+ __u16 lmm_stripe_offset; /* starting stripe offset in
+ * lmm_objects, use when writing */
+ __u16 lmm_layout_gen; /* layout generation number
+ * used when reading */
+ };
+ struct lov_user_ost_data_v1 lmm_objects[0]; /* per-stripe data */
} __attribute__((packed, __may_alias__));
struct lov_user_md_v3 { /* LOV EA user data (host-endian) */
- __u32 lmm_magic; /* magic number = LOV_USER_MAGIC_V3 */
- __u32 lmm_pattern; /* LOV_PATTERN_RAID0, LOV_PATTERN_RAID1 */
- __u64 lmm_object_id; /* LOV object ID */
- __u64 lmm_object_seq; /* LOV object seq */
- __u32 lmm_stripe_size; /* size of stripe in bytes */
- __u16 lmm_stripe_count; /* num stripes in use for this object */
- union {
- __u16 lum_stripe_offset; /* starting stripe offset in
- * lmm_objects, use when writing */
- __u16 lum_layout_gen; /* layout generation number
- * used when reading */
- } u;
- char lmm_pool_name[LOV_MAXPOOLNAME]; /* pool name */
- struct lov_user_ost_data_v1 lmm_objects[0]; /* per-stripe data */
+ __u32 lmm_magic; /* magic number = LOV_USER_MAGIC_V3 */
+ __u32 lmm_pattern; /* LOV_PATTERN_RAID0, LOV_PATTERN_RAID1 */
+ __u64 lmm_object_id; /* LOV object ID */
+ __u64 lmm_object_seq; /* LOV object seq */
+ __u32 lmm_stripe_size; /* size of stripe in bytes */
+ __u16 lmm_stripe_count; /* num stripes in use for this object */
+ union {
+ __u16 lmm_stripe_offset; /* starting stripe offset in
+ * lmm_objects, use when writing */
+ __u16 lmm_layout_gen; /* layout generation number
+ * used when reading */
+ };
+ char lmm_pool_name[LOV_MAXPOOLNAME]; /* pool name */
+ struct lov_user_ost_data_v1 lmm_objects[0]; /* per-stripe data */
} __attribute__((packed));
/* Compile with -D_LARGEFILE64_SOURCE or -D_GNU_SOURCE (or #define) to
lump = (struct lov_user_md *)buffer;
memcpy(lump, lmm, lmmsize);
+ /* do not return layout gen for getxattr otherwise it would
+ * confuse tar --xattr by recognizing layout gen as stripe
+ * offset when the file is restored. See LU-2809. */
+ lump->lmm_layout_gen = 0;
rc = lmmsize;
out:
lmm_size = lum_size;
else if (lum.lmm_stripe_count < lmmk->lmm_stripe_count)
GOTO(out_set, rc = -EOVERFLOW);
- /*
- * Have a difference between lov_mds_md & lov_user_md.
- * So we have to re-order the data before copy to user.
- */
- lum.lmm_stripe_count = lmmk->lmm_stripe_count;
- lum.u.lum_layout_gen = lmmk->lmm_layout_gen;
- ((struct lov_user_md*)lmmk)->u.lum_layout_gen = lum.u.lum_layout_gen;
- ((struct lov_user_md*)lmmk)->lmm_stripe_count = lum.lmm_stripe_count;
- if (cfs_copy_to_user(lump, lmmk, lmm_size))
- rc = -EFAULT;
-
- obd_free_diskmd(exp, &lmmk);
+ /*
+ * Have a difference between lov_mds_md & lov_user_md.
+ * So we have to re-order the data before copy to user.
+ */
+ lum.lmm_stripe_count = lmmk->lmm_stripe_count;
+ lum.lmm_layout_gen = lmmk->lmm_layout_gen;
+ ((struct lov_user_md *)lmmk)->lmm_layout_gen = lum.lmm_layout_gen;
+ ((struct lov_user_md *)lmmk)->lmm_stripe_count = lum.lmm_stripe_count;
+ if (cfs_copy_to_user(lump, lmmk, lmm_size))
+ rc = -EFAULT;
+
+ obd_free_diskmd(exp, &lmmk);
out_set:
- set_fs(seg);
- RETURN(rc);
+ set_fs(seg);
+ RETURN(rc);
}
static void print_lum (struct lov_user_md *lum)
{
- CDEBUG(D_OTHER, "lov_user_md %p:\n", lum);
- CDEBUG(D_OTHER, "\tlmm_magic: %#x\n", lum->lmm_magic);
- CDEBUG(D_OTHER, "\tlmm_pattern: %#x\n", lum->lmm_pattern);
- CDEBUG(D_OTHER, "\tlmm_object_id: "LPU64"\n", lum->lmm_object_id);
- CDEBUG(D_OTHER, "\tlmm_object_gr: "LPU64"\n", lum->lmm_object_seq);
- CDEBUG(D_OTHER, "\tlmm_stripe_size: %#x\n", lum->lmm_stripe_size);
- CDEBUG(D_OTHER, "\tlmm_stripe_count: %#x\n", lum->lmm_stripe_count);
- CDEBUG(D_OTHER, "\tlmm_stripe_offset/lmm_layout_gen: %#x\n",
- lum->u.lum_stripe_offset);
+ CDEBUG(D_OTHER, "lov_user_md %p:\n", lum);
+ CDEBUG(D_OTHER, "\tlmm_magic: %#x\n", lum->lmm_magic);
+ CDEBUG(D_OTHER, "\tlmm_pattern: %#x\n", lum->lmm_pattern);
+ CDEBUG(D_OTHER, "\tlmm_object_id: "LPU64"\n", lum->lmm_object_id);
+ CDEBUG(D_OTHER, "\tlmm_object_gr: "LPU64"\n", lum->lmm_object_seq);
+ CDEBUG(D_OTHER, "\tlmm_stripe_size: %#x\n", lum->lmm_stripe_size);
+ CDEBUG(D_OTHER, "\tlmm_stripe_count: %#x\n", lum->lmm_stripe_count);
+ CDEBUG(D_OTHER, "\tlmm_stripe_offset/lmm_layout_gen: %#x\n",
+ lum->lmm_stripe_offset);
}
static void lustre_swab_lov_user_md_common(struct lov_user_md_v1 *lum)
{
- ENTRY;
- __swab32s(&lum->lmm_magic);
- __swab32s(&lum->lmm_pattern);
- __swab64s(&lum->lmm_object_id);
- __swab64s(&lum->lmm_object_seq);
- __swab32s(&lum->lmm_stripe_size);
- __swab16s(&lum->lmm_stripe_count);
- __swab16s(&lum->u.lum_stripe_offset);
- print_lum(lum);
- EXIT;
+ ENTRY;
+ __swab32s(&lum->lmm_magic);
+ __swab32s(&lum->lmm_pattern);
+ __swab64s(&lum->lmm_object_id);
+ __swab64s(&lum->lmm_object_seq);
+ __swab32s(&lum->lmm_stripe_size);
+ __swab16s(&lum->lmm_stripe_count);
+ __swab16s(&lum->lmm_stripe_offset);
+ print_lum(lum);
+ EXIT;
}
void lustre_swab_lov_user_md_v1(struct lov_user_md_v1 *lum)
llapi_printf(LLAPI_MSG_NORMAL, "%slayout_gen: ",
prefix);
llapi_printf(LLAPI_MSG_NORMAL, "%u%c",
- (int)lum->u.lum_layout_gen, nl);
+ (int)lum->lmm_layout_gen, nl);
}
if (verbose & VERBOSE_OFFSET) {