Whamcloud - gitweb
LU-2034 changelog: redo changelog using OSD llog
[fs/lustre-release.git] / lustre / obdclass / cl_io.c
index d90be9c..6619073 100644 (file)
@@ -104,8 +104,8 @@ static int cl_io_invariant(const struct cl_io *io)
  */
 void cl_io_fini(const struct lu_env *env, struct cl_io *io)
 {
-        struct cl_io_slice    *slice;
-        struct cl_thread_info *info;
+       struct cl_io_slice    *slice;
+       struct cl_thread_info *info;
 
         LINVRNT(cl_io_type_is_valid(io->ci_type));
         LINVRNT(cl_io_invariant(io));
@@ -128,7 +128,24 @@ void cl_io_fini(const struct lu_env *env, struct cl_io *io)
         info = cl_env_info(env);
         if (info->clt_current_io == io)
                 info->clt_current_io = NULL;
-        EXIT;
+
+       /* sanity check for layout change */
+       switch(io->ci_type) {
+       case CIT_READ:
+       case CIT_WRITE:
+       case CIT_FAULT:
+       case CIT_FSYNC:
+               LASSERT(!io->ci_need_restart);
+               break;
+       case CIT_MISC:
+               /* Check ignore layout change conf */
+               LASSERT(ergo(io->ci_ignore_layout, !io->ci_need_restart));
+       case CIT_SETATTR:
+               break;
+       default:
+               LBUG();
+       }
+       EXIT;
 }
 EXPORT_SYMBOL(cl_io_fini);
 
@@ -790,7 +807,7 @@ int cl_io_read_page(const struct lu_env *env, struct cl_io *io,
                 }
         }
         if (result == 0)
-                result = cl_io_submit_rw(env, io, CRT_READ, queue, CRP_NORMAL);
+               result = cl_io_submit_rw(env, io, CRT_READ, queue);
         /*
          * Unlock unsent pages in case of error.
          */
@@ -886,8 +903,7 @@ EXPORT_SYMBOL(cl_io_commit_write);
  * \see cl_io_operations::cio_submit()
  */
 int cl_io_submit_rw(const struct lu_env *env, struct cl_io *io,
-                    enum cl_req_type crt, struct cl_2queue *queue,
-                    enum cl_req_priority priority)
+                   enum cl_req_type crt, struct cl_2queue *queue)
 {
         const struct cl_io_slice *scan;
         int result = 0;
@@ -899,7 +915,7 @@ int cl_io_submit_rw(const struct lu_env *env, struct cl_io *io,
                 if (scan->cis_iop->req_op[crt].cio_submit == NULL)
                         continue;
                 result = scan->cis_iop->req_op[crt].cio_submit(env, scan, crt,
-                                                               queue, priority);
+                                                              queue);
                 if (result != 0)
                         break;
         }
@@ -917,21 +933,19 @@ EXPORT_SYMBOL(cl_io_submit_rw);
  */
 int cl_io_submit_sync(const struct lu_env *env, struct cl_io *io,
                       enum cl_req_type iot, struct cl_2queue *queue,
-                      enum cl_req_priority prio, long timeout)
+                     long timeout)
 {
         struct cl_sync_io *anchor = &cl_env_info(env)->clt_anchor;
         struct cl_page *pg;
         int rc;
 
-        LASSERT(prio == CRP_NORMAL || prio == CRP_CANCEL);
-
         cl_page_list_for_each(pg, &queue->c2_qin) {
                 LASSERT(pg->cp_sync_io == NULL);
                 pg->cp_sync_io = anchor;
         }
 
         cl_sync_io_init(anchor, queue->c2_qin.pl_nr);
-        rc = cl_io_submit_rw(env, io, iot, queue, prio);
+       rc = cl_io_submit_rw(env, io, iot, queue);
         if (rc == 0) {
                 /*
                  * If some pages weren't sent for any reason (e.g.,
@@ -1033,7 +1047,9 @@ int cl_io_loop(const struct lu_env *env, struct cl_io *io)
                 }
                 cl_io_iter_fini(env, io);
         } while (result == 0 && io->ci_continue);
-        RETURN(result < 0 ? result : 0);
+       if (result == 0)
+               result = io->ci_result;
+       RETURN(result < 0 ? result : 0);
 }
 EXPORT_SYMBOL(cl_io_loop);