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

staging/lustre/clio: remove stackable cl_page completely



>From now on, cl_page becomes one to one mapping of vmpage.

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


Reviewed-by: default avatarBobi Jam <bobijam@gmail.com>
Reviewed-by: default avatarLai Siyao <lai.siyao@intel.com>
Signed-off-by: default avatarOleg Drokin <green@linuxhacker.ru>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent f56b355c
Loading
Loading
Loading
Loading
+11 −32
Original line number Diff line number Diff line
@@ -322,7 +322,7 @@ struct cl_object_operations {
	 *	 to be used instead of newly created.
	 */
	int  (*coo_page_init)(const struct lu_env *env, struct cl_object *obj,
			      struct cl_page *page, struct page *vmpage);
				struct cl_page *page, pgoff_t index);
	/**
	 * Initialize lock slice for this layer. Called top-to-bottom through
	 * every object layer when a new cl_lock is instantiated. Layer
@@ -460,10 +460,6 @@ struct cl_object_header {
					co_lu.lo_linkage)
/** @} cl_object */

#ifndef pgoff_t
#define pgoff_t unsigned long
#endif

#define CL_PAGE_EOF ((pgoff_t)~0ull)

/** \addtogroup cl_page cl_page
@@ -727,16 +723,10 @@ struct cl_page {
	atomic_t	     cp_ref;
	/** An object this page is a part of. Immutable after creation. */
	struct cl_object	*cp_obj;
	/** Logical page index within the object. Immutable after creation. */
	pgoff_t		  cp_index;
	/** List of slices. Immutable after creation. */
	struct list_head	       cp_layers;
	/** Parent page, NULL for top-level page. Immutable after creation. */
	struct cl_page	  *cp_parent;
	/** Lower-layer page. NULL for bottommost page. Immutable after
	 * creation.
	 */
	struct cl_page	  *cp_child;
	/** vmpage */
	struct page		*cp_vmpage;
	/**
	 * Page state. This field is const to avoid accidental update, it is
	 * modified only internally within cl_page.c. Protected by a VM lock.
@@ -791,6 +781,7 @@ struct cl_page {
 */
struct cl_page_slice {
	struct cl_page		  *cpl_page;
	pgoff_t				 cpl_index;
	/**
	 * Object slice corresponding to this page slice. Immutable after
	 * creation.
@@ -845,11 +836,6 @@ struct cl_page_operations {
	 * provided by the topmost layer, see cl_page_disown0() as an example.
	 */

