unsigned int sa_xvalid; /* OP_XVALID */
int sa_stripe_index;
struct ost_layout sa_layout;
+ struct ost_layout_compr sa_layout_compr;
const struct lu_fid *sa_parent_fid;
/* SETATTR interface is used for regular setattr, */
/* truncate(2) and fallocate(2) subtypes */
dst->ol_comp_id = __le32_to_cpu(src->ol_comp_id);
}
+static inline void ost_layout_compr_cpu_to_le(struct ost_layout_compr *dst,
+ const struct ost_layout_compr *src)
+{
+ dst->ol_compr_type = src->ol_compr_type;
+ dst->ol_compr_lvl = src->ol_compr_lvl;
+ dst->ol_compr_chunk_log_bits = src->ol_compr_chunk_log_bits;
+}
+
+static inline void ost_layout_compr_le_to_cpu(struct ost_layout_compr *dst,
+ const struct ost_layout_compr *src)
+{
+ dst->ol_compr_type = src->ol_compr_type;
+ dst->ol_compr_lvl = src->ol_compr_lvl;
+ dst->ol_compr_chunk_log_bits = src->ol_compr_chunk_log_bits;
+}
+
static inline void filter_fid_cpu_to_le(struct filter_fid *dst,
const struct filter_fid *src, int size)
{
* brw: grant space consumed on
* the client for the write */
__u32 o_projid;
- __u32 o_padding_4; /* also fix
+ struct ost_layout_compr o_layout_compr;
+ __u16 o_padding_4; /* also fix
* lustre_swab_obdo() */
__u64 o_padding_5;
__u64 o_padding_6;
__u32 ol_comp_id;
} __attribute__((packed));
+struct ost_layout_compr {
+ __u8 ol_compr_type;
+ __u8 ol_compr_lvl:4,
+ ol_compr_chunk_log_bits:4;
+} __attribute__((packed));
+
/* The filter_fid structure has changed several times over its lifetime.
* For a long time "trusted.fid" held the MDT inode parent FID/IGIF and
* stripe_index and the "self FID" (objid/seq) to be able to recover the
__u64 lcme_timestamp; /* snapshot time if applicable*/
__u16 lcme_padding_1;
__u8 lcme_compr_type; /* compress type */
- __u8 lcme_compr_lvl:4; /* compress level */
- __u8 lcme_compr_chunk_log_bits:4;
+ __u8 lcme_compr_lvl:4, /* compress level */
+ lcme_compr_chunk_log_bits:4;
/* chunk_size = 2^(16+chunk_log_bits)
* i.e. power-of-two multiple of 64KiB */
} __attribute__((packed));
return container_of_safe(lov, struct obd_device, u.lov);
}
-static inline void lov_lsm2layout(struct lov_stripe_md *lsm,
- struct lov_stripe_md_entry *lsme,
- struct ost_layout *ol)
+static inline void lov_lsm2layout2(struct lov_stripe_md *lsm,
+ struct lov_stripe_md_entry *lsme,
+ struct ost_layout *ol,
+ struct ost_layout_compr *olc)
{
ol->ol_stripe_size = lsme->lsme_stripe_size;
ol->ol_stripe_count = lsme->lsme_stripe_count;
ol->ol_comp_start = lsme->lsme_extent.e_start;
ol->ol_comp_end = lsme->lsme_extent.e_end;
ol->ol_comp_id = lsme->lsme_id;
+ if (olc) {
+ olc->ol_compr_type = lsme->lsme_compr_type;
+ olc->ol_compr_lvl = lsme->lsme_compr_lvl;
+ olc->ol_compr_chunk_log_bits =
+ lsme->lsme_compr_chunk_log_bits;
+ }
} else {
ol->ol_comp_start = 0;
ol->ol_comp_end = 0;
ol->ol_comp_id = 0;
+ if (olc) {
+ olc->ol_compr_type = LL_COMPR_TYPE_NONE;
+ olc->ol_compr_lvl = 0;
+ olc->ol_compr_chunk_log_bits = 0;
+ }
}
}
+static inline void lov_lsm2layout(struct lov_stripe_md *lsm,
+ struct lov_stripe_md_entry *lsme,
+ struct ost_layout *ol)
+{
+ lov_lsm2layout2(lsm, lsme, ol, NULL);
+}
+
struct pool_desc *lov_pool_find(struct obd_device *obd, char *poolname);
void lov_pool_putref(struct pool_desc *pool);
#endif
stripe);
io->u.ci_setattr.sa_attr.lvb_size = new_size;
}
- lov_lsm2layout(lsm, lsm->lsm_entries[index],
- &io->u.ci_setattr.sa_layout);
+ lov_lsm2layout2(lsm, lsm->lsm_entries[index],
+ &io->u.ci_setattr.sa_layout,
+ &io->u.ci_setattr.sa_layout_compr);
break;
}
case CIT_DATA_VERSION: {
{
struct lovsub_object *subobj = cl2lovsub(obj);
struct lov_stripe_md *lsm = subobj->lso_super->lo_lsm;
+ int index = subobj->lso_index;
ENTRY;
cl_req_attr_set(env, &subobj->lso_super->lo_cl, attr);
* There is no OBD_MD_* flag for obdo::o_stripe_idx, so set it
* unconditionally. It never changes anyway.
*/
- attr->cra_oa->o_stripe_idx = lov_comp_stripe(subobj->lso_index);
- lov_lsm2layout(lsm, lsm->lsm_entries[lov_comp_entry(subobj->lso_index)],
- &attr->cra_oa->o_layout);
+ attr->cra_oa->o_stripe_idx = lov_comp_stripe(index);
+ lov_lsm2layout2(lsm, lsm->lsm_entries[lov_comp_entry(index)],
+ &attr->cra_oa->o_layout,
+ &attr->cra_oa->o_layout_compr);
attr->cra_oa->o_valid |= OBD_MD_FLOSTLAYOUT;
EXIT;
}
obdo_set_parent_fid(oa, io->u.ci_setattr.sa_parent_fid);
oa->o_stripe_idx = io->u.ci_setattr.sa_stripe_index;
oa->o_layout = io->u.ci_setattr.sa_layout;
+ oa->o_layout_compr = io->u.ci_setattr.sa_layout_compr;
oa->o_valid |= OBD_MD_FLID | OBD_MD_FLGROUP |
OBD_MD_FLOSTLAYOUT;
if (ia_avalid & ATTR_CTIME) {
__swab32s(&o->o_gid_h);
__swab64s(&o->o_data_version);
__swab32s(&o->o_projid);
+ /* do not need to swab o_layout_compr */
BUILD_BUG_ON(offsetof(typeof(*o), o_padding_4) == 0);
BUILD_BUG_ON(offsetof(typeof(*o), o_padding_5) == 0);
BUILD_BUG_ON(offsetof(typeof(*o), o_padding_6) == 0);
LASSERTF((int)sizeof(((struct ost_layout *)0)->ol_comp_id) == 4, "found %lld\n",
(long long)(int)sizeof(((struct ost_layout *)0)->ol_comp_id));
+ /* Checks for struct ost_layout_compr */
+ LASSERTF((int)sizeof(struct ost_layout_compr) == 2, "found %lld\n",
+ (long long)(int)sizeof(struct ost_layout_compr));
+ LASSERTF((int)offsetof(struct ost_layout_compr, ol_compr_type) == 0, "found %lld\n",
+ (long long)(int)offsetof(struct ost_layout_compr, ol_compr_type));
+ LASSERTF((int)sizeof(((struct ost_layout_compr *)0)->ol_compr_type) == 1, "found %lld\n",
+ (long long)(int)sizeof(((struct ost_layout_compr *)0)->ol_compr_type));
+ /* ost_layout_compr.ol_compr_lvl is a bitfield and cannot be checked */
+ /* ost_layout_compr.ol_compr_chunk_log_bits is a bitfield and cannot be checked */
+
/* Checks for struct obdo */
LASSERTF((int)sizeof(struct obdo) == 208, "found %lld\n",
(long long)(int)sizeof(struct obdo));
(long long)(int)offsetof(struct obdo, o_projid));
LASSERTF((int)sizeof(((struct obdo *)0)->o_projid) == 4, "found %lld\n",
(long long)(int)sizeof(((struct obdo *)0)->o_projid));
- LASSERTF((int)offsetof(struct obdo, o_padding_4) == 188, "found %lld\n",
+ LASSERTF((int)offsetof(struct obdo, o_layout_compr) == 188, "found %lld\n",
+ (long long)(int)offsetof(struct obdo, o_layout_compr));
+ LASSERTF((int)sizeof(((struct obdo *)0)->o_layout_compr) == 2, "found %lld\n",
+ (long long)(int)sizeof(((struct obdo *)0)->o_layout_compr));
+ LASSERTF((int)offsetof(struct obdo, o_padding_4) == 190, "found %lld\n",
(long long)(int)offsetof(struct obdo, o_padding_4));
- LASSERTF((int)sizeof(((struct obdo *)0)->o_padding_4) == 4, "found %lld\n",
+ LASSERTF((int)sizeof(((struct obdo *)0)->o_padding_4) == 2, "found %lld\n",
(long long)(int)sizeof(((struct obdo *)0)->o_padding_4));
LASSERTF((int)offsetof(struct obdo, o_padding_5) == 192, "found %lld\n",
(long long)(int)offsetof(struct obdo, o_padding_5));
CHECK_MEMBER(lustre_ost_attrs, loa_comp_end);
}
-
static void
check_som_attrs(void)
{
}
static void
+check_ost_layout_compr(void)
+{
+ BLANK_LINE();
+ CHECK_STRUCT(ost_layout_compr);
+ CHECK_MEMBER(ost_layout_compr, ol_compr_type);
+ CHECK_BITFIELD(ost_layout_compr, ol_compr_lvl);
+ CHECK_BITFIELD(ost_layout_compr, ol_compr_chunk_log_bits);
+}
+
+static void
check_obdo(void)
{
BLANK_LINE();
CHECK_MEMBER(obdo, o_gid_h);
CHECK_MEMBER(obdo, o_data_version);
CHECK_MEMBER(obdo, o_projid);
+ CHECK_MEMBER(obdo, o_layout_compr);
CHECK_MEMBER(obdo, o_padding_4);
CHECK_MEMBER(obdo, o_padding_5);
CHECK_MEMBER(obdo, o_padding_6);
check_ptlrpc_body();
check_obd_connect_data();
check_ost_layout();
+ check_ost_layout_compr();
check_obdo();
check_lov_ost_data_v1();
check_lov_mds_md_v1();
(long long)(int)offsetof(struct obd_connect_data, paddingF));
LASSERTF((int)sizeof(((struct obd_connect_data *)0)->paddingF) == 8, "found %lld\n",
(long long)(int)sizeof(((struct obd_connect_data *)0)->paddingF));
+
LASSERTF(OBD_CONNECT_RDONLY == 0x1ULL, "found 0x%.16llxULL\n",
OBD_CONNECT_RDONLY);
LASSERTF(OBD_CONNECT_INDEX == 0x2ULL, "found 0x%.16llxULL\n",
LASSERTF((int)sizeof(((struct ost_layout *)0)->ol_comp_id) == 4, "found %lld\n",
(long long)(int)sizeof(((struct ost_layout *)0)->ol_comp_id));
+ /* Checks for struct ost_layout_compr */
+ LASSERTF((int)sizeof(struct ost_layout_compr) == 2, "found %lld\n",
+ (long long)(int)sizeof(struct ost_layout_compr));
+ LASSERTF((int)offsetof(struct ost_layout_compr, ol_compr_type) == 0, "found %lld\n",
+ (long long)(int)offsetof(struct ost_layout_compr, ol_compr_type));
+ LASSERTF((int)sizeof(((struct ost_layout_compr *)0)->ol_compr_type) == 1, "found %lld\n",
+ (long long)(int)sizeof(((struct ost_layout_compr *)0)->ol_compr_type));
+ /* ost_layout_compr.ol_compr_lvl is a bitfield and cannot be checked */
+ /* ost_layout_compr.ol_compr_chunk_log_bits is a bitfield and cannot be checked */
+
/* Checks for struct obdo */
LASSERTF((int)sizeof(struct obdo) == 208, "found %lld\n",
(long long)(int)sizeof(struct obdo));
(long long)(int)offsetof(struct obdo, o_projid));
LASSERTF((int)sizeof(((struct obdo *)0)->o_projid) == 4, "found %lld\n",
(long long)(int)sizeof(((struct obdo *)0)->o_projid));
- LASSERTF((int)offsetof(struct obdo, o_padding_4) == 188, "found %lld\n",
+ LASSERTF((int)offsetof(struct obdo, o_layout_compr) == 188, "found %lld\n",
+ (long long)(int)offsetof(struct obdo, o_layout_compr));
+ LASSERTF((int)sizeof(((struct obdo *)0)->o_layout_compr) == 2, "found %lld\n",
+ (long long)(int)sizeof(((struct obdo *)0)->o_layout_compr));
+ LASSERTF((int)offsetof(struct obdo, o_padding_4) == 190, "found %lld\n",
(long long)(int)offsetof(struct obdo, o_padding_4));
- LASSERTF((int)sizeof(((struct obdo *)0)->o_padding_4) == 4, "found %lld\n",
+ LASSERTF((int)sizeof(((struct obdo *)0)->o_padding_4) == 2, "found %lld\n",
(long long)(int)sizeof(((struct obdo *)0)->o_padding_4));
LASSERTF((int)offsetof(struct obdo, o_padding_5) == 192, "found %lld\n",
(long long)(int)offsetof(struct obdo, o_padding_5));