#define DEBUG_SUBSYSTEM S_LOV
+#include <asm/div64.h>
#include <libcfs/libcfs.h>
#include <obd_class.h>
-#include <obd_lov.h>
#include <lustre/lustre_idl.h>
#include "lod_internal.h"
int qos_add_tgt(struct lod_device *lod, struct lod_tgt_desc *ost_desc)
{
- struct lov_qos_oss *oss = NULL, *temposs;
+ struct lod_qos_oss *oss = NULL, *temposs;
struct obd_export *exp = ost_desc->ltd_exp;
int rc = 0, found = 0;
cfs_list_t *list;
int qos_del_tgt(struct lod_device *lod, struct lod_tgt_desc *ost_desc)
{
- struct lov_qos_oss *oss;
+ struct lod_qos_oss *oss;
int rc = 0;
ENTRY;
if (rc && rc != -ENOTCONN)
CERROR("%s: statfs: rc = %d\n", lod2obd(d)->obd_name, rc);
+ /* If the OST is readonly then we can't allocate objects there */
+ if (sfs->os_state & OS_STATE_READONLY)
+ rc = -EROFS;
+
/* check whether device has changed state (active, inactive) */
if (rc != 0 && ost->ltd_active) {
/* turned inactive? */
depends on size of each ost in an oss */
static int lod_qos_calc_ppo(struct lod_device *lod)
{
- struct lov_qos_oss *oss;
+ struct lod_qos_oss *oss;
__u64 ba_max, ba_min, temp;
__u32 num_active;
int rc, i, prio_wide;
/* per-OST penalty is prio * TGT_bavail / (num_ost - 1) / 2 */
temp >>= 1;
- lov_do_div64(temp, num_active);
+ do_div(temp, num_active);
OST_TGT(lod,i)->ltd_qos.ltq_penalty_per_obj =
(temp * prio_wide) >> 8;
/* Per-OSS penalty is prio * oss_avail / oss_osts / (num_oss - 1) / 2 */
cfs_list_for_each_entry(oss, &lod->lod_qos.lq_oss_list, lqo_oss_list) {
temp = oss->lqo_bavail >> 1;
- lov_do_div64(temp, oss->lqo_ost_count * num_active);
+ do_div(temp, oss->lqo_ost_count * num_active);
oss->lqo_penalty_per_obj = (temp * prio_wide) >> 8;
age = (now - oss->lqo_used) >> 3;
__u32 index, __u64 *total_wt)
{
struct lod_tgt_desc *ost;
- struct lov_qos_oss *oss;
+ struct lod_qos_oss *oss;
int j;
ENTRY;
#define LOV_QOS_EMPTY ((__u32)-1)
/* compute optimal round-robin order, based on OSTs per OSS */
static int lod_qos_calc_rr(struct lod_device *lod, struct ost_pool *src_pool,
- struct lov_qos_rr *lqr)
+ struct lod_qos_rr *lqr)
{
- struct lov_qos_oss *oss;
+ struct lod_qos_oss *oss;
struct lod_tgt_desc *ost;
unsigned placed, real_count;
int i, rc;
return (msfs->os_bavail < used);
}
-int lod_ea_store_resize(struct lod_thread_info *info, int size);
-
static inline int lod_qos_ost_in_use_clear(const struct lu_env *env, int stripes)
{
struct lod_thread_info *info = lod_env_info(env);
struct obd_statfs *sfs = &lod_env_info(env)->lti_osfs;
struct pool_desc *pool = NULL;
struct ost_pool *osts;
- struct lov_qos_rr *lqr;
+ struct lod_qos_rr *lqr;
struct dt_object *o;
unsigned array_idx;
int i, rc;
/*
* try to use another OSP if this one is degraded
*/
- if (sfs->os_state == OS_STATE_DEGRADED && speed < 2) {
+ if (sfs->os_state & OS_STATE_DEGRADED && speed < 2) {
QOS_DEBUG("#%d: degraded\n", ost_idx);
continue;
}
/* stripe count is based on whether OSD can handle larger EA sizes */
if (lod->lod_osd_max_easize > 0)
- max_stripes = lov_mds_md_stripecnt(lod->lod_osd_max_easize,
- magic);
+ max_stripes = lov_mds_md_max_stripe_count(
+ lod->lod_osd_max_easize, magic);
return (stripe_count < max_stripes) ? stripe_count : max_stripes;
}