*/
bool hsd_housekeeping;
bool hsd_one_restore;
+ u32 hsd_start_cat_idx;
+ u32 hsd_start_rec_idx;
int hsd_action_count;
int hsd_request_len; /* array alloc len */
int hsd_request_count; /* array used count */
struct hsm_action_item *hai;
size_t hai_size;
u32 archive_id;
+ bool wrapped;
int i;
/* Are agents full? */
larr->arr_hdr.lrh_index);
}
+ wrapped = llh->lgh_hdr->llh_cat_idx >= llh->lgh_last_idx &&
+ llh->lgh_hdr->llh_count > 1;
+ if ((!wrapped && llh->lgh_hdr->llh_cat_idx > hsd->hsd_start_cat_idx) ||
+ (wrapped && llh->lgh_hdr->llh_cat_idx < hsd->hsd_start_cat_idx) ||
+ (llh->lgh_hdr->llh_cat_idx == hsd->hsd_start_cat_idx &&
+ larr->arr_hdr.lrh_index > hsd->hsd_start_rec_idx)) {
+ hsd->hsd_start_cat_idx = llh->lgh_hdr->llh_cat_idx;
+ hsd->hsd_start_rec_idx = larr->arr_hdr.lrh_index;
+ }
+
RETURN(0);
}
int update_idx = 0;
int updates_sz;
int updates_cnt;
+ u32 start_cat_idx;
+ u32 start_rec_idx;
struct hsm_record_update *updates;
/* Limit execution of the expensive requests traversal
ktime_get_real_seconds()) {
last_housekeeping = ktime_get_real_seconds();
hsd.hsd_housekeeping = true;
+ start_cat_idx = 0;
+ start_rec_idx = 0;
} else if (cdt->cdt_event) {
hsd.hsd_housekeeping = false;
+ start_cat_idx = hsd.hsd_start_cat_idx;
+ start_rec_idx = hsd.hsd_start_rec_idx;
} else {
continue;
}
hsd.hsd_one_restore = false;
rc = cdt_llog_process(mti->mti_env, mdt, mdt_coordinator_cb,
- &hsd, 0, 0, WRITE);
+ &hsd, start_cat_idx, start_rec_idx,
+ WRITE);
if (rc < 0)
goto clean_cb_alloc;
if (list_empty(&cdt->cdt_agents)) {
CDEBUG(D_HSM, "no agent available, "
"coordinator sleeps\n");
+ /* reset HSM scanning index range. */
+ hsd.hsd_start_cat_idx = start_cat_idx;
+ hsd.hsd_start_rec_idx = start_rec_idx;
goto clean_cb_alloc;
}
hai = hai_next(hai);
update_idx++;
}
+
+ /* TODO: narrow down the HSM action range that already
+ * scanned accroding to the cookies when a failure
+ * occurs.
+ */
+ if (rc) {
+ hsd.hsd_start_cat_idx = start_cat_idx;
+ hsd.hsd_start_rec_idx = start_rec_idx;
+ }
}
if (update_idx) {
}
run_test 40 "Parallel archive requests"
+hsm_archive_batch() {
+ local files_num=$1
+ local batch_max=$2
+ local filebase=$3
+ local batch_num=0
+ local fileset=""
+ local i=0
+
+ while [ $i -lt $files_num ]; do
+ if [ $batch_num -eq $batch_max ]; then
+ $LFS hsm_archive $fileset || error "HSM archive failed"
+ # Reset the batch container.
+ fileset=""
+ batch_num=0
+ fi
+
+ fileset+="${filebase}$i "
+ batch_num=$(( batch_num + 1 ))
+ i=$(( i + 1 ))
+ done
+
+ if [ $batch_num -ne 0 ]; then
+ $LFS hsm_archive $fileset || error "HSM archive failed"
+ fileset=""
+ batch_num=0
+ fi
+}
+
+test_50() {
+ local dir=$DIR/$tdir
+ local batch_max=50
+
+ set_hsm_param max_requests 1000000
+ mkdir $dir || error "mkdir $dir failed"
+ df -i $MOUNT
+
+ local start
+ local elapsed
+ local files_num
+ local filebase
+
+ files_num=10000
+ filebase="$dir/$tfile.start."
+ createmany -m $filebase $files_num ||
+ error "createmany -m $filebase failed: $?"
+
+ start=$SECONDS
+ hsm_archive_batch $files_num $batch_max "$filebase"
+ elapsed=$((SECONDS - start))
+ do_facet $SINGLEMDS "$LCTL get_param -n \
+ $HSM_PARAM.actions | grep WAITING | wc -l"
+ unlinkmany $filebase $files_num || error "unlinkmany $filabase failed"
+ echo "Start Phase files_num: $files_num time: $elapsed"
+
+ files_num=20000
+ filebase="$dir/$tfile.in."
+ createmany -m $filebase $files_num ||
+ error "createmany -m $filebase failed: $?"
+ start=$SECONDS
+ hsm_archive_batch $files_num $batch_max "$filebase"
+ elapsed=$((SECONDS - start))
+ unlinkmany $filebase $files_num || error "unlinkmany $filabase failed"
+ echo "Middle Phase files_num: $files_num time: $elapsed"
+
+ files_num=10000
+ filebase="$dir/$tfile.end."
+ createmany -m $filebase $files_num ||
+ error "createmany -m $filebase failed: $?"
+
+ start=$SECONDS
+ hsm_archive_batch $files_num $batch_max "$filebase"
+ elapsed=$((SECONDS - start))
+ do_facet $SINGLEMDS "$LCTL get_param -n \
+ $HSM_PARAM.actions | grep WAITING | wc -l"
+
+ unlinkmany $filebase $files_num || error "unlinkmany $filebase failed"
+ echo "End Phase files_num: $files_num time: $elapsed"
+
+ do_facet $SINGLEMDS "$LCTL get_param -n \
+ $HSM_PARAM.actions | grep WAITING | wc -l"
+
+ cdt_purge
+}
+run_test 50 "Archive with large number of pending HSM actions"
+
test_52() {
# test needs a running copytool
copytool setup