@@ -360,7 +360,8 @@ static bool ras_inside_ra_window(pgoff_t idx, struct ra_io_arg *ria)
{
struct cl_read_ahead ra = { 0 };
pgoff_t page_idx;
- int count = 0;
+ /* busy page count is per stride */
+ int count = 0, busy_page_count = 0;
int rc;
LASSERT(ria);
@@ -416,8 +417,21 @@ static bool ras_inside_ra_window(pgoff_t idx, struct ra_io_arg *ria)
/* If the page is inside the read-ahead window */
rc = ll_read_ahead_page(env, io, queue, page_idx);
- if (rc < 0)
+ if (rc < 0 && rc != -EBUSY)
break;
+ if (rc == -EBUSY) {
+ busy_page_count++;
+ CDEBUG(D_READA,
+ "skip busy page: %lu\n", page_idx);
+ /* For page unaligned readahead the first
+ * last pages of each region can be read by
+ * another reader on the same node, and so
+ * may be busy. So only stop for > 2 busy
+ * pages.
+ */
+ if (busy_page_count > 2)
+ break;
+ }
*ra_end = page_idx;
/* Only subtract from reserve & count the page if we
@@ -441,6 +455,7 @@ static bool ras_inside_ra_window(pgoff_t idx, struct ra_io_arg *ria)
pos += (ria->ria_length - offset);
if ((pos >> PAGE_SHIFT) >= page_idx + 1)
page_idx = (pos >> PAGE_SHIFT) - 1;
+ busy_page_count = 0;
CDEBUG(D_READA,
"Stride: jump %llu pages to %lu\n",
ria->ria_length - offset, page_idx);