X-Git-Url: https://git.whamcloud.com/?p=fs%2Flustre-release.git;a=blobdiff_plain;f=lustre%2Fllite%2Frw.c;h=23093e12b4d97f18a81ce0661342c47231db7ac0;hp=9b2ecdd78446e257ced06a56f3477b034fd6e9d0;hb=9e4c5bdaaec5ef347260f0fd2f916143224f3cc4;hpb=01286ba81ce93e05e5e61c8346c80c74deb29d32 diff --git a/lustre/llite/rw.c b/lustre/llite/rw.c index 9b2ecdd..23093e12 100644 --- a/lustre/llite/rw.c +++ b/lustre/llite/rw.c @@ -1485,6 +1485,34 @@ static int kickoff_async_readahead(struct file *file, unsigned long pages) return 2; } +/* + * Check if we can issue a readahead RPC, if that is + * the case, we can't do fast IO because we will need + * a cl_io to issue the RPC. + */ +static bool ll_use_fast_io(struct file *file, + struct ll_readahead_state *ras, pgoff_t index) +{ + unsigned long fast_read_pages = + max(RA_REMAIN_WINDOW_MIN, ras->ras_rpc_pages); + loff_t skip_pages; + + if (stride_io_mode(ras)) { + skip_pages = (ras->ras_stride_length + + ras->ras_stride_bytes - 1) / ras->ras_stride_bytes; + skip_pages *= fast_read_pages; + } else { + skip_pages = fast_read_pages; + } + + if (ras->ras_window_start_idx + ras->ras_window_pages < + ras->ras_next_readahead_idx + skip_pages || + kickoff_async_readahead(file, fast_read_pages) > 0) + return true; + + return false; +} + int ll_readpage(struct file *file, struct page *vmpage) { struct inode *inode = file_inode(file); @@ -1508,8 +1536,6 @@ int ll_readpage(struct file *file, struct page *vmpage) struct ll_file_data *fd = LUSTRE_FPRIVATE(file); struct ll_readahead_state *ras = &fd->fd_ras; struct lu_env *local_env = NULL; - unsigned long fast_read_pages = - max(RA_REMAIN_WINDOW_MIN, ras->ras_rpc_pages); struct vvp_page *vpg; result = -ENODATA; @@ -1537,12 +1563,7 @@ int ll_readpage(struct file *file, struct page *vmpage) /* avoid duplicate ras_update() call */ vpg->vpg_ra_updated = 1; - /* Check if we can issue a readahead RPC, if that is - * the case, we can't do fast IO because we will need - * a cl_io to issue the RPC. */ - if (ras->ras_window_start_idx + ras->ras_window_pages < - ras->ras_next_readahead_idx + fast_read_pages || - kickoff_async_readahead(file, fast_read_pages) > 0) + if (ll_use_fast_io(file, ras, vvp_index(vpg))) result = 0; }