	/**
	 * \return the underlying VM page. Optional.
	 */
	struct page *(*cpo_vmpage)(const struct lu_env *env,
				   const struct cl_page_slice *slice);
	/**
	 * Called when \a io acquires this page into the exclusive
	 * ownership. When this method returns, it is guaranteed that the is
@@ -1102,6 +1088,12 @@ static inline int __page_in_use(const struct cl_page *page, int refc)
#define cl_page_in_use(pg)       __page_in_use(pg, 1)
#define cl_page_in_use_noref(pg) __page_in_use(pg, 0)

static inline struct page *cl_page_vmpage(struct cl_page *page)
{
	LASSERT(page->cp_vmpage);
	return page->cp_vmpage;
}

/** @} cl_page */

/** \addtogroup cl_lock cl_lock
@@ -2729,7 +2721,7 @@ static inline int cl_object_same(struct cl_object *o0, struct cl_object *o1)
static inline void cl_object_page_init(struct cl_object *clob, int size)
{
	clob->co_slice_off = cl_object_header(clob)->coh_page_bufsize;
	cl_object_header(clob)->coh_page_bufsize += ALIGN(size, 8);
	cl_object_header(clob)->coh_page_bufsize += cfs_size_round(size);
}

static inline void *cl_object_page_slice(struct cl_object *clob,
@@ -2774,9 +2766,7 @@ void cl_page_print(const struct lu_env *env, void *cookie, lu_printer_t printer,
		   const struct cl_page *pg);
void cl_page_header_print(const struct lu_env *env, void *cookie,
			  lu_printer_t printer, const struct cl_page *pg);
struct page *cl_page_vmpage(const struct lu_env *env, struct cl_page *page);
struct cl_page *cl_vmpage_page(struct page *vmpage, struct cl_object *obj);
struct cl_page *cl_page_top(struct cl_page *page);

const struct cl_page_slice *cl_page_at(const struct cl_page *page,
				       const struct lu_device_type *dtype);
@@ -2868,17 +2858,6 @@ struct cl_lock *cl_lock_at_pgoff(const struct lu_env *env,
				 struct cl_object *obj, pgoff_t index,
				 struct cl_lock *except, int pending,
				 int canceld);
static inline struct cl_lock *cl_lock_at_page(const struct lu_env *env,
					      struct cl_object *obj,
					      struct cl_page *page,
					      struct cl_lock *except,
					      int pending, int canceld)
{
	LASSERT(cl_object_header(obj) == cl_object_header(page->cp_obj));
	return cl_lock_at_pgoff(env, obj, page->cp_index, except,
				pending, canceld);
}

const struct cl_lock_slice *cl_lock_at(const struct cl_lock *lock,
				       const struct lu_device_type *dtype);

+5 −2
Original line number Diff line number Diff line
@@ -238,6 +238,11 @@ static inline struct ccc_page *cl2ccc_page(const struct cl_page_slice *slice)
	return container_of(slice, struct ccc_page, cpg_cl);
}

static inline pgoff_t ccc_index(struct ccc_page *ccc)
{
	return ccc->cpg_cl.cpl_index;
}

struct ccc_device {
	struct cl_device    cdv_cl;
	struct super_block *cdv_sb;
@@ -294,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);
struct page *ccc_page_vmpage(const struct lu_env *env,
			    const struct cl_page_slice *slice);
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);
+4 −8
Original line number Diff line number Diff line
@@ -336,6 +336,8 @@ struct lu_object *ccc_object_alloc(const struct lu_env *env,
		obj = ccc2lu(vob);
		hdr = &vob->cob_header;
		cl_object_header_init(hdr);
		hdr->coh_page_bufsize = cfs_size_round(sizeof(struct cl_page));

		lu_object_init(obj, &hdr->coh_lu, dev);
		lu_object_add_top(&hdr->coh_lu, obj);

@@ -450,12 +452,6 @@ static void ccc_object_size_unlock(struct cl_object *obj)
 *
 */

struct page *ccc_page_vmpage(const struct lu_env *env,
			     const struct cl_page_slice *slice)
{
	return cl2vm_page(slice);
}

int ccc_page_is_under_lock(const struct lu_env *env,
			   const struct cl_page_slice *slice,
			   struct cl_io *io)
@@ -471,8 +467,8 @@ int ccc_page_is_under_lock(const struct lu_env *env,
		if (cio->cui_fd->fd_flags & LL_FILE_GROUP_LOCKED) {
			result = -EBUSY;
		} else {
			desc->cld_start = page->cp_index;
			desc->cld_end   = page->cp_index;
			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,
+4 −0
Original line number Diff line number Diff line
@@ -982,6 +982,10 @@ static inline void ll_invalidate_page(struct page *vmpage)
	if (!mapping)
		return;

	/*
	 * truncate_complete_page() calls
	 * a_ops->invalidatepage()->cl_page_delete()->vvp_page_delete().
	 */
	ll_teardown_mmaps(mapping, offset, offset + PAGE_CACHE_SIZE);
	truncate_complete_page(mapping, vmpage);
}
+4 −3
Original line number Diff line number Diff line
@@ -290,15 +290,16 @@ void ll_ra_read_ex(struct file *f, struct ll_ra_read *rar)

static int cl_read_ahead_page(const struct lu_env *env, struct cl_io *io,
			      struct cl_page_list *queue, struct cl_page *page,
			      struct page *vmpage)
			      struct cl_object *clob)
{
	struct page *vmpage = page->cp_vmpage;
	struct ccc_page *cp;
	int	      rc;

	rc = 0;
	cl_page_assume(env, io, page);
	lu_ref_add(&page->cp_reference, "ra", current);
	cp = cl2ccc_page(cl_page_at(page, &vvp_device_type));
	cp = cl2ccc_page(cl_object_page_slice(clob, page));
	if (!cp->cpg_defer_uptodate && !PageUptodate(vmpage)) {
		rc = cl_page_is_under_lock(env, io, page);
		if (rc == -EBUSY) {
@@ -348,7 +349,7 @@ static int ll_read_ahead_page(const struct lu_env *env, struct cl_io *io,
					    vmpage, CPT_CACHEABLE);
			if (!IS_ERR(page)) {
				rc = cl_read_ahead_page(env, io, queue,
							page, vmpage);
							page, clob);
				if (rc == -ENOLCK) {
					which = RA_STAT_FAILED_MATCH;
					msg   = "lock match failed";
Loading