__u32 ldo_dir_hash_type;
/* Is a slave stripe of striped directory? */
__u32 ldo_dir_slave_stripe:1,
- ldo_dir_striped:1;
+ ldo_dir_striped:1,
+ /* the stripe has been loaded */
+ ldo_dir_stripe_loaded:1;
/*
* default striping is not cached, so this field is
* invalid after create, make sure it's used by
return true;
if (S_ISDIR(lod2lu_obj(lo)->lo_header->loh_attr)) {
- if (lo->ldo_stripe != NULL)
+ if (lo->ldo_stripe != NULL || lo->ldo_dir_stripe_loaded)
return true;
/* Never load LMV stripe for slaves of striped dir */
lo->ldo_comp_cached = 1;
} else if (S_ISDIR(lod2lu_obj(lo)->lo_header->loh_attr)) {
rc = lod_get_lmv_ea(env, lo);
- if (rc < (typeof(rc))sizeof(struct lmv_mds_md_v1))
+ if (rc < (typeof(rc))sizeof(struct lmv_mds_md_v1)) {
+ /* Let's set stripe_loaded to avoid further
+ * stripe loading especially for non-stripe directory,
+ * which can hurt performance. (See LU-9840)
+ */
+ if (rc == 0)
+ lo->ldo_dir_stripe_loaded = 1;
GOTO(out, rc = rc > 0 ? -EINVAL : rc);
-
+ }
buf->lb_buf = info->lti_ea_store;
buf->lb_len = info->lti_ea_store_size;
if (rc == sizeof(struct lmv_mds_md_v1)) {
* let's parse it and create in-core objects for the stripes
*/
rc = lod_parse_dir_striping(env, lo, buf);
+ if (rc == 0)
+ lo->ldo_dir_stripe_loaded = 1;
}
out:
RETURN(rc);
stripe[i] = dto;
}
+ lo->ldo_dir_stripe_loaded = 1;
lo->ldo_dir_striped = 1;
lo->ldo_stripe = stripe;
lo->ldo_dir_stripe_count = i;
OBD_FREE(lo->ldo_stripe, j);
lo->ldo_stripe = NULL;
lo->ldo_dir_stripes_allocated = 0;
+ lo->ldo_dir_stripe_loaded = 0;
lo->ldo_dir_stripe_count = 0;
} else if (lo->ldo_comp_entries != NULL) {
for (i = 0; i < lo->ldo_comp_cnt; i++) {