* whether the object has a mirror, then we can skip objects
* with mirror_id=0 (no mirror)
*/
- if (attrs->loa_filter_fid_size >= sizeof(struct filter_fid)) {
+ if (attrs->loa_filter_fid_size >= sizeof(struct filter_fid_210)) {
if (mirror_id_of(attrs->loa_filter_fid.ff_layout.ol_comp_id)
== 0) {
ls->ls_nomirror_objs++;
lo->lo_fid = attrs->loa_filter_fid.ff_parent;
lo->lo_used_kb = loa_used_kb(attrs);
lo->lo_last_utime = last_used;
- if (attrs->loa_filter_fid_size >= sizeof(struct filter_fid)) {
+ if (attrs->loa_filter_fid_size >= sizeof(struct filter_fid_210)) {
__u32 id;
id = mirror_id_of(attrs->loa_filter_fid.ff_layout.ol_comp_id);
static inline void filter_fid_cpu_to_le(struct filter_fid *dst,
const struct filter_fid *src, int size)
{
- fid_cpu_to_le(&dst->ff_parent, &src->ff_parent);
-
- if (size < sizeof(struct filter_fid)) {
- memset(&dst->ff_layout, 0, sizeof(dst->ff_layout));
+ if (size >= sizeof(struct filter_fid_24_29)) {
+ fid_cpu_to_le(&dst->ff_parent, &src->ff_parent);
} else {
+ memset(dst, 0, sizeof(*dst));
+ return;
+ }
+ if (size >= sizeof(struct filter_fid_210)) {
ost_layout_cpu_to_le(&dst->ff_layout, &src->ff_layout);
+ } else {
+ memset(&dst->ff_layout, 0, sizeof(*dst) -
+ offsetof(struct filter_fid, ff_layout));
+ return;
+ }
+ if (size >= sizeof(struct filter_fid_215)) {
dst->ff_layout_version = cpu_to_le32(src->ff_layout_version);
dst->ff_range = cpu_to_le32(src->ff_range);
+ } else {
+ memset(&dst->ff_layout_version, 0, sizeof(*dst) -
+ offsetof(struct filter_fid, ff_layout_version));
+ return;
+ }
+ if (size >= sizeof(struct filter_fid)) {
+ ost_layout_compr_cpu_to_le(&dst->ff_layout_compr,
+ &src->ff_layout_compr);
+ } else {
+ memset(&dst->ff_layout_compr, 0, sizeof(*dst) -
+ offsetof(struct filter_fid, ff_layout_compr));
+ return;
}
/* XXX: Add more if filter_fid is enlarged in the future. */
static inline void filter_fid_le_to_cpu(struct filter_fid *dst,
const struct filter_fid *src, int size)
{
- fid_le_to_cpu(&dst->ff_parent, &src->ff_parent);
-
- if (size < sizeof(struct filter_fid)) {
- memset(&dst->ff_layout, 0, sizeof(dst->ff_layout));
+ if (size >= sizeof(struct filter_fid_24_29)) {
+ fid_le_to_cpu(&dst->ff_parent, &src->ff_parent);
} else {
+ memset(dst, 0, sizeof(*dst));
+ return;
+ }
+ if (size >= sizeof(struct filter_fid_210)) {
ost_layout_le_to_cpu(&dst->ff_layout, &src->ff_layout);
+ } else {
+ memset(&dst->ff_layout, 0, sizeof(*dst) -
+ offsetof(struct filter_fid, ff_layout));
+ return;
+ }
+ if (size >= sizeof(struct filter_fid_215)) {
dst->ff_layout_version = le32_to_cpu(src->ff_layout_version);
dst->ff_range = le32_to_cpu(src->ff_range);
+ } else {
+ memset(&dst->ff_layout_version, 0, sizeof(*dst) -
+ offsetof(struct filter_fid, ff_layout_version));
+ return;
+ }
+ if (size >= sizeof(struct filter_fid)) {
+ ost_layout_compr_le_to_cpu(&dst->ff_layout_compr,
+ &src->ff_layout_compr);
+ } else {
+ memset(&dst->ff_layout_compr, 0, sizeof(*dst) -
+ offsetof(struct filter_fid, ff_layout_compr));
+ return;
}
/* XXX: Add more if filter_fid is enlarged in the future. */
* range so that writes to old versions of the layout are not allowed.
* That ensures that mirrored objects are not modified by evicted clients,
* and ensures that the components are correctly marked stale on the MDT.
+ *
+ * In 2.15 layout compression info also need to be stored.
*/
struct filter_fid_18_23 {
struct lu_fid ff_parent; /* stripe_idx in f_ver */
struct ost_layout ff_layout;
};
-struct filter_fid {
+struct filter_fid_215 {
struct lu_fid ff_parent; /* stripe_idx in f_ver */
struct ost_layout ff_layout;
__u32 ff_layout_version;
* write are allowed */
} __attribute__((packed));
+struct filter_fid {
+ struct lu_fid ff_parent; /* stripe_idx in f_ver */
+ struct ost_layout ff_layout;
+ __u32 ff_layout_version;
+ __u32 ff_range;
+ struct ost_layout_compr ff_layout_compr;
+} __attribute__((packed));
+
/* Userspace should treat lu_fid as opaque, and only use the following methods
* to print or parse them. Other functions (e.g. compare, swab) could be moved
* here from lustre_idl.h if needed. */
ff->ff_layout.ol_comp_id = comp->llc_id;
ff->ff_layout.ol_comp_start = comp->llc_extent.e_start;
ff->ff_layout.ol_comp_end = comp->llc_extent.e_end;
+ ff->ff_layout_compr.ol_compr_type = comp->llc_compr_type;
+ ff->ff_layout_compr.ol_compr_lvl = comp->llc_compr_lvl;
+ ff->ff_layout_compr.ol_compr_chunk_log_bits =
+ comp->llc_compr_chunk_log_bits - COMPR_CHUNK_MIN_BITS;
filter_fid_cpu_to_le(ff, ff, sizeof(*ff));
+ /* no compress params for uncompressed file, for compatibility */
+ if (comp->llc_compr_type == LL_COMPR_TYPE_NONE)
+ buf->lb_len = sizeof(struct filter_fid_215);
+
if (data->locd_declare)
rc = lod_sub_declare_xattr_set(env, dt, buf, XATTR_NAME_FID,
LU_XATTR_REPLACE, th);
ff->ff_parent.f_oid = oa->o_parent_oid;
ff->ff_parent.f_stripe_idx = oa->o_stripe_idx;
ff->ff_layout = oa->o_layout;
+ ff->ff_layout_compr = oa->o_layout_compr;
spin_lock(&ofd->ofd_inconsistency_lock);
if (fo->ofo_pfid_checking || fo->ofo_pfid_verified) {
le32_add_cpu(&ff->ff_parent.f_oid, -1);
info->fti_buf.lb_buf = ff;
- info->fti_buf.lb_len = sizeof(*ff);
+ /* no compress params for uncompressed file, for compatibility */
+ if (ff->ff_layout_compr.ol_compr_type == LL_COMPR_TYPE_NONE)
+ info->fti_buf.lb_len = sizeof(struct filter_fid_215);
+ else
+ info->fti_buf.lb_len = sizeof(*ff);
rc = dt_xattr_set(env, dt_obj, &info->fti_buf, XATTR_NAME_FID, 0, th);
if (rc == 0)
filter_fid_le_to_cpu(&ofd_obj->ofo_ff, ff, sizeof(*ff));
* be the same for all objects in this fileset. */
ff->ff_parent.f_ver = oa->o_stripe_idx;
}
- if (oa->o_valid & OBD_MD_FLOSTLAYOUT)
+ if (oa->o_valid & OBD_MD_FLOSTLAYOUT) {
ff->ff_layout = oa->o_layout;
+ ff->ff_layout_compr = oa->o_layout_compr;
+ }
if (oa->o_valid & OBD_MD_LAYOUT_VERSION) {
CDEBUG(D_INODE, DFID": OST("DFID") layout version %u -> %u\n",
GOTO(unlock, rc);
info->fti_buf.lb_buf = ff;
- info->fti_buf.lb_len = sizeof(*ff);
+ /**
+ * no compress params for uncompressed file, for compatibility.
+ */
+ if (ff->ff_layout_compr.ol_compr_type == LL_COMPR_TYPE_NONE)
+ info->fti_buf.lb_len = sizeof(struct filter_fid_215);
+ else
+ info->fti_buf.lb_len = sizeof(*ff);
rc = dt_xattr_set(env, ofd_object_child(fo), &info->fti_buf,
XATTR_NAME_FID, fl, th);
if (!rc)
ff->ff_parent.f_oid = oa->o_parent_oid;
ff->ff_parent.f_ver = oa->o_stripe_idx;
}
- if (oa->o_valid & OBD_MD_FLOSTLAYOUT)
+ if (oa->o_valid & OBD_MD_FLOSTLAYOUT) {
ff->ff_layout = oa->o_layout;
+ ff->ff_layout_compr = oa->o_layout_compr;
+ }
if (oa->o_valid & OBD_MD_LAYOUT_VERSION)
ff->ff_layout_version = oa->o_layout_version;
filter_fid_cpu_to_le(ff, ff, sizeof(*ff));
if (ff_needed) {
info->fti_buf.lb_buf = ff;
- info->fti_buf.lb_len = sizeof(*ff);
+ /**
+ * no compress params for uncompressed file, for compatibility.
+ */
+ if (ff->ff_layout_compr.ol_compr_type == LL_COMPR_TYPE_NONE)
+ info->fti_buf.lb_len = sizeof(struct filter_fid_215);
+ else
+ info->fti_buf.lb_len = sizeof(*ff);
rc = dt_declare_xattr_set(env, ofd_object_child(fo),
&info->fti_buf, XATTR_NAME_FID, 0,
th);
GOTO(unlock, rc);
info->fti_buf.lb_buf = ff;
- info->fti_buf.lb_len = sizeof(*ff);
+ /**
+ * no compress params for uncompressed file, for compatibility.
+ */
+ if (ff->ff_layout_compr.ol_compr_type == LL_COMPR_TYPE_NONE)
+ info->fti_buf.lb_len = sizeof(struct filter_fid_215);
+ else
+ info->fti_buf.lb_len = sizeof(*ff);
rc = dt_xattr_set(env, ofd_object_child(fo), &info->fti_buf,
XATTR_NAME_FID, fl, th);
if (!rc)
ol->ol_comp_end = 0;
ol->ol_comp_id = 0;
}
+ memset(&ff->ff_layout_compr, 0, sizeof(ff->ff_layout_compr));
} else {
/* Get enc context xattr directly from ldiskfs instead of going
* through the VFS, as there is no xattr handler for
ENTRY;
- if (buf->lb_len != sizeof(*ff) && buf->lb_len != sizeof(struct lu_fid))
+ if (buf->lb_len != sizeof(*ff) &&
+ buf->lb_len != sizeof(struct lu_fid) &&
+ buf->lb_len != sizeof(struct filter_fid_215))
RETURN(-EINVAL);
rc = osd_get_lma(info, inode, dentry, loa);
ol->ol_comp_end = 0;
ol->ol_comp_id = 0;
}
+ memset(&ff->ff_layout_compr, 0, sizeof(ff->ff_layout_compr));
RETURN(0);
}
verify_comp_attr lcme_flags $tf ${ids[0]} init,^stale
verify_comp_attr lcme_flags $tf ${ids[1]} init,stale
- # release the lease lock
- kill -USR1 $pid && wait $pid || error "$MULTIOP failed"
+ # release the lease lock, lpurge is running in background, the lease
+ # lock could be broke by it, this also applies to mirror resync
+ kill -USR1 $pid && wait $pid
- $LFS mirror resync $tf || error "cannot resync mirror"
+ $LFS mirror resync $tf
sleep $((LPURGE_INTV * 2))
if (size != sizeof(struct filter_fid) &&
size != sizeof(struct filter_fid_18_23) &&
size != sizeof(struct filter_fid_24_29) &&
- size != sizeof(struct filter_fid_210) && !printed) {
+ size != sizeof(struct filter_fid_210) &&
+ size != sizeof(struct filter_fid_215) && !printed) {
fprintf(stderr,
"%s: warning: ffid size is unexpected (%d bytes), recompile?\n",
argv[i], size);
(unsigned long long)
__le64_to_cpu(ol->ol_comp_end));
}
- if (size >= sizeof(struct filter_fid))
+ if (size >= sizeof(struct filter_fid_215))
printf(" layout_version=%u range=%u",
__le32_to_cpu(ff->ff_layout_version),
__le32_to_cpu(ff->ff_range));
+ if (size >= sizeof(struct filter_fid)) {
+ struct ost_layout_compr *olc = &ff->ff_layout_compr;
+
+ printf(" compress_type=%u compress_level=%u"
+ " compress_chunk_log_bits=%u",
+ olc->ol_compr_type, olc->ol_compr_lvl,
+ olc->ol_compr_chunk_log_bits);
+ }
printf("\n");
}