Commit 6973cd73 authored by Oleg Drokin's avatar Oleg Drokin Committed by Greg Kroah-Hartman
Browse files

staging/lustre/obdecho: Remove unused ioctls



Remove long unused ECHO_IOC_GET_STRIPE, ECHO_IOC_SET_STRIPE,
ECHO_IOC_ENQUEUE and ECHO_IOC_CANCEL ioctls.

Signed-off-by: default avatarJohn L. Hammond <john.hammond@intel.com>
Signed-off-by: default avatarOleg Drokin <green@linuxhacker.ru>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent ee11f922
Loading
Loading
Loading
Loading
+4 −4
Original line number Diff line number Diff line
@@ -365,10 +365,10 @@ static inline void obd_ioctl_freedata(char *buf, int len)
/* OBD_IOC_LLOG_CATINFO is deprecated */
#define OBD_IOC_LLOG_CATINFO	   _IOWR('f', 196, OBD_IOC_DATA_TYPE)

#define ECHO_IOC_GET_STRIPE	    _IOWR('f', 200, OBD_IOC_DATA_TYPE)
#define ECHO_IOC_SET_STRIPE	    _IOWR('f', 201, OBD_IOC_DATA_TYPE)
#define ECHO_IOC_ENQUEUE	       _IOWR('f', 202, OBD_IOC_DATA_TYPE)
#define ECHO_IOC_CANCEL		_IOWR('f', 203, OBD_IOC_DATA_TYPE)
/*	#define ECHO_IOC_GET_STRIPE    _IOWR('f', 200, OBD_IOC_DATA_TYPE) */
/*	#define ECHO_IOC_SET_STRIPE    _IOWR('f', 201, OBD_IOC_DATA_TYPE) */
/*	#define ECHO_IOC_ENQUEUE       _IOWR('f', 202, OBD_IOC_DATA_TYPE) */
/*	#define ECHO_IOC_CANCEL        _IOWR('f', 203, OBD_IOC_DATA_TYPE) */

#define OBD_IOC_GET_OBJ_VERSION	_IOR('f', 210, OBD_IOC_DATA_TYPE)

+0 −163
Original line number Diff line number Diff line
@@ -162,9 +162,6 @@ struct echo_object_conf *cl2echo_conf(const struct cl_object_conf *c)
static struct echo_object *cl_echo_object_find(struct echo_device *d,
					       struct lov_stripe_md **lsm);
static int cl_echo_object_put(struct echo_object *eco);
static int cl_echo_enqueue(struct echo_object *eco, u64 start,
			   u64 end, int mode, __u64 *cookie);
static int cl_echo_cancel(struct echo_device *d, __u64 cookie);
static int cl_echo_object_brw(struct echo_object *eco, int rw, u64 offset,
			      struct page **pages, int npages, int async);

@@ -1076,36 +1073,6 @@ static int cl_echo_enqueue0(struct lu_env *env, struct echo_object *eco,
	return rc;
}

static int cl_echo_enqueue(struct echo_object *eco, u64 start, u64 end,
			   int mode, __u64 *cookie)
{
	struct echo_thread_info *info;
	struct lu_env *env;
	struct cl_io *io;
	int refcheck;
	int result;

	env = cl_env_get(&refcheck);
	if (IS_ERR(env))
		return PTR_ERR(env);

	info = echo_env_info(env);
	io = &info->eti_io;

	io->ci_ignore_layout = 1;
	result = cl_io_init(env, io, CIT_MISC, echo_obj2cl(eco));
	if (result < 0)
		goto out;
	LASSERT(result == 0);

	result = cl_echo_enqueue0(env, eco, start, end, mode, cookie, 0);
	cl_io_fini(env, io);

out:
	cl_env_put(env, &refcheck);
	return result;
}

