Whamcloud - gitweb
Branch HEAD
[fs/lustre-release.git] / lustre / obdclass / cl_io.c
index 1be2176..e36bc31 100644 (file)
@@ -228,7 +228,7 @@ int cl_io_rw_init(const struct lu_env *env, struct cl_io *io,
 
         LU_OBJECT_HEADER(D_VFSTRACE, env, &io->ci_obj->co_lu,
                          "io range: %i [%llu, %llu) %i %i\n",
-                         iot, (__u64)pos, (__u64)pos + count,
+                         iot, (__u64)pos, (__u64)(pos + count),
                          io->u.ci_rw.crw_nonblock, io->u.ci_wr.wr_append);
         io->u.ci_rw.crw_pos    = pos;
         io->u.ci_rw.crw_count  = count;
@@ -466,7 +466,7 @@ void cl_io_unlock(const struct lu_env *env, struct cl_io *io)
                         scan->cis_iop->op[io->ci_type].cio_unlock(env, scan);
         }
         io->ci_state = CIS_UNLOCKED;
-        LASSERT(cl_env_info(env)->clt_nr_locks_acquired == 0);
+        LASSERT(!cl_env_info(env)->clt_counters[CNL_TOP].ctc_nr_locks_acquired);
         EXIT;
 }
 EXPORT_SYMBOL(cl_io_unlock);
@@ -582,7 +582,7 @@ static void cl_free_io_lock_link(const struct lu_env *env,
  * Allocates new lock link, and uses it to add a lock to a lockset.
  */
 int cl_io_lock_alloc_add(const struct lu_env *env, struct cl_io *io,
-                         struct cl_lock_descr *descr)
+                         struct cl_lock_descr *descr, int enqflags)
 {
         struct cl_io_lock_link *link;
         int result;
@@ -590,8 +590,9 @@ int cl_io_lock_alloc_add(const struct lu_env *env, struct cl_io *io,
         ENTRY;
         OBD_ALLOC_PTR(link);
         if (link != NULL) {
-                link->cill_descr = *descr;
-                link->cill_fini = cl_free_io_lock_link;
+                link->cill_descr     = *descr;
+                link->cill_enq_flags = enqflags;
+                link->cill_fini      = cl_free_io_lock_link;
                 result = cl_io_lock_add(env, io, link);
                 if (result) /* lock match */
                         link->cill_fini(env, link);
@@ -738,7 +739,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);
+                result = cl_io_submit_rw(env, io, CRT_READ, queue, CRP_NORMAL);
         /*
          * Unlock unsent pages in case of error.
          */
@@ -834,7 +835,8 @@ 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_type crt, struct cl_2queue *queue,
+                    enum cl_req_priority priority)
 {
         const struct cl_io_slice *scan;
         int result = 0;
@@ -846,7 +848,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);
+                                                               queue, priority);
                 if (result != 0)
                         break;
         }
@@ -1126,16 +1128,18 @@ int cl_page_list_own(const struct lu_env *env,
                      struct cl_io *io, struct cl_page_list *plist)
 {
         struct cl_page *page;
+        struct cl_page *temp;
         int result;
-        int rc;
 
         LINVRNT(plist->pl_owner == cfs_current());
 
         ENTRY;
         result = 0;
-        cl_page_list_for_each(page, plist) {
-                rc = cl_page_own(env, io, page);
+        cl_page_list_for_each_safe(page, temp, plist) {
+                if (cl_page_own(env, io, page) == 0)
                 result = result ?: page->cp_error;
+                else
+                        cl_page_list_del(env, plist, page);
         }
         RETURN(result);
 }