*/
/*
* This file is part of Lustre, http://www.lustre.org/
- * Lustre is a trademark of Sun Microsystems, Inc.
*
* lustre/lod/lod_internal.h
*
struct rcu_head pool_rcu;
struct proc_dir_entry *pool_proc_entry;
struct obd_device *pool_lobd; /* owner */
+ time64_t pool_spill_expire;
+ struct proc_dir_entry *pool_spill_proc_entry;
+ bool pool_spill_is_active;
+ unsigned int pool_spill_threshold_pct;
+ atomic_t pool_spill_hit;
+ char pool_spill_target[LOV_MAXPOOLNAME + 1];
+ bool pool_same_space; /* targets in pool balanced*/
+ time64_t pool_same_space_expire; /*uses ld_qos_maxage*/
};
+struct lod_device;
int lod_pool_hash_init(struct rhashtable *tbl);
void lod_pool_hash_destroy(struct rhashtable *tbl);
+bool lod_pool_exists(struct lod_device *lod, char *poolname);
#define pool_tgt_count(p) ((p)->pool_obds.op_count)
#define pool_tgt_array(p) ((p)->pool_obds.op_array)
/* number of allocated array items */
unsigned int lag_oaa_size;
/* bitmap of OSTs avoid guidance */
- struct cfs_bitmap *lag_ost_avoid_bitmap;
+ unsigned long *lag_ost_avoid_bitmap;
+ u32 lag_ost_avoid_size;
/* how many OSTs are available for alloc */
__u32 lag_ost_avail;
};
struct rhashtable lod_pools_hash_body; /* used for key access */
struct list_head lod_pool_list; /* used for sequential access */
struct proc_dir_entry *lod_pool_proc_entry;
+ struct proc_dir_entry *lod_spill_proc_entry;
enum lustre_sec_part lod_sp_me;
/* ROOT object, used to fetch FS default striping */
struct lod_object *lod_md_root;
+
+ /* max stripe count if stripe count is set to -1. 0 means unlimited */
+ unsigned int lod_max_stripecount;
+ unsigned int lod_max_mdt_stripecount;
};
#define lod_ost_bitmap lod_ost_descs.ltd_tgt_bitmap
#define lod_ost_count lod_ost_descs.ltd_lov_desc.ld_tgt_count
+#define lod_ost_active_count lod_ost_descs.ltd_lov_desc.ld_active_tgt_count
#define lod_remote_mdt_count lod_mdt_descs.ltd_lmv_desc.ld_tgt_count
struct lod_layout_component {
__u32 lds_dir_def_stripe_count;
__u32 lds_dir_def_stripe_offset;
__u32 lds_dir_def_hash_type;
+ __u8 lds_dir_def_max_inherit;
+ __u8 lds_dir_def_max_inherit_rr;
/* default file striping flags (LOV) */
__u32 lds_def_striping_set:1,
lds_def_striping_is_composite:1,
lds_dir_def_striping_set:1;
};
+enum layout_verify_flags {
+ LVF_ALL_STALE = BIT(0), /* check not all stale mirrors */
+};
+
struct lod_mirror_entry {
__u16 lme_stale:1,
- lme_primary:1;
+ lme_prefer:1;
/* mirror id */
__u16 lme_id;
+ /* preference */
+ __u16 lme_preference;
/* start,end index of this mirror in ldo_comp_entries */
__u16 lme_start;
__u16 lme_end;
/* common fields for both files and directories */
struct dt_object ldo_obj;
struct mutex ldo_layout_mutex;
+ /* foreign file/directory */
+ __u32 ldo_is_foreign:1;
union {
/* file stripe (LOV) */
struct {
__u16 ldo_mirror_count;
struct lod_mirror_entry *ldo_mirrors;
__u32 ldo_is_composite:1,
- ldo_flr_state:2,
- ldo_comp_cached:1,
- ldo_is_foreign:1;
+ ldo_flr_state:4,
+ ldo_comp_cached:1;
};
/* directory stripe (LMV) */
struct {
__u32 ldo_dir_slave_stripe:1,
ldo_dir_striped:1,
/* the stripe has been loaded */
- ldo_dir_stripe_loaded:1,
- /* foreign directory */
- ldo_dir_is_foreign;
+ ldo_dir_stripe_loaded:1;
/*
* This default LMV is parent default LMV, which will be
* used in child creation, and it's not cached, so this
return 0;
}
-static inline int lod_set_def_pool(struct lod_default_striping *lds,
- int i, const char *new_pool)
-{
- return lod_set_pool(&lds->lds_def_comp_entries[i].llc_pool, new_pool);
-}
-
static inline int lod_obj_set_pool(struct lod_object *lo, int i,
const char *new_pool)
{
/* object allocation avoid guide info */
struct lod_avoid_guide lti_avoid;
union lmv_mds_md lti_lmv;
+ struct dt_allocation_hint lti_ah;
};
extern const struct lu_device_operations lod_lu_ops;
{
struct lod_object *lo = lod_dt_obj(dt);
int i;
+ bool rc = false;
if (!dt_object_exists(dt_object_child(dt)))
return false;
- if (S_ISDIR(dt->do_lu.lo_header->loh_attr))
- return lo->ldo_dir_stripe_count != 0;
-
- if (lo->ldo_is_foreign)
- return false;
-
- for (i = 0; i < lo->ldo_comp_cnt; i++) {
- if (lo->ldo_comp_entries[i].llc_stripe == NULL)
- continue;
- LASSERT(lo->ldo_comp_entries[i].llc_stripe_count > 0);
- return true;
+ mutex_lock(&lo->ldo_layout_mutex);
+
+ if (S_ISDIR(dt->do_lu.lo_header->loh_attr)) {
+ rc = lo->ldo_dir_stripe_count != 0;
+ } else if (lo->ldo_is_foreign) {
+ rc = false;
+ } else {
+ for (i = 0; i < lo->ldo_comp_cnt; i++) {
+ if (lo->ldo_comp_entries[i].llc_stripe == NULL)
+ continue;
+ LASSERT(lo->ldo_comp_entries[i].llc_stripe_count > 0);
+ rc = true;
+ break;
+ }
}
- return false;
+
+ mutex_unlock(&lo->ldo_layout_mutex);
+ return rc;
}
extern struct lu_context_key lod_thread_key;
int lod_del_device(const struct lu_env *env, struct lod_device *lod,
struct lod_tgt_descs *ltd, char *osp, unsigned int idx,
unsigned int gen);
+int validate_lod_and_idx(struct lod_device *lod, __u32 idx);
int lod_fini_tgt(const struct lu_env *env, struct lod_device *lod,
struct lod_tgt_descs *ltd);
int lod_striping_load(const struct lu_env *env, struct lod_object *lo);
int lod_striping_reload(const struct lu_env *env, struct lod_object *lo,
- const struct lu_buf *buf);
+ const struct lu_buf *buf, enum layout_verify_flags lvf);
void lod_dom_stripesize_recalc(struct lod_device *d);
int lod_get_ea(const struct lu_env *env, struct lod_object *lo,
int lod_pools_init(struct lod_device *m, struct lustre_cfg *cfg);
int lod_pools_fini(struct lod_device *m);
int lod_parse_striping(const struct lu_env *env, struct lod_object *mo,
- const struct lu_buf *buf);
+ const struct lu_buf *buf, enum layout_verify_flags lvf);
int lod_parse_dir_striping(const struct lu_env *env, struct lod_object *lo,
const struct lu_buf *buf);
int lod_initialize_objects(const struct lu_env *env, struct lod_object *mo,
struct lu_attr *attr, struct thandle *th,
int comp_idx, __u64 reserve);
__u16 lod_comp_entry_stripe_count(struct lod_object *lo,
- struct lod_layout_component *entry,
- bool is_dir);
+ int comp_idx, bool is_dir);
__u16 lod_get_stripe_count(struct lod_device *lod, struct lod_object *lo,
- __u16 stripe_count, bool overstriping);
+ int comp_idx, __u16 stripe_count, bool overstriping);
void lod_qos_statfs_update(const struct lu_env *env, struct lod_device *lod,
struct lu_tgt_descs *ltd);
void lod_procfs_fini(struct lod_device *lod);
/* lod_object.c */
-extern struct dt_object_operations lod_obj_ops;
-extern struct lu_object_operations lod_lu_obj_ops;
+extern const struct dt_object_operations lod_obj_ops;
+extern const struct lu_object_operations lod_lu_obj_ops;
int lod_load_lmv_shards(const struct lu_env *env, struct lod_object *lo,
struct lu_buf *buf, bool resize);
int lod_sub_prep_llog(const struct lu_env *env, struct lod_device *lod,
struct dt_device *dt, int index);
+void lod_check_and_spill_pool(const struct lu_env *env, struct lod_device *lod,
+ char **poolname);
+void lod_spill_target_refresh(const struct lu_env *env, struct lod_device *lod,
+ struct pool_desc *pool);
+struct pool_desc *lod_pool_find(struct lod_device *lod, char *poolname);
+extern struct lprocfs_vars lprocfs_lod_spill_vars[];
#endif