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

staging: lustre: obd: rename obd_unpackmd() to md_unpackmd()



obd_unpackmd() is only implemented by LMV so move it from OBD
operations to OBD MD operations and update the prototype to reflex
the actual usage. Remove the unused function obd_free_memmd().

Signed-off-by: default avatarJohn L. Hammond <john.hammond@intel.com>
Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-5814


Signed-off-by: default avatarJinshan Xiong <jinshan.xiong@intel.com>
Reviewed-on: http://review.whamcloud.com/13737


Reviewed-by: default avatarJames Simmons <uja.ornl@yahoo.com>
Reviewed-by: default avatarAndreas Dilger <andreas.dilger@intel.com>
Signed-off-by: default avatarJames Simmons <jsimmons@infradead.org>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 6a9b2c92
Loading
Loading
Loading
Loading
+1 −12
Original line number Diff line number Diff line
@@ -76,18 +76,7 @@ lsm_md_eq(const struct lmv_stripe_md *lsm1, const struct lmv_stripe_md *lsm2)

union lmv_mds_md;

int lmv_unpack_md(struct obd_export *exp, struct lmv_stripe_md **lsmp,
		  const union lmv_mds_md *lmm, int stripe_count);

static inline int lmv_alloc_memmd(struct lmv_stripe_md **lsmp, int stripe_count)
{
	return lmv_unpack_md(NULL, lsmp, NULL, stripe_count);
}

static inline void lmv_free_memmd(struct lmv_stripe_md *lsm)
{
	lmv_unpack_md(NULL, &lsm, NULL, 0);
}
void lmv_free_memmd(struct lmv_stripe_md *lsm);

static inline void lmv1_le_to_cpu(struct lmv_mds_md_v1 *lmv_dst,
				  const struct lmv_mds_md_v1 *lmv_src)
