Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 10cdef73 authored by John L. Hammond's avatar John L. Hammond Committed by Greg Kroah-Hartman
Browse files

staging/lustre/llite: merge ccc_io and vvp_io



Move the contents of struct vvp_io into struct ccc_io, delete the
former, and rename the latter to struct vvp_io. Rename various ccc_io
related functions to use vvp rather than ccc.

Signed-off-by: default avatarJohn L. Hammond <john.hammond@intel.com>
Reviewed-on: http://review.whamcloud.com/13351
Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-5971


Reviewed-by: default avatarLai Siyao <lai.siyao@intel.com>
Reviewed-by: default avatarJinshan Xiong <jinshan.xiong@intel.com>
Signed-off-by: default avatarOleg Drokin <green@linuxhacker.ru>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent bc4320a9
Loading
Loading
Loading
Loading
+1 −1
Original line number Original line Diff line number Diff line
@@ -1461,7 +1461,7 @@ enum cl_io_state {
 * This is usually embedded into layer session data, rather than allocated
 * This is usually embedded into layer session data, rather than allocated
 * dynamically.
 * dynamically.
 *
 *
 * \see vvp_io, lov_io, osc_io, ccc_io
 * \see vvp_io, lov_io, osc_io
 */
 */
struct cl_io_slice {
struct cl_io_slice {
	struct cl_io		  *cis_io;
	struct cl_io		  *cis_io;
+6 −7
Original line number Original line Diff line number Diff line
@@ -1135,14 +1135,13 @@ ll_file_io_generic(const struct lu_env *env, struct vvp_io_args *args,
	ll_io_init(io, file, iot == CIT_WRITE);
	ll_io_init(io, file, iot == CIT_WRITE);


	if (cl_io_rw_init(env, io, iot, *ppos, count) == 0) {
	if (cl_io_rw_init(env, io, iot, *ppos, count) == 0) {
		struct vvp_io *vio = vvp_env_io(env);
		struct vvp_io *cio = vvp_env_io(env);
		struct ccc_io *cio = ccc_env_io(env);
		int write_mutex_locked = 0;
		int write_mutex_locked = 0;


		cio->cui_fd  = LUSTRE_FPRIVATE(file);
		cio->cui_fd  = LUSTRE_FPRIVATE(file);
		vio->cui_io_subtype = args->via_io_subtype;
		cio->cui_io_subtype = args->via_io_subtype;


		switch (vio->cui_io_subtype) {
		switch (cio->cui_io_subtype) {
		case IO_NORMAL:
		case IO_NORMAL:
			cio->cui_iter = args->u.normal.via_iter;
			cio->cui_iter = args->u.normal.via_iter;
			cio->cui_iocb = args->u.normal.via_iocb;
			cio->cui_iocb = args->u.normal.via_iocb;
@@ -1158,11 +1157,11 @@ ll_file_io_generic(const struct lu_env *env, struct vvp_io_args *args,
			down_read(&lli->lli_trunc_sem);
			down_read(&lli->lli_trunc_sem);
			break;
			break;
		case IO_SPLICE:
		case IO_SPLICE:
			vio->u.splice.cui_pipe = args->u.splice.via_pipe;
			cio->u.splice.cui_pipe = args->u.splice.via_pipe;
			vio->u.splice.cui_flags = args->u.splice.via_flags;
			cio->u.splice.cui_flags = args->u.splice.via_flags;
			break;
			break;
		default:
		default:
			CERROR("Unknown IO type - %u\n", vio->cui_io_subtype);
			CERROR("Unknown IO type - %u\n", cio->cui_io_subtype);
			LBUG();
			LBUG();
		}
		}
		result = cl_io_loop(env, io);
		result = cl_io_loop(env, io);
+15 −45
Original line number Original line Diff line number Diff line
@@ -68,7 +68,6 @@ static const struct cl_req_operations ccc_req_ops;
 */
 */


static struct kmem_cache *ccc_thread_kmem;
static struct kmem_cache *ccc_thread_kmem;
static struct kmem_cache *ccc_session_kmem;
static struct kmem_cache *ccc_req_kmem;
static struct kmem_cache *ccc_req_kmem;


static struct lu_kmem_descr ccc_caches[] = {
static struct lu_kmem_descr ccc_caches[] = {
@@ -77,11 +76,6 @@ static struct lu_kmem_descr ccc_caches[] = {
		.ckd_name  = "ccc_thread_kmem",
		.ckd_name  = "ccc_thread_kmem",
		.ckd_size  = sizeof(struct ccc_thread_info),
		.ckd_size  = sizeof(struct ccc_thread_info),
	},
	},
	{
		.ckd_cache = &ccc_session_kmem,
		.ckd_name  = "ccc_session_kmem",
		.ckd_size  = sizeof(struct ccc_session)
	},
	{
	{
		.ckd_cache = &ccc_req_kmem,
		.ckd_cache = &ccc_req_kmem,
		.ckd_name  = "ccc_req_kmem",
		.ckd_name  = "ccc_req_kmem",
@@ -116,37 +110,12 @@ void ccc_key_fini(const struct lu_context *ctx,
	kmem_cache_free(ccc_thread_kmem, info);
	kmem_cache_free(ccc_thread_kmem, info);
}
}


void *ccc_session_key_init(const struct lu_context *ctx,
			   struct lu_context_key *key)
{
	struct ccc_session *session;

	session = kmem_cache_zalloc(ccc_session_kmem, GFP_NOFS);
	if (!session)
		session = ERR_PTR(-ENOMEM);
	return session;
}

void ccc_session_key_fini(const struct lu_context *ctx,
			  struct lu_context_key *key, void *data)
{
	struct ccc_session *session = data;

	kmem_cache_free(ccc_session_kmem, session);
}

struct lu_context_key ccc_key = {
struct lu_context_key ccc_key = {
	.lct_tags = LCT_CL_THREAD,
	.lct_tags = LCT_CL_THREAD,
	.lct_init = ccc_key_init,
	.lct_init = ccc_key_init,
	.lct_fini = ccc_key_fini
	.lct_fini = ccc_key_fini
};
};


struct lu_context_key ccc_session_key = {
	.lct_tags = LCT_SESSION,
	.lct_init = ccc_session_key_init,
	.lct_fini = ccc_session_key_fini
};

int ccc_req_init(const struct lu_env *env, struct cl_device *dev,
int ccc_req_init(const struct lu_env *env, struct cl_device *dev,
		 struct cl_req *req)
		 struct cl_req *req)
{
{
@@ -237,11 +206,11 @@ static void vvp_object_size_unlock(struct cl_object *obj)
 *
 *
 */
 */


int ccc_io_one_lock_index(const struct lu_env *env, struct cl_io *io,
int vvp_io_one_lock_index(const struct lu_env *env, struct cl_io *io,
			  __u32 enqflags, enum cl_lock_mode mode,
			  __u32 enqflags, enum cl_lock_mode mode,
			  pgoff_t start, pgoff_t end)
			  pgoff_t start, pgoff_t end)
{
{
	struct ccc_io	  *cio   = ccc_env_io(env);
	struct vvp_io *cio = vvp_env_io(env);
	struct cl_lock_descr   *descr = &cio->cui_link.cill_descr;
	struct cl_lock_descr   *descr = &cio->cui_link.cill_descr;
	struct cl_object       *obj   = io->ci_obj;
	struct cl_object       *obj   = io->ci_obj;


@@ -266,8 +235,8 @@ int ccc_io_one_lock_index(const struct lu_env *env, struct cl_io *io,
	return 0;
	return 0;
}
}


void ccc_io_update_iov(const struct lu_env *env,
void vvp_io_update_iov(const struct lu_env *env,
		       struct ccc_io *cio, struct cl_io *io)
		       struct vvp_io *cio, struct cl_io *io)
{
{
	size_t size = io->u.ci_rw.crw_count;
	size_t size = io->u.ci_rw.crw_count;


@@ -277,27 +246,27 @@ void ccc_io_update_iov(const struct lu_env *env,
	iov_iter_truncate(cio->cui_iter, size);
	iov_iter_truncate(cio->cui_iter, size);
}
}


int ccc_io_one_lock(const struct lu_env *env, struct cl_io *io,
int vvp_io_one_lock(const struct lu_env *env, struct cl_io *io,
		    __u32 enqflags, enum cl_lock_mode mode,
		    __u32 enqflags, enum cl_lock_mode mode,
		    loff_t start, loff_t end)
		    loff_t start, loff_t end)
{
{
	struct cl_object *obj = io->ci_obj;
	struct cl_object *obj = io->ci_obj;


	return ccc_io_one_lock_index(env, io, enqflags, mode,
	return vvp_io_one_lock_index(env, io, enqflags, mode,
				     cl_index(obj, start), cl_index(obj, end));
				     cl_index(obj, start), cl_index(obj, end));
}
}


void ccc_io_end(const struct lu_env *env, const struct cl_io_slice *ios)
void vvp_io_end(const struct lu_env *env, const struct cl_io_slice *ios)
{
{
	CLOBINVRNT(env, ios->cis_io->ci_obj,
	CLOBINVRNT(env, ios->cis_io->ci_obj,
		   vvp_object_invariant(ios->cis_io->ci_obj));
		   vvp_object_invariant(ios->cis_io->ci_obj));
}
}


void ccc_io_advance(const struct lu_env *env,
void vvp_io_advance(const struct lu_env *env,
		    const struct cl_io_slice *ios,
		    const struct cl_io_slice *ios,
		    size_t nob)
		    size_t nob)
{
{
	struct ccc_io    *cio = cl2ccc_io(env, ios);
	struct vvp_io    *cio = cl2vvp_io(env, ios);
	struct cl_io     *io  = ios->cis_io;
	struct cl_io     *io  = ios->cis_io;
	struct cl_object *obj = ios->cis_io->ci_obj;
	struct cl_object *obj = ios->cis_io->ci_obj;


@@ -492,7 +461,7 @@ int cl_setattr_ost(struct inode *inode, const struct iattr *attr)


again:
again:
	if (cl_io_init(env, io, CIT_SETATTR, io->ci_obj) == 0) {
	if (cl_io_init(env, io, CIT_SETATTR, io->ci_obj) == 0) {
		struct ccc_io *cio = ccc_env_io(env);
		struct vvp_io *cio = vvp_env_io(env);


		if (attr->ia_valid & ATTR_FILE)
		if (attr->ia_valid & ATTR_FILE)
			/* populate the file descriptor for ftruncate to honor
			/* populate the file descriptor for ftruncate to honor
@@ -524,13 +493,14 @@ int cl_setattr_ost(struct inode *inode, const struct iattr *attr)
 *
 *
 */
 */


struct ccc_io *cl2ccc_io(const struct lu_env *env,
struct vvp_io *cl2vvp_io(const struct lu_env *env,
			 const struct cl_io_slice *slice)
			 const struct cl_io_slice *slice)
{
{
	struct ccc_io *cio;
	struct vvp_io *cio;

	cio = container_of(slice, struct vvp_io, cui_cl);
	LASSERT(cio == vvp_env_io(env));


	cio = container_of(slice, struct ccc_io, cui_cl);
	LASSERT(cio == ccc_env_io(env));
	return cio;
	return cio;
}
}


+0 −72
Original line number Original line Diff line number Diff line
@@ -817,59 +817,6 @@ struct ll_close_queue {
void vvp_write_pending(struct vvp_object *club, struct vvp_page *page);
void vvp_write_pending(struct vvp_object *club, struct vvp_page *page);
void vvp_write_complete(struct vvp_object *club, struct vvp_page *page);
void vvp_write_complete(struct vvp_object *club, struct vvp_page *page);


/* specific architecture can implement only part of this list */
enum vvp_io_subtype {
	/** normal IO */
	IO_NORMAL,
	/** io started from splice_{read|write} */
	IO_SPLICE
};

/* IO subtypes */
struct vvp_io {
	/** io subtype */
	enum vvp_io_subtype    cui_io_subtype;

	union {
		struct {
			struct pipe_inode_info *cui_pipe;
			unsigned int	    cui_flags;
		} splice;
		struct vvp_fault_io {
			/**
			 * Inode modification time that is checked across DLM
			 * lock request.
			 */
			time64_t	    ft_mtime;
			struct vm_area_struct *ft_vma;
			/**
			 *  locked page returned from vvp_io
			 */
			struct page	    *ft_vmpage;
			struct vm_fault_api {
				/**
				 * kernel fault info
				 */
				struct vm_fault *ft_vmf;
				/**
				 * fault API used bitflags for return code.
				 */
				unsigned int    ft_flags;
				/**
				 * check that flags are from filemap_fault
				 */
				bool		ft_flags_valid;
			} fault;
		} fault;
	} u;

	/* Readahead state. */
	pgoff_t	cui_ra_start;
	pgoff_t cui_ra_count;
	/* Set when cui_ra_{start,count} have been initialized. */
	bool	cui_ra_valid;
};

/**
/**
 * IO arguments for various VFS I/O interfaces.
 * IO arguments for various VFS I/O interfaces.
 */
 */
@@ -923,25 +870,6 @@ static inline struct vvp_io_args *vvp_env_args(const struct lu_env *env,
	return ret;
	return ret;
}
}


struct vvp_session {
	struct vvp_io	 vs_ios;
};

static inline struct vvp_session *vvp_env_session(const struct lu_env *env)
{
	extern struct lu_context_key vvp_session_key;
	struct vvp_session *ses;

	ses = lu_context_key_get(env->le_ses, &vvp_session_key);
	LASSERT(ses);
	return ses;
}

static inline struct vvp_io *vvp_env_io(const struct lu_env *env)
{
	return &vvp_env_session(env)->vs_ios;
}

int vvp_global_init(void);
int vvp_global_init(void);
void vvp_global_fini(void);
void vvp_global_fini(void);


+6 −6
Original line number Original line Diff line number Diff line
@@ -146,7 +146,7 @@ ll_fault_io_init(struct vm_area_struct *vma, struct lu_env **env_ret,


	rc = cl_io_init(env, io, CIT_FAULT, io->ci_obj);
	rc = cl_io_init(env, io, CIT_FAULT, io->ci_obj);
	if (rc == 0) {
	if (rc == 0) {
		struct ccc_io *cio = ccc_env_io(env);
		struct vvp_io *cio = vvp_env_io(env);
		struct ll_file_data *fd = LUSTRE_FPRIVATE(file);
		struct ll_file_data *fd = LUSTRE_FPRIVATE(file);


		LASSERT(cio->cui_cl.cis_io == io);
		LASSERT(cio->cui_cl.cis_io == io);
@@ -307,17 +307,17 @@ static int ll_fault0(struct vm_area_struct *vma, struct vm_fault *vmf)
		vio = vvp_env_io(env);
		vio = vvp_env_io(env);
		vio->u.fault.ft_vma       = vma;
		vio->u.fault.ft_vma       = vma;
		vio->u.fault.ft_vmpage    = NULL;
		vio->u.fault.ft_vmpage    = NULL;
		vio->u.fault.fault.ft_vmf = vmf;
		vio->u.fault.ft_vmf = vmf;
		vio->u.fault.fault.ft_flags = 0;
		vio->u.fault.ft_flags = 0;
		vio->u.fault.fault.ft_flags_valid = false;
		vio->u.fault.ft_flags_valid = false;


		result = cl_io_loop(env, io);
		result = cl_io_loop(env, io);


		/* ft_flags are only valid if we reached
		/* ft_flags are only valid if we reached
		 * the call to filemap_fault
		 * the call to filemap_fault
		 */
		 */
		if (vio->u.fault.fault.ft_flags_valid)
		if (vio->u.fault.ft_flags_valid)
			fault_ret = vio->u.fault.fault.ft_flags;
			fault_ret = vio->u.fault.ft_flags;


		vmpage = vio->u.fault.ft_vmpage;
		vmpage = vio->u.fault.ft_vmpage;
		if (result != 0 && vmpage) {
		if (result != 0 && vmpage) {
Loading