Whamcloud - gitweb
Branch HEAD
authoradilger <adilger>
Fri, 27 Jun 2008 22:04:32 +0000 (22:04 +0000)
committeradilger <adilger>
Fri, 27 Jun 2008 22:04:32 +0000 (22:04 +0000)
Make this code the same as b1_6 (mostly whitespace removal and comment updates)
for ease of comparison.  The only remaining difference is the optimization to
skip getting lq_rw_sem if we are using RR allocation.

lustre/lov/lov_qos.c

index f3b9040..33a2d90 100644 (file)
 #include <obd_lov.h>
 #include "lov_internal.h"
 
-/* #define QOS_DEBUG 1  */
+/* #define QOS_DEBUG 1 */
 #define D_QOS D_OTHER
 
-#define TGT_BAVAIL(i) (lov->lov_tgts[i]->ltd_exp->exp_obd->obd_osfs.os_bavail * \
-                       lov->lov_tgts[i]->ltd_exp->exp_obd->obd_osfs.os_bsize) 
+#define TGT_BAVAIL(i) (lov->lov_tgts[i]->ltd_exp->exp_obd->obd_osfs.os_bavail *\
+                       lov->lov_tgts[i]->ltd_exp->exp_obd->obd_osfs.os_bsize)
 #define TGT_FFREE(i)  (lov->lov_tgts[i]->ltd_exp->exp_obd->obd_osfs.os_ffree)
 
 
