Whamcloud - gitweb
b=21454 Disable cl_page_in_io check for append write.
[fs/lustre-release.git] / lustre / obdclass / cl_io.c
index e386396..5a6b8b0 100644 (file)
@@ -657,7 +657,7 @@ cl_io_slice_page(const struct cl_io_slice *ios, struct cl_page *page)
  */
 static int cl_page_in_io(const struct cl_page *page, const struct cl_io *io)
 {
-        int     result;
+        int     result = 1;
         loff_t  start;
         loff_t  end;
         pgoff_t idx;
@@ -670,10 +670,13 @@ static int cl_page_in_io(const struct cl_page *page, const struct cl_io *io)
                  * check that [start, end) and [pos, pos + count) extents
                  * overlap.
                  */
-                start = cl_offset(page->cp_obj, idx);
-                end   = cl_offset(page->cp_obj, idx + 1);
-                result = io->u.ci_rw.crw_pos < end &&
-                        start < io->u.ci_rw.crw_pos + io->u.ci_rw.crw_count;
+                if (!cl_io_is_append(io)) {
+                        const struct cl_io_rw_common *crw = &(io->u.ci_rw);
+                        start = cl_offset(page->cp_obj, idx);
+                        end   = cl_offset(page->cp_obj, idx + 1);
+                        result = crw->crw_pos < end &&
+                                 start < crw->crw_pos + crw->crw_count;
+                }
                 break;
         case CIT_FAULT:
                 result = io->u.ci_fault.ft_index == idx;
@@ -1633,23 +1636,16 @@ int cl_sync_io_wait(const struct lu_env *env, struct cl_io *io,
                           atomic_read(&anchor->csi_sync_nr) == 0,
                           &lwi);
         if (rc < 0) {
-                int rc2;
-
                 CERROR("SYNC IO failed with error: %d, try to cancel "
-                       "the remaining page\n", rc);
-
-                rc2 = cl_io_cancel(env, io, queue);
-                if (rc2 < 0) {
-                        lwi = (struct l_wait_info) { 0 };
-                        /* Too bad, some pages are still in IO. */
-                        CERROR("Failed to cancel transfer error: %d, mostly "
-                               "because of they are still being transferred, "
-                               "waiting for %i pages\n",
-                               rc2, atomic_read(&anchor->csi_sync_nr));
-                        (void)l_wait_event(anchor->csi_waitq,
-                                     atomic_read(&anchor->csi_sync_nr) == 0,
-                                     &lwi);
-                }
+                       "%d remaining pages\n",
+                       rc, atomic_read(&anchor->csi_sync_nr));
+
+                (void)cl_io_cancel(env, io, queue);
+
+                lwi = (struct l_wait_info) { 0 };
+                (void)l_wait_event(anchor->csi_waitq,
+                                   atomic_read(&anchor->csi_sync_nr) == 0,
+                                   &lwi);
         } else {
                 rc = anchor->csi_sync_rc;
         }
@@ -1673,6 +1669,7 @@ void cl_sync_io_note(struct cl_sync_io *anchor, int ioret)
          * ->{prepare,commit}_write(). Completion is used to signal the end of
          * IO.
          */
+        LASSERT(atomic_read(&anchor->csi_sync_nr) > 0);
         if (atomic_dec_and_test(&anchor->csi_sync_nr))
                 cfs_waitq_broadcast(&anchor->csi_waitq);
         EXIT;