- rc = 0;
- }
-
- CDEBUG(D_VFSTRACE, "loop type %u done: nob: %zu, rc: %d %s\n",
- io->ci_type, io->ci_nob, rc,
- io->ci_continue ? "continue" : "stop");
-
- while (head != NULL) {
- int rc2;
-
- pt = head;
- head = head->cip_next;
-
- rc2 = cfs_ptask_wait_for(&pt->cip_task);
- LASSERTF(!rc2, "wait for task error: %d\n", rc2);
-
- rc2 = cfs_ptask_result(&pt->cip_task);
- CDEBUG(D_VFSTRACE,
- "done %s range: [%llu, %llu) ret: %zd, rc: %d\n",
- pt->cip_iot == CIT_READ ? "read" : "write",
- pt->cip_pos, pt->cip_pos + pt->cip_count,
- pt->cip_result, rc2);
-
- /* save the result of ptask */
- rc = rc ? : rc2;
- io->ci_need_restart |= pt->cip_need_restart;
-
- if (!short_io) {
- if (!rc2) /* IO is done by this task successfully */
- io->ci_nob += pt->cip_result;
- if (pt->cip_result < pt->cip_count) {
- /* short IO happened.
- * Not necessary to be an error */
- CDEBUG(D_VFSTRACE,
- "incomplete range: [%llu, %llu) "
- "last_chunk_count: %zu\n",
- pt->cip_pos,
- pt->cip_pos + pt->cip_count,
- last_chunk_count);
- io->ci_nob -= last_chunk_count;
- short_io = true;
- }
- }
- OBD_FREE(pt, sizeof(*pt));