Whamcloud - gitweb
LU-56 obdclass: SMP improvement for lu_key
[fs/lustre-release.git] / lustre / obdclass / cl_io.c
index d5d52d9..2e8619a 100644 (file)
@@ -1,6 +1,4 @@
-/* -*- mode: c; c-basic-offset: 8; indent-tabs-mode: nil; -*-
- * vim:expandtab:shiftwidth=8:tabstop=8:
- *
+/*
  * GPL HEADER START
  *
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -28,6 +26,8 @@
 /*
  * Copyright (c) 2008, 2010, Oracle and/or its affiliates. All rights reserved.
  * Use is subject to license terms.
+ *
+ * Copyright (c) 2011, 2012, Whamcloud, Inc.
  */
 /*
  * This file is part of Lustre, http://www.lustre.org/
@@ -39,9 +39,6 @@
  */
 
 #define DEBUG_SUBSYSTEM S_CLASS
-#ifndef EXPORT_SYMTAB
-# define EXPORT_SYMTAB
-#endif
 
 #include <obd_class.h>
 #include <obd_support.h>
@@ -377,7 +374,13 @@ static int cl_lockset_lock_one(const struct lu_env *env,
 
         ENTRY;
 
-        lock = cl_lock_request(env, io, &link->cill_descr, "io", io);
+        if (io->ci_lockreq == CILR_PEEK) {
+                lock = cl_lock_peek(env, io, &link->cill_descr, "io", io);
+                if (lock == NULL)
+                        lock = ERR_PTR(-ENODATA);
+        } else
+                lock = cl_lock_request(env, io, &link->cill_descr, "io", io);
+
         if (!IS_ERR(lock)) {
                 link->cill_lock = lock;
                 cfs_list_move(&link->cill_linkage, &set->cls_curr);
@@ -787,7 +790,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.
          */
@@ -883,8 +886,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;
@@ -896,7 +898,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;
         }
@@ -914,21 +916,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.,
@@ -1030,7 +1030,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);
 
@@ -1543,7 +1545,6 @@ void cl_req_page_add(const struct lu_env *env,
         ENTRY;
         page = cl_page_top(page);
 
-        LINVRNT(cl_page_is_vmlocked(env, page));
         LASSERT(cfs_list_empty(&page->cp_flight));
         LASSERT(page->cp_req == NULL);
 
@@ -1578,7 +1579,6 @@ void cl_req_page_done(const struct lu_env *env, struct cl_page *page)
         ENTRY;
         page = cl_page_top(page);
 
-        LINVRNT(cl_page_is_vmlocked(env, page));
         LASSERT(!cfs_list_empty(&page->cp_flight));
         LASSERT(req->crq_nrpages > 0);