work = container_of(wq, struct ll_readahead_work,
lrw_readahead_work);
- fd = LUSTRE_FPRIVATE(work->lrw_file);
+ fd = work->lrw_file->private_data;
ras = &fd->fd_ras;
file = work->lrw_file;
inode = file_inode(file);
loff_t bytes_count =
stride_byte_count(ras->ras_stride_offset,
ras->ras_stride_length, ras->ras_stride_bytes,
- ras->ras_stride_offset, len);
+ ras->ras_window_start_idx << PAGE_SHIFT, len);
return (bytes_count + PAGE_SIZE - 1) >> PAGE_SHIFT;
}
stride_bytes = end - ras->ras_stride_offset;
div64_u64_rem(stride_bytes, ras->ras_stride_length, &left_bytes);
- window_bytes = ((loff_t)ras->ras_window_pages << PAGE_SHIFT) -
- left_bytes;
-
- if (left_bytes < ras->ras_stride_bytes)
- left_bytes += inc_bytes;
- else
- left_bytes = ras->ras_stride_bytes + inc_bytes;
+ window_bytes = (ras->ras_window_pages << PAGE_SHIFT);
+ if (left_bytes < ras->ras_stride_bytes) {
+ if (ras->ras_stride_bytes - left_bytes >= inc_bytes) {
+ window_bytes += inc_bytes;
+ goto out;
+ } else {
+ window_bytes += (ras->ras_stride_bytes - left_bytes);
+ inc_bytes -= (ras->ras_stride_bytes - left_bytes);
+ }
+ } else {
+ window_bytes += (ras->ras_stride_length - left_bytes);
+ }
LASSERT(ras->ras_stride_bytes != 0);
- step = div64_u64_rem(left_bytes, ras->ras_stride_bytes, &left_bytes);
+ step = div64_u64_rem(inc_bytes, ras->ras_stride_bytes, &left_bytes);
window_bytes += step * ras->ras_stride_length + left_bytes;
+ LASSERT(window_bytes > 0);
- if (stride_page_count(ras, window_bytes) <= ra->ra_max_pages_per_file)
+out:
+ if (stride_page_count(ras, window_bytes) <=
+ ra->ra_max_pages_per_file || ras->ras_window_pages == 0)
ras->ras_window_pages = (window_bytes >> PAGE_SHIFT);
+ LASSERT(ras->ras_window_pages > 0);
+
RAS_CDEBUG(ras);
}
void ll_ras_enter(struct file *f, loff_t pos, size_t count)
{
- struct ll_file_data *fd = LUSTRE_FPRIVATE(f);
+ struct ll_file_data *fd = f->private_data;
struct ll_readahead_state *ras = &fd->fd_ras;
struct inode *inode = file_inode(f);
unsigned long index = pos >> PAGE_SHIFT;
struct ll_cl_context *ll_cl_find(struct file *file)
{
- struct ll_file_data *fd = LUSTRE_FPRIVATE(file);
+ struct ll_file_data *fd = file->private_data;
struct ll_cl_context *lcc;
struct ll_cl_context *found = NULL;
void ll_cl_add(struct file *file, const struct lu_env *env, struct cl_io *io,
enum lcc_type type)
{
- struct ll_file_data *fd = LUSTRE_FPRIVATE(file);
+ struct ll_file_data *fd = file->private_data;
struct ll_cl_context *lcc = &ll_env_info(env)->lti_io_ctx;
memset(lcc, 0, sizeof(*lcc));
void ll_cl_remove(struct file *file, const struct lu_env *env)
{
- struct ll_file_data *fd = LUSTRE_FPRIVATE(file);
+ struct ll_file_data *fd = file->private_data;
struct ll_cl_context *lcc = &ll_env_info(env)->lti_io_ctx;
write_lock(&fd->fd_lock);
{
struct inode *inode = vvp_object_inode(page->cp_obj);
struct ll_sb_info *sbi = ll_i2sbi(inode);
- struct ll_file_data *fd = LUSTRE_FPRIVATE(file);
+ struct ll_file_data *fd = file->private_data;
struct ll_readahead_state *ras = &fd->fd_ras;
struct cl_2queue *queue = &io->ci_queue;
struct cl_sync_io *anchor = NULL;
struct ll_readahead_work *lrw;
struct inode *inode = file_inode(file);
struct ll_sb_info *sbi = ll_i2sbi(inode);
- struct ll_file_data *fd = LUSTRE_FPRIVATE(file);
+ struct ll_file_data *fd = file->private_data;
struct ll_readahead_state *ras = &fd->fd_ras;
struct ll_ra_info *ra = &sbi->ll_ra_info;
unsigned long throttle;
if (io == NULL) { /* fast read */
struct inode *inode = file_inode(file);
- struct ll_file_data *fd = LUSTRE_FPRIVATE(file);
+ struct ll_file_data *fd = file->private_data;
struct ll_readahead_state *ras = &fd->fd_ras;
struct lu_env *local_env = NULL;
struct vvp_page *vpg;