Whamcloud - gitweb
git://git.whamcloud.com
/
fs
/
lustre-release.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
| inline |
side by side
LU-9859 libcfs: move tgt_descs to standard Linux bitmaps.
[fs/lustre-release.git]
/
lustre
/
lod
/
lod_qos.c
diff --git
a/lustre/lod/lod_qos.c
b/lustre/lod/lod_qos.c
index
6d32975
..
7fe0826
100644
(file)
--- a/
lustre/lod/lod_qos.c
+++ b/
lustre/lod/lod_qos.c
@@
-65,17
+65,17
@@
static inline int lod_statfs_check(struct lu_tgt_descs *ltd,
{
struct obd_statfs *sfs = &tgt->ltd_statfs;
- if (((sfs->os_state & OS_STAT
E
_ENOSPC) ||
- (!ltd->ltd_is_mdt && sfs->os_state & OS_STAT
E
_ENOINO &&
+ if (((sfs->os_state & OS_STAT
FS
_ENOSPC) ||
+ (!ltd->ltd_is_mdt && sfs->os_state & OS_STAT
FS
_ENOINO &&
sfs->os_fprecreated == 0)))
return -ENOSPC;
/* If the OST is readonly then we can't allocate objects there */
- if (sfs->os_state & OS_STAT
E
_READONLY)
+ if (sfs->os_state & OS_STAT
FS
_READONLY)
return -EROFS;
/* object precreation is skipped on the OST with max_create_count=0 */
- if (!ltd->ltd_is_mdt && sfs->os_state & OS_STAT
E
_NOPRECREATE)
+ if (!ltd->ltd_is_mdt && sfs->os_state & OS_STAT
FS
_NOPRECREATE)
return -ENOBUFS;
return 0;
@@
-280,7
+280,7
@@
static int lod_qos_calc_rr(struct lod_device *lod, struct lu_tgt_descs *ltd,
deleting from the pool. The lq_rw_sem insures that nobody else
is reading. */
lqr->lqr_pool.op_count = real_count;
- rc =
lod_
tgt_pool_extend(&lqr->lqr_pool, real_count);
+ rc = tgt_pool_extend(&lqr->lqr_pool, real_count);
if (rc) {
up_write(<d->ltd_qos.lq_rw_sem);
RETURN(rc);
@@
-296,8
+296,8
@@
static int lod_qos_calc_rr(struct lod_device *lod, struct lu_tgt_descs *ltd,
for (i = 0; i < lqr->lqr_pool.op_count; i++) {
int next;
- if (!
cfs_bitmap_check(ltd->ltd_tgt_bitmap
,
-
src_pool->op_array[i]
))
+ if (!
test_bit(src_pool->op_array[i]
,
+
ltd->ltd_tgt_bitmap
))
continue;
tgt = LTD_TGT(ltd, src_pool->op_array[i]);
@@
-572,7
+572,7
@@
static inline bool lod_should_avoid_ost(struct lod_object *lo,
bool used = false;
int i;
- if (!
cfs_bitmap_check(lod->lod_ost_bitmap, index
)) {
+ if (!
test_bit(index, lod->lod_ost_bitmap
)) {
QOS_DEBUG("OST%d: been used in conflicting mirror component\n",
index);
return true;
@@
-642,7
+642,7
@@
static int lod_check_and_reserve_ost(const struct lu_env *env,
/*
* try to use another OSP if this one is degraded
*/
- if (ost->ltd_statfs.os_state & OS_STAT
E
_DEGRADED && speed < 2) {
+ if (ost->ltd_statfs.os_state & OS_STAT
FS
_DEGRADED && speed < 2) {
QOS_DEBUG("#%d: degraded\n", ost_idx);
RETURN(rc);
}
@@
-808,7
+808,7
@@
repeat_find:
stripe_idx, array_idx, ost_idx);
if ((ost_idx == LOV_QOS_EMPTY) ||
- !
cfs_bitmap_check(m->lod_ost_bitmap, ost_idx
))
+ !
test_bit(ost_idx, m->lod_ost_bitmap
))
continue;
/* Fail Check before osc_precreate() is called
@@
-890,7
+890,7
@@
lod_qos_mdt_in_use_init(const struct lu_env *env,
for (j = 0; j < pool->op_count; j++) {
mdt_idx = pool->op_array[j];
- if (!
cfs_bitmap_check(ltd->ltd_tgt_bitmap, mdt_idx
))
+ if (!
test_bit(mdt_idx, ltd->ltd_tgt_bitmap
))
continue;
mdt = LTD_TGT(ltd, mdt_idx);
@@
-993,7
+993,7
@@
repeat_find:
stripe_idx, pool_idx, mdt_idx);
if (mdt_idx == LOV_QOS_EMPTY ||
- !
cfs_bitmap_check(ltd->ltd_tgt_bitmap, mdt_idx
))
+ !
test_bit(mdt_idx, ltd->ltd_tgt_bitmap
))
continue;
/* do not put >1 objects on one MDT */
@@
-1008,14
+1008,14
@@
repeat_find:
}
/* try to use another OSP if this one is degraded */
- if (mdt->ltd_statfs.os_state & OS_STAT
E
_DEGRADED &&
+ if (mdt->ltd_statfs.os_state & OS_STAT
FS
_DEGRADED &&
!use_degraded) {
QOS_DEBUG("#%d: degraded\n", mdt_idx);
continue;
}
spin_unlock(&lqr->lqr_alloc);
- rc =
obd_fid_alloc(env, mdt->ltd_exp, &fid
, NULL);
+ rc =
dt_fid_alloc(env, mdt->ltd_tgt, &fid, NULL
, NULL);
if (rc < 0) {
QOS_DEBUG("#%d: alloc FID failed: %dl\n", mdt_idx, rc);
spin_lock(&lqr->lqr_alloc);
@@
-1132,7
+1132,7
@@
static int lod_alloc_ost_list(const struct lu_env *env, struct lod_object *lo,
i++, array_idx = (array_idx + 1) % lod_comp->llc_stripe_count) {
__u32 ost_idx = lod_comp->llc_ostlist.op_array[array_idx];
- if (!
cfs_bitmap_check(m->lod_ost_bitmap, ost_idx
)) {
+ if (!
test_bit(ost_idx, m->lod_ost_bitmap
)) {
rc = -ENODEV;
break;
}
@@
-1260,7
+1260,7
@@
repeat_find:
i++, array_idx = (array_idx + 1) % ost_count) {
ost_idx = osts->op_array[array_idx];
- if (!
cfs_bitmap_check(m->lod_ost_bitmap, ost_idx
))
+ if (!
test_bit(ost_idx, m->lod_ost_bitmap
))
continue;
/* Fail Check before osc_precreate() is called
@@
-1458,7
+1458,7
@@
static int lod_ost_alloc_qos(const struct lu_env *env, struct lod_object *lo,
good_osts = 0;
/* Find all the OSTs that are valid stripe candidates */
for (i = 0; i < osts->op_count; i++) {
- if (!
cfs_bitmap_check(lod->lod_ost_bitmap, osts->op_array[i]
))
+ if (!
test_bit(osts->op_array[i], lod->lod_ost_bitmap
))
continue;
ost = OST_TGT(lod, osts->op_array[i]);
@@
-1470,7
+1470,7
@@
static int lod_ost_alloc_qos(const struct lu_env *env, struct lod_object *lo,
continue;
}
- if (ost->ltd_statfs.os_state & OS_STAT
E
_DEGRADED)
+ if (ost->ltd_statfs.os_state & OS_STAT
FS
_DEGRADED)
continue;
/* Fail Check before osc_precreate() is called
@@
-1702,7
+1702,7
@@
int lod_mdt_alloc_qos(const struct lu_env *env, struct lod_object *lo,
good_mdts = 0;
/* Find all the MDTs that are valid stripe candidates */
for (i = 0; i < pool->op_count; i++) {
- if (!
cfs_bitmap_check(ltd->ltd_tgt_bitmap, pool->op_array[i]
))
+ if (!
test_bit(pool->op_array[i], ltd->ltd_tgt_bitmap
))
continue;
mdt = LTD_TGT(ltd, pool->op_array[i]);
@@
-1712,7
+1712,7
@@
int lod_mdt_alloc_qos(const struct lu_env *env, struct lod_object *lo,
if (rc)
continue;
- if (mdt->ltd_statfs.os_state & OS_STAT
E
_DEGRADED)
+ if (mdt->ltd_statfs.os_state & OS_STAT
FS
_DEGRADED)
continue;
mdt->ltd_qos.ltq_usable = 1;
@@
-1762,7
+1762,7
@@
int lod_mdt_alloc_qos(const struct lu_env *env, struct lod_object *lo,
if (lod_qos_is_tgt_used(env, mdt_idx, stripe_idx))
continue;
- rc2 =
obd_fid_alloc(env, mdt->ltd_exp, &fid
, NULL);
+ rc2 =
dt_fid_alloc(env, mdt->ltd_tgt, &fid, NULL
, NULL);
if (rc2 < 0) {
QOS_DEBUG("can't alloc FID on #%u: %d\n",
mdt_idx, rc2);
@@
-2102,7
+2102,7
@@
int lod_qos_parse_config(const struct lu_env *env, struct lod_object *lo,
else
lod_free_comp_entries(lo);
- rc = lod_verify_striping(d, lo, buf, false);
+ rc = lod_verify_striping(
env,
d, lo, buf, false);
if (rc)
RETURN(-EINVAL);
@@
-2306,8
+2306,7
@@
int lod_prepare_avoidance(const struct lu_env *env, struct lod_object *lo)
lag->lag_oaa_count = 0;
if (lag->lag_oss_avoid_array &&
lag->lag_oaa_size < lod->lod_ost_count) {
- OBD_FREE(lag->lag_oss_avoid_array,
- sizeof(__u32) * lag->lag_oaa_size);
+ OBD_FREE_PTR_ARRAY(lag->lag_oss_avoid_array, lag->lag_oaa_size);
lag->lag_oss_avoid_array = NULL;
lag->lag_oaa_size = 0;
}
@@
-2335,7
+2334,7
@@
int lod_prepare_avoidance(const struct lu_env *env, struct lod_object *lo)
* using OST count to allocate the array to store the OSS
* id.
*/
- OBD_ALLOC
(new_oss, sizeof(*new_oss) *
lod->lod_ost_count);
+ OBD_ALLOC
_PTR_ARRAY(new_oss,
lod->lod_ost_count);
if (!new_oss) {
CFS_FREE_BITMAP(bitmap);
return -ENOMEM;
@@
-2494,10
+2493,10
@@
int lod_qos_prep_create(const struct lu_env *env, struct lod_object *lo,
if (stripe_len == 0)
GOTO(out, rc = -ERANGE);
lod_comp->llc_stripe_count = stripe_len;
- OBD_ALLOC
(stripe, sizeof(stripe[0]) *
stripe_len);
+ OBD_ALLOC
_PTR_ARRAY(stripe,
stripe_len);
if (stripe == NULL)
GOTO(out, rc = -ENOMEM);
- OBD_ALLOC
(ost_indices, sizeof(*ost_indices) *
stripe_len);
+ OBD_ALLOC
_PTR_ARRAY(ost_indices,
stripe_len);
if (!ost_indices)
GOTO(out, rc = -ENOMEM);
@@
-2576,10
+2575,9
@@
put_ldts:
out:
if (rc < 0) {
if (stripe)
- OBD_FREE
(stripe, sizeof(stripe[0]) *
stripe_len);
+ OBD_FREE
_PTR_ARRAY(stripe,
stripe_len);
if (ost_indices)
- OBD_FREE(ost_indices,
- sizeof(*ost_indices) * stripe_len);
+ OBD_FREE_PTR_ARRAY(ost_indices, stripe_len);
}
RETURN(rc);
}