Whamcloud - gitweb
LU-12043 llite: don't miss every first stride page
[fs/lustre-release.git] / lustre / llite / rw.c
index 27442a4..cda05f6 100644 (file)
@@ -398,14 +398,16 @@ ll_read_ahead_pages(const struct lu_env *env, struct cl_io *io,
                                ria->ria_reserved--;
                                count++;
                        }
-                } else if (stride_ria) {
-                        /* If it is not in the read-ahead window, and it is
-                         * read-ahead mode, then check whether it should skip
-                         * the stride gap */
-                        pgoff_t offset;
-                        /* FIXME: This assertion only is valid when it is for
-                         * forward read-ahead, it will be fixed when backward
-                         * read-ahead is implemented */
+               } else if (stride_ria) {
+                       /* If it is not in the read-ahead window, and it is
+                        * read-ahead mode, then check whether it should skip
+                        * the stride gap.
+                        */
+                       pgoff_t offset;
+                       /* NOTE: This assertion only is valid when it is for
+                        * forward read-ahead, must adjust if backward
+                        * readahead is implemented.
+                        */
                        LASSERTF(page_idx >= ria->ria_stoff,
                                "Invalid page_idx %lu rs %lu re %lu ro %lu "
                                "rl %lu rp %lu\n", page_idx,
@@ -413,14 +415,15 @@ ll_read_ahead_pages(const struct lu_env *env, struct cl_io *io,
                                ria->ria_length, ria->ria_pages);
                         offset = page_idx - ria->ria_stoff;
                         offset = offset % (ria->ria_length);
-                        if (offset > ria->ria_pages) {
-                                page_idx += ria->ria_length - offset;
-                                CDEBUG(D_READA, "i %lu skip %lu \n", page_idx,
-                                       ria->ria_length - offset);
-                                continue;
-                        }
-                }
-        }
+                       if (offset >= ria->ria_pages) {
+                               page_idx += ria->ria_length - offset - 1;
+                               CDEBUG(D_READA,
+                                      "Stride: jump %lu pages to %lu\n",
+                                      ria->ria_length - offset, page_idx);
+                               continue;
+                       }
+               }
+       }
 
        cl_read_ahead_release(env, &ra);