Commit fd7444fe authored by Jinshan Xiong's avatar Jinshan Xiong Committed by Greg Kroah-Hartman
Browse files

staging/lustre/clio: optimize read ahead code



It used to check each page in the readahead window is covered by
a lock underneath, now cpo_page_is_under_lock() provides @max_index
to help decide the maximum ra window. @max_index can be modified by
OSC to extend the maximum lock region, to align stripe boundary at
LOV, and to make sure the readahead region at least covers read
region at LLITE layer.

After this is done, usually readahead code calls
cpo_page_is_under_lock() for each stripe.

Signed-off-by: default avatarJinshan Xiong <jinshan.xiong@intel.com>
Reviewed-on: http://review.whamcloud.com/8523
Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-3321


Reviewed-by: default avatarAndreas Dilger <andreas.dilger@intel.com>
Signed-off-by: default avatarOleg Drokin <green@linuxhacker.ru>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 7addf402
Loading
Loading
Loading
Loading
+3 −3
Original line number Diff line number Diff line
@@ -935,7 +935,7 @@ struct cl_page_operations {
	 */
	int (*cpo_is_under_lock)(const struct lu_env *env,
				 const struct cl_page_slice *slice,
				 struct cl_io *io);
				 struct cl_io *io, pgoff_t *max);

	/**
	 * Optional debugging helper. Prints given page slice.
@@ -2674,7 +2674,7 @@ static inline void cl_device_fini(struct cl_device *d)
}

void cl_page_slice_add(struct cl_page *page, struct cl_page_slice *slice,
		       struct cl_object *obj,
		       struct cl_object *obj, pgoff_t index,
		       const struct cl_page_operations *ops);
void cl_lock_slice_add(struct cl_lock *lock, struct cl_lock_slice *slice,
		       struct cl_object *obj,
@@ -2826,7 +2826,7 @@ void cl_page_delete(const struct lu_env *env, struct cl_page *pg);
int cl_page_is_vmlocked(const struct lu_env *env, const struct cl_page *pg);
void cl_page_export(const struct lu_env *env, struct cl_page *pg, int uptodate);
int cl_page_is_under_lock(const struct lu_env *env, struct cl_io *io,
			  struct cl_page *page);
			  struct cl_page *page, pgoff_t *max_index);
loff_t cl_offset(const struct cl_object *obj, pgoff_t idx);
pgoff_t cl_index(const struct cl_object *obj, loff_t offset);
int cl_page_size(const struct cl_object *obj);
+0 −2
Original line number Diff line number Diff line
@@ -299,8 +299,6 @@ int ccc_lock_init(const struct lu_env *env, struct cl_object *obj,
		  const struct cl_lock_operations *lkops);
int ccc_object_glimpse(const struct lu_env *env,
		       const struct cl_object *obj, struct ost_lvb *lvb);
int ccc_page_is_under_lock(const struct lu_env *env,
			   const struct cl_page_slice *slice, struct cl_io *io);
int ccc_fail(const struct lu_env *env, const struct cl_page_slice *slice);
int ccc_transient_page_prep(const struct lu_env *env,
			    const struct cl_page_slice *slice,
+0 −28
Original line number Diff line number Diff line
@@ -452,34 +452,6 @@ static void ccc_object_size_unlock(struct cl_object *obj)
 *
 */

int ccc_page_is_under_lock(const struct lu_env *env,
			   const struct cl_page_slice *slice,
			   struct cl_io *io)
{
	struct ccc_io	*cio  = ccc_env_io(env);
	struct cl_lock_descr *desc = &ccc_env_info(env)->cti_descr;
	struct cl_page       *page = slice->cpl_page;

	int result;

	if (io->ci_type == CIT_READ || io->ci_type == CIT_WRITE ||
	    io->ci_type == CIT_FAULT) {
		if (cio->cui_fd->fd_flags & LL_FILE_GROUP_LOCKED) {
			result = -EBUSY;
		} else {
			desc->cld_start = ccc_index(cl2ccc_page(slice));
			desc->cld_end   = ccc_index(cl2ccc_page(slice));
			desc->cld_obj   = page->cp_obj;
			desc->cld_mode  = CLM_READ;
			result = cl_queue_match(&io->ci_lockset.cls_done,
						desc) ? -EBUSY : 0;
		}
	} else {
		result = 0;
	}
	return result;
}

int ccc_fail(const struct lu_env *env, const struct cl_page_slice *slice)
{
	/*
+4 −3
Original line number Diff line number Diff line
@@ -328,6 +328,7 @@ enum ra_stat {
	RA_STAT_EOF,
	RA_STAT_MAX_IN_FLIGHT,
	RA_STAT_WRONG_GRAB_PAGE,
	RA_STAT_FAILED_REACH_END,
	_NR_RA_STAT,
};

@@ -702,8 +703,8 @@ int ll_writepages(struct address_space *, struct writeback_control *wbc);
int ll_readpage(struct file *file, struct page *page);
void ll_readahead_init(struct inode *inode, struct ll_readahead_state *ras);
int ll_readahead(const struct lu_env *env, struct cl_io *io,
		 struct ll_readahead_state *ras, struct address_space *mapping,
		 struct cl_page_list *queue, int flags);
		 struct cl_page_list *queue, struct ll_readahead_state *ras,
		 bool hit);
int vvp_io_write_commit(const struct lu_env *env, struct cl_io *io);
struct ll_cl_context *ll_cl_init(struct file *file, struct page *vmpage);
void ll_cl_fini(struct ll_cl_context *lcc);
@@ -1074,7 +1075,7 @@ void ras_update(struct ll_sb_info *sbi, struct inode *inode,
		struct ll_readahead_state *ras, unsigned long index,
		unsigned hit);
void ll_ra_count_put(struct ll_sb_info *sbi, unsigned long len);
void ll_ra_stats_inc(struct address_space *mapping, enum ra_stat which);
void ll_ra_stats_inc(struct inode *inode, enum ra_stat which);

/* llite/llite_rmtacl.c */
#ifdef CONFIG_FS_POSIX_ACL
+1 −0
Original line number Diff line number Diff line
@@ -960,6 +960,7 @@ static const char *ra_stat_string[] = {
	[RA_STAT_EOF] = "read-ahead to EOF",
	[RA_STAT_MAX_IN_FLIGHT] = "hit max r-a issue",
	[RA_STAT_WRONG_GRAB_PAGE] = "wrong page from grab_cache_page",
	[RA_STAT_FAILED_REACH_END] = "failed to reach end"
};

int ldebugfs_register_mountpoint(struct dentry *parent,
Loading