static int cl_echo_cancel0(struct lu_env *env, struct echo_device *ed,
			   __u64 cookie)
{
@@ -1137,22 +1104,6 @@ static int cl_echo_cancel0(struct lu_env *env, struct echo_device *ed,
	return 0;
}

static int cl_echo_cancel(struct echo_device *ed, __u64 cookie)
{
	struct lu_env *env;
	int refcheck;
	int rc;

	env = cl_env_get(&refcheck);
	if (IS_ERR(env))
		return PTR_ERR(env);

	rc = cl_echo_cancel0(env, ed, cookie);

	cl_env_put(env, &refcheck);
	return rc;
}

static int cl_echo_async_brw(const struct lu_env *env, struct cl_io *io,
			     enum cl_req_type unused, struct cl_2queue *queue)
{
@@ -1268,29 +1219,6 @@ static int cl_echo_object_brw(struct echo_object *eco, int rw, u64 offset,

static u64 last_object_id;

static int
echo_copyout_lsm(struct lov_stripe_md *lsm, void *_ulsm, int ulsm_nob)
{
	struct lov_stripe_md *ulsm = _ulsm;
	struct lov_oinfo **p;
	int nob, i;

	nob = offsetof(struct lov_stripe_md, lsm_oinfo[lsm->lsm_stripe_count]);
	if (nob > ulsm_nob)
		return -EINVAL;

	if (copy_to_user(ulsm, lsm, sizeof(*ulsm)))
		return -EFAULT;

	for (i = 0, p = lsm->lsm_oinfo; i < lsm->lsm_stripe_count; i++, p++) {
		struct lov_oinfo __user *up;
		if (get_user(up, ulsm->lsm_oinfo + i) ||
		    copy_to_user(up, *p, sizeof(struct lov_oinfo)))
			return -EFAULT;
	}
	return 0;
}

static int
echo_copyin_lsm(struct echo_device *ed, struct lov_stripe_md *lsm,
		struct lov_stripe_md __user *ulsm, int ulsm_nob)
@@ -1804,53 +1732,6 @@ static int echo_client_brw_ioctl(const struct lu_env *env, int rw,
	return rc;
}

static int
echo_client_enqueue(struct obd_export *exp, struct obdo *oa,
		    int mode, u64 offset, u64 nob)
{
	struct echo_device     *ed = obd2echo_dev(exp->exp_obd);
	struct lustre_handle   *ulh = &oa->o_handle;
	struct echo_object     *eco;
	u64		 end;
	int		     rc;

	if (ed->ed_next == NULL)
		return -EOPNOTSUPP;

	if (!(mode == LCK_PR || mode == LCK_PW))
		return -EINVAL;

	if ((offset & (~CFS_PAGE_MASK)) != 0 ||
	    (nob & (~CFS_PAGE_MASK)) != 0)
		return -EINVAL;

	rc = echo_get_object(&eco, ed, oa);
	if (rc != 0)
		return rc;

	end = (nob == 0) ? ((u64) -1) : (offset + nob - 1);
	rc = cl_echo_enqueue(eco, offset, end, mode, &ulh->cookie);
	if (rc == 0) {
		oa->o_valid |= OBD_MD_FLHANDLE;
		CDEBUG(D_INFO, "Cookie is %#llx\n", ulh->cookie);
	}
	echo_put_object(eco);
	return rc;
}

static int
echo_client_cancel(struct obd_export *exp, struct obdo *oa)
{
	struct echo_device *ed     = obd2echo_dev(exp->exp_obd);
	__u64	       cookie = oa->o_handle.cookie;

	if ((oa->o_valid & OBD_MD_FLHANDLE) == 0)
		return -EINVAL;

	CDEBUG(D_INFO, "Cookie is %#llx\n", cookie);
	return cl_echo_cancel(ed, cookie);
}

static int
echo_client_iocontrol(unsigned int cmd, struct obd_export *exp, int len,
		      void *karg, void *uarg)
@@ -1961,50 +1842,6 @@ echo_client_iocontrol(unsigned int cmd, struct obd_export *exp, int len,
		rc = echo_client_brw_ioctl(env, rw, exp, data, &dummy_oti);
		goto out;

	case ECHO_IOC_GET_STRIPE:
		rc = echo_get_object(&eco, ed, oa);
		if (rc == 0) {
			rc = echo_copyout_lsm(eco->eo_lsm, data->ioc_pbuf1,
					      data->ioc_plen1);
			echo_put_object(eco);
		}
		goto out;

	case ECHO_IOC_SET_STRIPE:
		if (!capable(CFS_CAP_SYS_ADMIN)) {
			rc = -EPERM;
			goto out;
		}

		if (data->ioc_pbuf1 == NULL) {  /* unset */
			rc = echo_get_object(&eco, ed, oa);
			if (rc == 0) {
				eco->eo_deleted = 1;
				echo_put_object(eco);
			}
		} else {
			rc = echo_create_object(env, ed, 0, oa,
						data->ioc_pbuf1,
						data->ioc_plen1, &dummy_oti);
		}
		goto out;

	case ECHO_IOC_ENQUEUE:
		if (!capable(CFS_CAP_SYS_ADMIN)) {
			rc = -EPERM;
			goto out;
		}

		rc = echo_client_enqueue(exp, oa,
					 data->ioc_conn1, /* lock mode */
					 data->ioc_offset,
					 data->ioc_count);/*extent*/
		goto out;

	case ECHO_IOC_CANCEL:
		rc = echo_client_cancel(exp, oa);
		goto out;

	default:
		CERROR("echo_ioctl(): unrecognised ioctl %#x\n", cmd);
		rc = -ENOTTY;