@@ -54,7 +54,7 @@ int qos_add_tgt(struct obd_device *obd, __u32 index)
         ENTRY;
 
         /* We only need this QOS struct on MDT, not clients - but we may not
-           have registered the LOV's observer yet, so there's no way to know */
+         * have registered the LOV's observer yet, so there's no way to know */
         if (!exp || !exp->exp_connection) {
                 CERROR("Missing connection\n");
                 RETURN(-ENOTCONN);
@@ -63,7 +63,7 @@ int qos_add_tgt(struct obd_device *obd, __u32 index)
         down_write(&lov->lov_qos.lq_rw_sem);
         mutex_down(&lov->lov_lock);
         list_for_each_entry(oss, &lov->lov_qos.lq_oss_list, lqo_oss_list) {
-                if (obd_uuid_equals(&oss->lqo_uuid, 
+                if (obd_uuid_equals(&oss->lqo_uuid,
                                     &exp->exp_connection->c_remote_uuid)) {
                         found++;
                         break;
@@ -72,7 +72,7 @@ int qos_add_tgt(struct obd_device *obd, __u32 index)
 
         if (!found) {
                 OBD_ALLOC_PTR(oss);
-                if (!oss) 
+                if (!oss)
                         GOTO(out, rc = -ENOMEM);
                 memcpy(&oss->lqo_uuid,
                        &exp->exp_connection->c_remote_uuid,
@@ -81,14 +81,14 @@ int qos_add_tgt(struct obd_device *obd, __u32 index)
                 /* Assume we have to move this one */
                 list_del(&oss->lqo_oss_list);
         }
-                        
+
         oss->lqo_ost_count++;
         lov->lov_tgts[index]->ltd_qos.ltq_oss = oss;
 
         /* Add sorted by # of OSTs.  Find the first entry that we're
            bigger than... */
         list_for_each_entry(temposs, &lov->lov_qos.lq_oss_list, lqo_oss_list) {
-                if (oss->lqo_ost_count > temposs->lqo_ost_count) 
+                if (oss->lqo_ost_count > temposs->lqo_ost_count)
                         break;
         }
         /* ...and add before it.  If we're the first or smallest, temposs
@@ -98,7 +98,7 @@ int qos_add_tgt(struct obd_device *obd, __u32 index)
         lov->lov_qos.lq_dirty = 1;
         lov->lov_qos.lq_dirty_rr = 1;
 
-        CDEBUG(D_QOS, "add tgt %s to OSS %s (%d OSTs)\n", 
+        CDEBUG(D_QOS, "add tgt %s to OSS %s (%d OSTs)\n",
                obd_uuid2str(&lov->lov_tgts[index]->ltd_uuid),
                obd_uuid2str(&oss->lqo_uuid),
                oss->lqo_ost_count);
@@ -127,12 +127,12 @@ int qos_del_tgt(struct obd_device *obd, __u32 index)
 
         oss->lqo_ost_count--;
         if (oss->lqo_ost_count == 0) {
-                CDEBUG(D_QOS, "removing OSS %s\n", 
+                CDEBUG(D_QOS, "removing OSS %s\n",
                        obd_uuid2str(&oss->lqo_uuid));
                 list_del(&oss->lqo_oss_list);
                 OBD_FREE_PTR(oss);
         }
-        
+
         lov->lov_qos.lq_dirty = 1;
         lov->lov_qos.lq_dirty_rr = 1;
 out:
@@ -140,8 +140,8 @@ out:
         RETURN(rc);
 }
 
-/* Recalculate per-object penalties for OSSs and OSTs, 
-   depends on size of each ost in an oss */  
+/* Recalculate per-object penalties for OSSs and OSTs,
+   depends on size of each ost in an oss */
 static int qos_calc_ppo(struct obd_device *obd)
 {
         struct lov_obd *lov = &obd->u.lov;
@@ -151,10 +151,10 @@ static int qos_calc_ppo(struct obd_device *obd)
         int rc, i, prio_wide;
         ENTRY;
 
-        if (!lov->lov_qos.lq_dirty) 
+        if (!lov->lov_qos.lq_dirty)
                 GOTO(out, rc = 0);
 
-        num_active = lov->desc.ld_active_tgt_count - 1; 
+        num_active = lov->desc.ld_active_tgt_count - 1;
         if (num_active < 1)
                 GOTO(out, rc = -EAGAIN);
 
@@ -181,7 +181,7 @@ static int qos_calc_ppo(struct obd_device *obd)
                         continue;
                 ba_min = min(temp, ba_min);
                 ba_max = max(temp, ba_max);
-                
+
                 /* Count the number of usable OSS's */
                 if (lov->lov_tgts[i]->ltd_qos.ltq_oss->lqo_bavail == 0)
                         lov->lov_qos.lq_active_oss_count++;
@@ -190,10 +190,10 @@ static int qos_calc_ppo(struct obd_device *obd)
                 /* per-OST penalty is prio * TGT_bavail / (num_ost - 1) / 2 */
                 temp >>= 1;
                 do_div(temp, num_active);
-                lov->lov_tgts[i]->ltd_qos.ltq_penalty_per_obj = 
+                lov->lov_tgts[i]->ltd_qos.ltq_penalty_per_obj =
                         (temp * prio_wide) >> 8;
 
-                if (lov->lov_qos.lq_reset == 0) 
+                if (lov->lov_qos.lq_reset == 0)
                         lov->lov_tgts[i]->ltd_qos.ltq_penalty = 0;
         }
 
@@ -202,32 +202,32 @@ static int qos_calc_ppo(struct obd_device *obd)
                 /* If there's only 1 OSS, we can't penalize it, so instead
                    we have to double the OST penalty */
                 num_active = 1;
-                for (i = 0; i < lov->desc.ld_tgt_count; i++) { 
+                for (i = 0; i < lov->desc.ld_tgt_count; i++) {
                         if (lov->lov_tgts[i] == NULL)
                                 continue;
                         lov->lov_tgts[i]->ltd_qos.ltq_penalty_per_obj <<= 1;
                 }
         }
-        
+
         /* Per-OSS penalty is prio * oss_avail / oss_osts / (num_oss - 1) / 2 */
         list_for_each_entry(oss, &lov->lov_qos.lq_oss_list, lqo_oss_list) {
                 temp = oss->lqo_bavail >> 1;
                 do_div(temp, oss->lqo_ost_count * num_active);
                 oss->lqo_penalty_per_obj = (temp * prio_wide) >> 8;
-                if (lov->lov_qos.lq_reset == 0) 
+                if (lov->lov_qos.lq_reset == 0)
                         oss->lqo_penalty = 0;
         }
 
         lov->lov_qos.lq_dirty = 0;
         lov->lov_qos.lq_reset = 0;
 
-        /* If each ost has almost same free space, 
+        /* If each ost has almost same free space,
          * do rr allocation for better creation performance */
         lov->lov_qos.lq_same_space = 0;
         temp = ba_max - ba_min;
-        ba_min = (ba_min * 51) >> 8;     /* 51/256 = .20 */  
+        ba_min = (ba_min * 51) >> 8;     /* 51/256 = .20 */
         if (temp < ba_min) {
-                /* Difference is less than 20% */ 
+                /* Difference is less than 20% */
                 lov->lov_qos.lq_same_space = 1;
                 /* Reset weights for the next time we enter qos mode */
                 lov->lov_qos.lq_reset = 0;
@@ -246,9 +246,9 @@ static int qos_calc_weight(struct lov_obd *lov, int i)
 
         /* Final ost weight = TGT_BAVAIL - ost_penalty - oss_penalty */
         temp = TGT_BAVAIL(i);
-        temp2 = lov->lov_tgts[i]->ltd_qos.ltq_penalty + 
+        temp2 = lov->lov_tgts[i]->ltd_qos.ltq_penalty +
                 lov->lov_tgts[i]->ltd_qos.ltq_oss->lqo_penalty;
-        if (temp < temp2) 
+        if (temp < temp2)
                 lov->lov_tgts[i]->ltd_qos.ltq_weight = 0;
         else
                 lov->lov_tgts[i]->ltd_qos.ltq_weight = temp - temp2;
@@ -276,12 +276,12 @@ static int qos_used(struct lov_obd *lov, __u32 index, __u64 *total_wt)
         lov->lov_tgts[index]->ltd_qos.ltq_penalty +=
                 lov->lov_tgts[index]->ltd_qos.ltq_penalty_per_obj *
                 lov->desc.ld_active_tgt_count;
-        oss->lqo_penalty += oss->lqo_penalty_per_obj * 
+        oss->lqo_penalty += oss->lqo_penalty_per_obj *
                 lov->lov_qos.lq_active_oss_count;
 
         /* Decrease all OSS penalties */
         list_for_each_entry(oss, &lov->lov_qos.lq_oss_list, lqo_oss_list) {
-                if (oss->lqo_penalty < oss->lqo_penalty_per_obj) 
+                if (oss->lqo_penalty < oss->lqo_penalty_per_obj)
                         oss->lqo_penalty = 0;
                 else
                         oss->lqo_penalty -= oss->lqo_penalty_per_obj;
@@ -290,7 +290,7 @@ static int qos_used(struct lov_obd *lov, __u32 index, __u64 *total_wt)
         *total_wt = 0;
         /* Decrease all OST penalties */
         for (i = 0; i < lov->desc.ld_tgt_count; i++) {
-                if (!lov->lov_tgts[i] || !lov->lov_tgts[i]->ltd_active) 
+                if (!lov->lov_tgts[i] || !lov->lov_tgts[i]->ltd_active)
                         continue;
                 if (lov->lov_tgts[i]->ltd_qos.ltq_penalty <
                     lov->lov_tgts[i]->ltd_qos.ltq_penalty_per_obj)
@@ -298,7 +298,7 @@ static int qos_used(struct lov_obd *lov, __u32 index, __u64 *total_wt)
                 else
                         lov->lov_tgts[i]->ltd_qos.ltq_penalty -=
                         lov->lov_tgts[i]->ltd_qos.ltq_penalty_per_obj;
-                
+
                 qos_calc_weight(lov, i);
 
                 /* Recalc the total weight of usable osts */
@@ -309,10 +309,10 @@ static int qos_used(struct lov_obd *lov, __u32 index, __u64 *total_wt)
                 CDEBUG(D_QOS, "recalc tgt %d avail="LPU64
                        " ostppo="LPU64" ostp="LPU64" ossppo="LPU64
                        " ossp="LPU64" wt="LPU64"\n",
-                       i, TGT_BAVAIL(i) >> 10, 
+                       i, TGT_BAVAIL(i) >> 10,
                        lov->lov_tgts[i]->ltd_qos.ltq_penalty_per_obj >> 10,
-                       lov->lov_tgts[i]->ltd_qos.ltq_penalty >> 10, 
-                       lov->lov_tgts[i]->ltd_qos.ltq_oss->lqo_penalty_per_obj >> 10,
+                       lov->lov_tgts[i]->ltd_qos.ltq_penalty >> 10,
+                       lov->lov_tgts[i]->ltd_qos.ltq_oss->lqo_penalty_per_obj>>10,
                        lov->lov_tgts[i]->ltd_qos.ltq_oss->lqo_penalty >> 10,
                        lov->lov_tgts[i]->ltd_qos.ltq_weight >> 10);
 #endif
@@ -335,7 +335,7 @@ static int qos_calc_rr(struct lov_obd *lov)
                 RETURN(0);
         }
 
-        /* Do actuall allocation. */
+        /* Do actual allocation. */
         down_write(&lov->lov_qos.lq_rw_sem);
 
         /*
@@ -350,9 +350,9 @@ static int qos_calc_rr(struct lov_obd *lov)
 
         ost_count = lov->desc.ld_tgt_count;
 
-        if (lov->lov_qos.lq_rr_size) 
+        if (lov->lov_qos.lq_rr_size)
                 OBD_FREE(lov->lov_qos.lq_rr_array, lov->lov_qos.lq_rr_size);
-        lov->lov_qos.lq_rr_size = ost_count * 
+        lov->lov_qos.lq_rr_size = ost_count *
                 sizeof(lov->lov_qos.lq_rr_array[0]);
         OBD_ALLOC(lov->lov_qos.lq_rr_array, lov->lov_qos.lq_rr_size);
         if (!lov->lov_qos.lq_rr_array) {
@@ -373,8 +373,8 @@ static int qos_calc_rr(struct lov_obd *lov)
         list_for_each_entry(oss, &lov->lov_qos.lq_oss_list, lqo_oss_list) {
                 int j = 0;
                 for (i = 0; i < ost_count; i++) {
-                        if(lov->lov_tgts[i] &&
-                           lov->lov_tgts[i]->ltd_qos.ltq_oss == oss) {
+                        if (lov->lov_tgts[i] &&
+                            lov->lov_tgts[i]->ltd_qos.ltq_oss == oss) {
                               /* Evenly space these OSTs across arrayspace */
                               int next = j * ost_count / oss->lqo_ost_count;
                               LASSERT(next < ost_count);
@@ -411,7 +411,7 @@ static int qos_calc_rr(struct lov_obd *lov)
                          lov->lov_qos.lq_rr_array[i]);
         }
 #endif
-        
+
         RETURN(0);
 }
 
@@ -438,7 +438,7 @@ void qos_shrink_lsm(struct lov_request_set *set)
                 }
         }
 
-        CWARN("using fewer stripes for object "LPX64": old %u new %u\n",
+        CWARN("using fewer stripes for object "LPU64": old %u new %u\n",
               lsm->lsm_object_id, lsm->lsm_stripe_count, set->set_count);
         LASSERT(lsm->lsm_stripe_count >= set->set_count);
 
@@ -474,8 +474,8 @@ int qos_remedy_create(struct lov_request_set *set, struct lov_request *req)
 
         ost_idx = (req->rq_idx + lsm->lsm_stripe_count) % ost_count;
         for (i = 0; i < ost_count; i++, ost_idx = (ost_idx + 1) % ost_count) {
-                if (!lov->lov_tgts[ost_idx] || 
-                    !lov->lov_tgts[ost_idx]->ltd_active) 
+                if (!lov->lov_tgts[ost_idx] ||
+                    !lov->lov_tgts[ost_idx]->ltd_active)
                         continue;
                 /* check if objects has been created on this ost */
                 for (stripe = 0; stripe < lsm->lsm_stripe_count; stripe++) {
@@ -530,7 +530,8 @@ static int alloc_rr(struct lov_obd *lov, int *idx_arr, int *stripe_cnt,
         } else if (stripe_cnt_min >= ost_active_count ||
                    lov->lov_start_idx > ost_count) {
                 /* If we have allocated from all of the OSTs, slowly
-                   precess the next start */
+                 * precess the next start if the OST/stripe count isn't
+                 * already doing this for us. */
                 lov->lov_start_idx %= ost_count;
                 if (*stripe_cnt > 1 && (ost_active_count % (*stripe_cnt)) != 1)
                         ++lov->lov_offset_idx;
@@ -542,9 +543,10 @@ repeat_find:
         array_idx = (lov->lov_start_idx + lov->lov_offset_idx) % ost_count;
         idx_pos = idx_arr;
 #ifdef QOS_DEBUG
-        CDEBUG(D_QOS, "want %d startidx %d startcnt %d offset %d arrayidx %d\n",
-               stripe_cnt_min, lov->lov_start_idx, lov->lov_start_count,
-               lov->lov_offset_idx, array_idx);
+        CDEBUG(D_QOS, "want %d startidx %d startcnt %d offset %d active %d "
+               "count %d arrayidx %d\n",
+               stripe_cnt, lov->lov_start_idx, lov->lov_start_count,
+               lov->lov_offset_idx, ost_active_count, ost_count, array_idx);
 #endif
 
         for (i = 0; i < ost_count; i++, array_idx=(array_idx + 1) % ost_count) {
@@ -560,6 +562,7 @@ repeat_find:
                 if ((ost_idx == LOV_QOS_EMPTY) || !lov->lov_tgts[ost_idx] ||
                     !lov->lov_tgts[ost_idx]->ltd_active)
                         continue;
+
                 /* Fail Check before osc_precreate() is called
                    so we can only 'fail' single OSC. */
                 if (OBD_FAIL_CHECK(OBD_FAIL_MDS_OSC_PRECREATE) && ost_idx == 0)
@@ -598,10 +601,10 @@ static int alloc_specific(struct lov_obd *lov, struct lov_stripe_md *lsm,
         ENTRY;
 
 repeat_find:
-        idx_pos = idx_arr;
         ost_idx = lsm->lsm_oinfo[0]->loi_ost_idx;
+        idx_pos = idx_arr;
         for (i = 0; i < ost_count; i++, ost_idx = (ost_idx + 1) % ost_count) {
-                if (!lov->lov_tgts[ost_idx] || 
+                if (!lov->lov_tgts[ost_idx] ||
                     !lov->lov_tgts[ost_idx]->ltd_active) {
                         continue;
                 }
@@ -611,7 +614,7 @@ repeat_find:
                 if (OBD_FAIL_CHECK(OBD_FAIL_MDS_OSC_PRECREATE) && ost_idx == 0)
                         continue;
 
-                /* Drop slow OSCs if we can */
+                /* Drop slow OSCs if we can, but not for requested start idx */
                 if ((obd_precreate(lov->lov_tgts[ost_idx]->ltd_exp) > speed) &&
                     (i != 0 || speed < 2))
                         continue;
@@ -657,33 +660,32 @@ static int alloc_qos(struct obd_export *exp, int *idx_arr, int *stripe_cnt,
         ENTRY;
 
         if (stripe_cnt_min < 1)
-                GOTO(out, rc = -EINVAL);
+                GOTO(out_nolock, rc = -EINVAL);
 
         lov_getref(exp->exp_obd);
 
         /* Detect -EAGAIN early, before expensive lock is taken. */
         if (!lov->lov_qos.lq_dirty && lov->lov_qos.lq_same_space)
-                GOTO(out, rc = -EAGAIN);
-        
-        /* Do actuall allocation, use write lock here. */
+                GOTO(out_nolock, rc = -EAGAIN);
+
+        /* Do actual allocation, use write lock here. */
         down_write(&lov->lov_qos.lq_rw_sem);
 
-        /* 
+        /*
          * Check again, while we were sleeping on @lq_rw_sem things could
          * change.
          */
-        if (!lov->lov_qos.lq_dirty && lov->lov_qos.lq_same_space) {
-                up_write(&lov->lov_qos.lq_rw_sem);
+        if (!lov->lov_qos.lq_dirty && lov->lov_qos.lq_same_space)
                 GOTO(out, rc = -EAGAIN);
-        }
+
         ost_count = lov->desc.ld_tgt_count;
 
-        if (lov->desc.ld_active_tgt_count < 2) 
-                GOTO(out_up_write, rc = -EAGAIN);
+        if (lov->desc.ld_active_tgt_count < 2)
+                GOTO(out, rc = -EAGAIN);
 
         rc = qos_calc_ppo(exp->exp_obd);
         if (rc)
-                GOTO(out_up_write, rc);
+                GOTO(out, rc);
 
         total_bavail = 0;
         good_osts = 0;
@@ -699,16 +701,16 @@ static int alloc_qos(struct obd_export *exp, int *idx_arr, int *stripe_cnt,
                 bavail = TGT_BAVAIL(i);
                 if (!bavail) {
                         if (warn) {
-                                CDEBUG(D_QOS, "no free space on %s\n", 
-                                       obd_uuid2str(&lov->lov_tgts[i]->ltd_uuid));
+                                CDEBUG(D_QOS, "no free space on %s\n",
+                                     obd_uuid2str(&lov->lov_tgts[i]->ltd_uuid));
                                 last_warn = now;
                         }
                         continue;
                 }
                 if (!TGT_FFREE(i)) {
                         if (warn) {
-                                CDEBUG(D_QOS, "no free inodes on %s\n", 
-                                       obd_uuid2str(&lov->lov_tgts[i]->ltd_uuid));
+                                CDEBUG(D_QOS, "no free inodes on %s\n",
+                                     obd_uuid2str(&lov->lov_tgts[i]->ltd_uuid));
                                 last_warn = now;
                         }
                         continue;
@@ -731,23 +733,24 @@ static int alloc_qos(struct obd_export *exp, int *idx_arr, int *stripe_cnt,
         }
 
         if (good_osts < stripe_cnt_min)
-                GOTO(out_up_write, rc = -EAGAIN);
+                GOTO(out, rc = -EAGAIN);
 
         if (!total_bavail)
-                GOTO(out_up_write, rc = -ENOSPC);
+                GOTO(out, rc = -ENOSPC);
 
         /* We have enough osts */
         if (good_osts < *stripe_cnt)
                 *stripe_cnt = good_osts;
 
         if (!*stripe_cnt)
-                GOTO(out_up_write, rc = -EAGAIN);
+                GOTO(out, rc = -EAGAIN);
 
         /* Find enough OSTs with weighted random allocation. */
         nfound = 0;
         while (nfound < *stripe_cnt) {
-                __u64 rand, cur_weight = 0;
+                __u64 rand, cur_weight;
 
+                cur_weight = 0;
                 rc = -ENODEV;
 
                 if (total_weight) {
@@ -766,6 +769,7 @@ static int alloc_qos(struct obd_export *exp, int *idx_arr, int *stripe_cnt,
                                 rand |= ll_rand() % (unsigned)total_weight;
                         else
                                 rand |= ll_rand();
+
 #else
                         rand = ((__u64)ll_rand() << 32 | ll_rand()) %
                                 total_weight;
@@ -800,20 +804,20 @@ static int alloc_qos(struct obd_export *exp, int *idx_arr, int *stripe_cnt,
                 }
         }
         LASSERT(nfound == *stripe_cnt);
-        
-out_up_write:
-        up_write(&lov->lov_qos.lq_rw_sem);
-        
+
 out:
+        up_write(&lov->lov_qos.lq_rw_sem);
+
+out_nolock:
         if (rc == -EAGAIN)
                 rc = alloc_rr(lov, idx_arr, stripe_cnt, flags);
-        
+
         lov_putref(exp->exp_obd);
         RETURN(rc);
 }
 
 /* return new alloced stripe count on success */
-static int alloc_idx_array(struct obd_export *exp, struct lov_stripe_md *lsm, 
+static int alloc_idx_array(struct obd_export *exp, struct lov_stripe_md *lsm,
                            int newea, int **idx_arr, int *arr_cnt, int flags)
 {
         struct lov_obd *lov = &exp->exp_obd->u.lov;
@@ -829,8 +833,8 @@ static int alloc_idx_array(struct obd_export *exp, struct lov_stripe_md *lsm,
         for (i = 0; i < *arr_cnt; i++)
                 tmp_arr[i] = -1;
 
-        if (newea || 
-            lsm->lsm_oinfo[0]->loi_ost_idx >= lov->desc.ld_tgt_count) 
+        if (newea ||
+            lsm->lsm_oinfo[0]->loi_ost_idx >= lov->desc.ld_tgt_count)
                 rc = alloc_qos(exp, tmp_arr, &stripe_cnt, flags);
         else
                 rc = alloc_specific(lov, lsm, tmp_arr);
@@ -859,8 +863,8 @@ int qos_prep_create(struct obd_export *exp, struct lov_request_set *set)
         struct obdo *src_oa = set->set_oi->oi_oa;
         struct obd_trans_info *oti = set->set_oti;
         int i, stripes, rc = 0, newea = 0;
-        int *idx_arr = NULL, idx_cnt = 0;
         int flag = LOV_USES_ASSIGNED_STRIPE;
+        int *idx_arr = NULL, idx_cnt = 0;
         ENTRY;
 
         LASSERT(src_oa->o_valid & OBD_MD_FLID);
@@ -870,17 +874,17 @@ int qos_prep_create(struct obd_export *exp, struct lov_request_set *set)
                 int stripes_def = lov_get_stripecnt(lov, 0);
 
                 /* If the MDS file was truncated up to some size, stripe over
-                 * enough OSTs to allow the file to be created at that size. 
+                 * enough OSTs to allow the file to be created at that size.
                  * This may mean we use more than the default # of stripes. */
                 if (src_oa->o_valid & OBD_MD_FLSIZE) {
                         obd_size min_bavail = LUSTRE_STRIPE_MAXBYTES;
-                        
-                        /* Find a small number of stripes we can use 
+
+                        /* Find a small number of stripes we can use
                            (up to # of active osts). */
                         stripes = 1;
                         lov_getref(exp->exp_obd);
                         for (i = 0; i < lov->desc.ld_tgt_count; i++) {
-                                if (!lov->lov_tgts[i] || 
+                                if (!lov->lov_tgts[i] ||
                                     !lov->lov_tgts[i]->ltd_active)
                                         continue;
                                 min_bavail = min(min_bavail, TGT_BAVAIL(i));
@@ -897,7 +901,7 @@ int qos_prep_create(struct obd_export *exp, struct lov_request_set *set)
                          stripes = stripes_def;
                 }
 
-                rc = lov_alloc_memmd(&set->set_oi->oi_md, stripes, 
+                rc = lov_alloc_memmd(&set->set_oi->oi_md, stripes,
                                      lov->desc.ld_pattern ?
                                      lov->desc.ld_pattern : LOV_PATTERN_RAID0,
                                      LOV_MAGIC);
@@ -923,7 +927,7 @@ int qos_prep_create(struct obd_export *exp, struct lov_request_set *set)
                 GOTO(out_err, rc = stripes ? stripes : -EIO);
         LASSERTF(stripes <= lsm->lsm_stripe_count,"requested %d allocated %d\n",
                  lsm->lsm_stripe_count, stripes);
-        
+
         for (i = 0; i < stripes; i++) {
                 struct lov_request *req;
                 int ost_idx = idx_arr[i];
@@ -953,7 +957,7 @@ int qos_prep_create(struct obd_export *exp, struct lov_request_set *set)
                  *     stripe which holds the existing file size.
                  */
                 if (src_oa->o_valid & OBD_MD_FLSIZE) {
-                        req->rq_oi.oi_oa->o_size = 
+                        req->rq_oi.oi_oa->o_size =
                                 lov_size_to_stripe(lsm, src_oa->o_size, i);
 
                         CDEBUG(D_INODE, "stripe %d has size "LPU64"/"LPU64"\n",