+2 −3
Original line number Diff line number Diff line
@@ -784,9 +784,6 @@ struct obd_ops {
		      struct obd_statfs *osfs, __u64 max_age, __u32 flags);
	int (*statfs_async)(struct obd_export *exp, struct obd_info *oinfo,
			    __u64 max_age, struct ptlrpc_request_set *set);
	int (*unpackmd)(struct obd_export *exp,
			struct lov_stripe_md **mem_tgt,
			struct lov_mds_md *disk_src, int disk_len);
	int (*create)(const struct lu_env *env, struct obd_export *exp,
		      struct obdo *oa);
	int (*destroy)(const struct lu_env *env, struct obd_export *exp,
@@ -954,6 +951,8 @@ struct md_ops {
	int (*revalidate_lock)(struct obd_export *, struct lookup_intent *,
			       struct lu_fid *, __u64 *bits);

	int (*unpackmd)(struct obd_export *exp, struct lmv_stripe_md **plsm,
			const union lmv_mds_md *lmv, size_t lmv_size);
	/*
	 * NOTE: If adding ops, add another LPROCFS_MD_OP_INIT() line to
	 * lprocfs_alloc_md_stats() in obdclass/lprocfs_status.c. Also, add a
+18 −33
Original line number Diff line number Diff line
@@ -609,39 +609,6 @@ obd_process_config(struct obd_device *obd, int datalen, void *data)
	return rc;
}

/* Unpack an MD struct from disk to in-memory format.
 * Returns +ve size of unpacked MD (0 for free), or -ve error.
 *
 * If @mem_tgt == NULL, MD size is returned (max size if @disk_src == NULL).
 * If @*mem_tgt != NULL and @disk_src == NULL, @*mem_tgt will be freed.
 * If @*mem_tgt == NULL, it will be allocated
 */
static inline int obd_unpackmd(struct obd_export *exp,
			       struct lov_stripe_md **mem_tgt,
			       struct lov_mds_md *disk_src,
			       int disk_len)
{
	int rc;

	EXP_CHECK_DT_OP(exp, unpackmd);
	EXP_COUNTER_INCREMENT(exp, unpackmd);

	rc = OBP(exp->exp_obd, unpackmd)(exp, mem_tgt, disk_src, disk_len);
	return rc;
}

static inline int obd_free_memmd(struct obd_export *exp,
				 struct lov_stripe_md **mem_tgt)
{
	int rc;

	LASSERT(mem_tgt);
	LASSERT(*mem_tgt);
	rc = obd_unpackmd(exp, mem_tgt, NULL, 0);
	*mem_tgt = NULL;
	return rc;
}

static inline int obd_create(const struct lu_env *env, struct obd_export *exp,
			     struct obdo *obdo)
{
@@ -1507,6 +1474,24 @@ static inline int md_get_fid_from_lsm(struct obd_export *exp,
	return rc;
}

/* Unpack an MD struct from disk to in-memory format.
 * Returns +ve size of unpacked MD (0 for free), or -ve error.
 *
 * If *plsm != NULL and lmm == NULL then *lsm will be freed.
 * If *plsm == NULL then it will be allocated.
 */
static inline int md_unpackmd(struct obd_export *exp,
			      struct lmv_stripe_md **plsm,
			      const union lmv_mds_md *lmm, size_t lmm_size)
{
	int rc;

	EXP_CHECK_MD_OP(exp, unpackmd);
	EXP_MD_COUNTER_INCREMENT(exp, unpackmd);
	rc = MDP(exp->exp_obd, unpackmd)(exp, plsm, lmm, lmm_size);
	return rc;
}

/* OBD Metadata Support */

int obd_init_caches(void);
+0 −3
Original line number Diff line number Diff line
@@ -54,9 +54,6 @@ int __lmv_fid_alloc(struct lmv_obd *lmv, struct lu_fid *fid, u32 mds);
int lmv_fid_alloc(const struct lu_env *env, struct obd_export *exp,
		  struct lu_fid *fid, struct md_op_data *op_data);

int lmv_unpack_md(struct obd_export *exp, struct lmv_stripe_md **lsmp,
		  const union lmv_mds_md *lmm, int stripe_count);

int lmv_revalidate_slaves(struct obd_export *exp,
			  const struct lmv_stripe_md *lsm,
			  ldlm_blocking_callback cb_blocking,
+6 −19
Original line number Diff line number Diff line
@@ -2804,8 +2804,8 @@ static int lmv_unpack_md_v1(struct obd_export *exp, struct lmv_stripe_md *lsm,
	return rc;
}

int lmv_unpack_md(struct obd_export *exp, struct lmv_stripe_md **lsmp,
		  const union lmv_mds_md *lmm, int stripe_count)
static int lmv_unpackmd(struct obd_export *exp, struct lmv_stripe_md **lsmp,
			const union lmv_mds_md *lmm, size_t lmm_size)
{
	struct lmv_stripe_md *lsm;
	bool allocated = false;
@@ -2834,17 +2834,6 @@ int lmv_unpack_md(struct obd_export *exp, struct lmv_stripe_md **lsmp,
		return 0;
	}

	/* Alloc memmd */
	if (!lsm && !lmm) {
		lsm_size = lmv_stripe_md_size(stripe_count);
		lsm = libcfs_kvzalloc(lsm_size, GFP_NOFS);
		if (!lsm)
			return -ENOMEM;
		lsm->lsm_md_stripe_count = stripe_count;
		*lsmp = lsm;
		return 0;
	}

	if (le32_to_cpu(lmm->lmv_magic) == LMV_MAGIC_STRIPE)
		return -EPERM;

@@ -2892,14 +2881,12 @@ int lmv_unpack_md(struct obd_export *exp, struct lmv_stripe_md **lsmp,
	}
	return lsm_size;
}
EXPORT_SYMBOL(lmv_unpack_md);

static int lmv_unpackmd(struct obd_export *exp, struct lov_stripe_md **lsmp,
			struct lov_mds_md *lmm, int disk_len)
void lmv_free_memmd(struct lmv_stripe_md *lsm)
{
	return lmv_unpack_md(exp, (struct lmv_stripe_md **)lsmp,
			     (union lmv_mds_md *)lmm, disk_len);
	lmv_unpackmd(NULL, &lsm, NULL, 0);
}
EXPORT_SYMBOL(lmv_free_memmd);

static int lmv_cancel_unused(struct obd_export *exp, const struct lu_fid *fid,
			     ldlm_policy_data_t *policy, enum ldlm_mode mode,
@@ -3204,7 +3191,6 @@ static struct obd_ops lmv_obd_ops = {
	.statfs		= lmv_statfs,
	.get_info	= lmv_get_info,
	.set_info_async	= lmv_set_info_async,
	.unpackmd	= lmv_unpackmd,
	.notify		= lmv_notify,
	.get_uuid	= lmv_get_uuid,
	.iocontrol	= lmv_iocontrol,
@@ -3240,6 +3226,7 @@ static struct md_ops lmv_md_ops = {
	.intent_getattr_async	= lmv_intent_getattr_async,
	.revalidate_lock	= lmv_revalidate_lock,
	.get_fid_from_lsm	= lmv_get_fid_from_lsm,
	.unpackmd		= lmv_unpackmd,
};

static int __init lmv_init(void)
Loading