Whamcloud - gitweb
* 2nd half of 6304 (fragmented RDMA) fix
[fs/lustre-release.git] / lustre / osc / osc_request.c
index 86b9bcb..92575cc 100644 (file)
@@ -1490,13 +1490,19 @@ static int osc_send_oap_rpc(struct client_obd *cli, struct lov_oinfo *loi,
                 if (pos == NULL)
                         break;
 
+                /* If there is a gap at the start of this page, it can't merge
+                 * with any previous page, so we'll hand the network a
+                 * "fragmented" page array that it can't transfer in 1 RDMA */
+                if (page_count != 0 && oap->oap_page_off != 0)
+                        break;
+
                 /* take the page out of our book-keeping */
                 list_del_init(&oap->oap_pending_item);
                 lop_update_pending(cli, lop, cmd, -1);
                 list_del_init(&oap->oap_urgent_item);
 
                 if (page_count == 0)
-                        starting_offset = (oap->oap_obj_off +oap->oap_page_off)&
+                        starting_offset = (oap->oap_obj_off + oap->oap_page_off) &
                                           (PTLRPC_MAX_BRW_SIZE - 1);
 
                 /* ask the caller for the size of the io as the rpc leaves. */
@@ -1523,6 +1529,12 @@ static int osc_send_oap_rpc(struct client_obd *cli, struct lov_oinfo *loi,
                                  oap->oap_count) & (PTLRPC_MAX_BRW_SIZE - 1);
                 if (ending_offset == 0)
                         break;
+
+                /* If there is a gap at the end of this page, it can't merge
+                 * with any subsequent pages, so we'll hand the network a
+                 * "fragmented" page array that it can't transfer in 1 RDMA */
+                if (oap->oap_page_off + oap->oap_count < PAGE_SIZE)
+                        break;
         }
 
         osc_wake_cache_waiters(cli);