All the mail mirrored from lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 00/12] staging/lustre: yet more dead code removal
@ 2014-09-05 20:08 John L. Hammond
  2014-09-05 20:08 ` [PATCH 01/12] staging/lustre/lov: remove unused OBD methods John L. Hammond
                   ` (11 more replies)
  0 siblings, 12 replies; 13+ messages in thread
From: John L. Hammond @ 2014-09-05 20:08 UTC (permalink / raw
  To: greg, andreas.dilger, oleg.drokin; +Cc: linux-kernel, John L. Hammond

From: "John L. Hammond" <john.hammond@intel.com>

Howdy,

This series yet removes more dead and obsolete code from drivers/staging/lustre
in the form of methods from struct obd_ops and server specific llog handling.

John L. Hammond (12):
  staging/lustre/lov: remove unused OBD methods
  staging/lustre/osc: remove unused OBD methods
  staging/lustre/osc: remove obsolete llog handling code
  staging/lustre: remove obd_ost.h
  staging/lustre/mdc: remove unused OBD methods
  staging/lustre/mdc: inline llog methods
  staging/lustre/mgc: inline mgc_cancel()
  staging/lustre: remove unused OBD methods
  staging/lustre/mgc: remove server specific llog handling
  staging/lustre/ptlrpc: remove sptlrpc_conf_target_get_rules()
  staging/lustre/obdclass: remove llog_ioctl.c
  staging/lustre/obdclass: remove local_storage.[ch]

 .../staging/lustre/lustre/include/lustre_lite.h    |    1 -
 drivers/staging/lustre/lustre/include/lustre_log.h |   10 -
 drivers/staging/lustre/lustre/include/lustre_sec.h |    3 -
 drivers/staging/lustre/lustre/include/obd.h        |   47 -
 drivers/staging/lustre/lustre/include/obd_class.h  |  279 ------
 drivers/staging/lustre/lustre/include/obd_ost.h    |  100 ---
 drivers/staging/lustre/lustre/lov/lov_internal.h   |   45 -
 drivers/staging/lustre/lustre/lov/lov_merge.c      |   27 -
 drivers/staging/lustre/lustre/lov/lov_obd.c        |  531 ------------
 drivers/staging/lustre/lustre/lov/lov_pack.c       |  172 ----
 drivers/staging/lustre/lustre/lov/lov_request.c    |  784 -----------------
 drivers/staging/lustre/lustre/mdc/mdc_request.c    |  157 +---
 drivers/staging/lustre/lustre/mgc/mgc_request.c    |  101 +--
 drivers/staging/lustre/lustre/obdclass/Makefile    |    4 +-
 drivers/staging/lustre/lustre/obdclass/debug.c     |    1 -
 drivers/staging/lustre/lustre/obdclass/genops.c    |    1 -
 .../staging/lustre/lustre/obdclass/llog_ioctl.c    |  418 ---------
 drivers/staging/lustre/lustre/obdclass/llog_obd.c  |   25 -
 .../staging/lustre/lustre/obdclass/local_storage.c |  894 --------------------
 .../staging/lustre/lustre/obdclass/local_storage.h |   91 --
 .../lustre/lustre/obdclass/lprocfs_status.c        |   20 -
 .../staging/lustre/lustre/osc/osc_cl_internal.h    |    1 -
 drivers/staging/lustre/lustre/osc/osc_quota.c      |    2 +-
 drivers/staging/lustre/lustre/osc/osc_request.c    |  401 +--------
 drivers/staging/lustre/lustre/ptlrpc/recover.c     |    1 -
 drivers/staging/lustre/lustre/ptlrpc/sec_config.c  |  327 -------
 26 files changed, 82 insertions(+), 4361 deletions(-)
 delete mode 100644 drivers/staging/lustre/lustre/include/obd_ost.h
 delete mode 100644 drivers/staging/lustre/lustre/obdclass/llog_ioctl.c
 delete mode 100644 drivers/staging/lustre/lustre/obdclass/local_storage.c
 delete mode 100644 drivers/staging/lustre/lustre/obdclass/local_storage.h

-- 
1.7.9.5


^ permalink raw reply	[flat|nested] 13+ messages in thread

* [PATCH 01/12] staging/lustre/lov: remove unused OBD methods
  2014-09-05 20:08 [PATCH 00/12] staging/lustre: yet more dead code removal John L. Hammond
@ 2014-09-05 20:08 ` John L. Hammond
  2014-09-05 20:08 ` [PATCH 02/12] staging/lustre/osc: " John L. Hammond
                   ` (10 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: John L. Hammond @ 2014-09-05 20:08 UTC (permalink / raw
  To: greg, andreas.dilger, oleg.drokin; +Cc: linux-kernel, John L. Hammond

From: "John L. Hammond" <john.hammond@intel.com>

Remove the unused OBD device methods:
    lov_brw()
    lov_cancel()
    lov_cancel_unused()
    lov_change_cbdata()
    lov_enqueue()
    lov_extent_calc()
    lov_getattr()
    lov_merge_lvb()
    lov_punch()
    lov_setattr()
    lov_sync()
and their supporting functions.

In lov_iocontrol() remove the unused cases LL_IOC_LOV_SETSTRIPE and
LL_IOC_LOV_SETEA and their supporting functions.

Signed-off-by: John L. Hammond <john.hammond@intel.com>
---
 drivers/staging/lustre/lustre/lov/lov_internal.h |   45 --
 drivers/staging/lustre/lustre/lov/lov_merge.c    |   27 -
 drivers/staging/lustre/lustre/lov/lov_obd.c      |  530 ---------------
 drivers/staging/lustre/lustre/lov/lov_pack.c     |  172 -----
 drivers/staging/lustre/lustre/lov/lov_request.c  |  783 ----------------------
 5 files changed, 1557 deletions(-)

diff --git a/drivers/staging/lustre/lustre/lov/lov_internal.h b/drivers/staging/lustre/lustre/lov/lov_internal.h
index c61db3a..8c8508b 100644
--- a/drivers/staging/lustre/lustre/lov/lov_internal.h
+++ b/drivers/staging/lustre/lustre/lov/lov_internal.h
@@ -168,8 +168,6 @@ static inline void lov_llh_put(struct lov_lock_handles *llh)
 /* lov_merge.c */
 void lov_merge_attrs(struct obdo *tgt, struct obdo *src, u64 valid,
 		     struct lov_stripe_md *lsm, int stripeno, int *set);
-int lov_merge_lvb(struct obd_export *exp, struct lov_stripe_md *lsm,
-		  struct ost_lvb *lvb, int kms_only);
 int lov_adjust_kms(struct obd_export *exp, struct lov_stripe_md *lsm,
 		   u64 size, int shrink);
 int lov_merge_lvb_kms(struct lov_stripe_md *lsm,
@@ -207,17 +205,6 @@ void lov_update_set(struct lov_request_set *set,
 int lov_update_common_set(struct lov_request_set *set,
 			  struct lov_request *req, int rc);
 int lov_check_and_wait_active(struct lov_obd *lov, int ost_idx);
-int lov_prep_create_set(struct obd_export *exp, struct obd_info *oifo,
-			struct lov_stripe_md **ea, struct obdo *src_oa,
-			struct obd_trans_info *oti,
-			struct lov_request_set **reqset);
-int cb_create_update(void *cookie, int rc);
-int lov_fini_create_set(struct lov_request_set *set, struct lov_stripe_md **ea);
-int lov_prep_brw_set(struct obd_export *exp, struct obd_info *oinfo,
-		     u32 oa_bufs, struct brw_page *pga,
-		     struct obd_trans_info *oti,
-		     struct lov_request_set **reqset);
-int lov_fini_brw_set(struct lov_request_set *set);
 int lov_prep_getattr_set(struct obd_export *exp, struct obd_info *oinfo,
 			 struct lov_request_set **reqset);
 int lov_fini_getattr_set(struct lov_request_set *set);
@@ -225,8 +212,6 @@ int lov_prep_destroy_set(struct obd_export *exp, struct obd_info *oinfo,
 			 struct obdo *src_oa, struct lov_stripe_md *lsm,
 			 struct obd_trans_info *oti,
 			 struct lov_request_set **reqset);
-int lov_update_destroy_set(struct lov_request_set *set,
-			   struct lov_request *req, int rc);
 int lov_fini_destroy_set(struct lov_request_set *set);
 int lov_prep_setattr_set(struct obd_export *exp, struct obd_info *oinfo,
 			 struct obd_trans_info *oti,
@@ -234,30 +219,6 @@ int lov_prep_setattr_set(struct obd_export *exp, struct obd_info *oinfo,
 int lov_update_setattr_set(struct lov_request_set *set,
 			   struct lov_request *req, int rc);
 int lov_fini_setattr_set(struct lov_request_set *set);
-int lov_prep_punch_set(struct obd_export *exp, struct obd_info *oinfo,
-		       struct obd_trans_info *oti,
-		       struct lov_request_set **reqset);
-int lov_fini_punch_set(struct lov_request_set *set);
-int lov_prep_sync_set(struct obd_export *exp, struct obd_info *obd_info,
-		      u64 start, u64 end,
-		      struct lov_request_set **reqset);
-int lov_fini_sync_set(struct lov_request_set *set);
-int lov_prep_enqueue_set(struct obd_export *exp, struct obd_info *oinfo,
-			 struct ldlm_enqueue_info *einfo,
-			 struct lov_request_set **reqset);
-int lov_fini_enqueue_set(struct lov_request_set *set, __u32 mode, int rc,
-			 struct ptlrpc_request_set *rqset);
-int lov_prep_match_set(struct obd_export *exp, struct obd_info *oinfo,
-		       struct lov_stripe_md *lsm,
-		       ldlm_policy_data_t *policy, __u32 mode,
-		       struct lustre_handle *lockh,
-		       struct lov_request_set **reqset);
-int lov_fini_match_set(struct lov_request_set *set, __u32 mode, __u64 flags);
-int lov_prep_cancel_set(struct obd_export *exp, struct obd_info *oinfo,
-			struct lov_stripe_md *lsm,
-			__u32 mode, struct lustre_handle *lockh,
-			struct lov_request_set **reqset);
-int lov_fini_cancel_set(struct lov_request_set *set);
 int lov_prep_statfs_set(struct obd_device *obd, struct obd_info *oinfo,
 			struct lov_request_set **reqset);
 void lov_update_statfs(struct obd_statfs *osfs, struct obd_statfs *lov_sfs,
@@ -287,10 +248,6 @@ int lov_packmd(struct obd_export *exp, struct lov_mds_md **lmm,
 	       struct lov_stripe_md *lsm);
 int lov_unpackmd(struct obd_export *exp, struct lov_stripe_md **lsmp,
 		 struct lov_mds_md *lmm, int lmm_bytes);
-int lov_setstripe(struct obd_export *exp, int max_lmm_size,
-		  struct lov_stripe_md **lsmp, struct lov_user_md *lump);
-int lov_setea(struct obd_export *exp, struct lov_stripe_md **lsmp,
-	      struct lov_user_md *lump);
 int lov_getstripe(struct obd_export *exp,
 		  struct lov_stripe_md *lsm, struct lov_user_md *lump);
 int lov_alloc_memmd(struct lov_stripe_md **lsmp, __u16 stripe_count,
@@ -307,8 +264,6 @@ struct lov_stripe_md *lsm_alloc_plain(__u16 stripe_count, int *size);
 void lsm_free_plain(struct lov_stripe_md *lsm);
 void dump_lsm(unsigned int level, const struct lov_stripe_md *lsm);
 
-int lovea_destroy_object(struct lov_obd *lov, struct lov_stripe_md *lsm,
-			 struct obdo *oa, void *data);
 /* lproc_lov.c */
 #if defined (CONFIG_PROC_FS)
 extern const struct file_operations lov_proc_target_fops;
diff --git a/drivers/staging/lustre/lustre/lov/lov_merge.c b/drivers/staging/lustre/lustre/lov/lov_merge.c
index 15ebb5d..b7e7bfa 100644
--- a/drivers/staging/lustre/lustre/lov/lov_merge.c
+++ b/drivers/staging/lustre/lustre/lov/lov_merge.c
@@ -109,33 +109,6 @@ int lov_merge_lvb_kms(struct lov_stripe_md *lsm,
 	return rc;
 }
 
-/** Merge the lock value block(&lvb) attributes from each of the stripes in a
- * file into a single lvb. It is expected that the caller initializes the
- * current atime, mtime, ctime to avoid regressing a more uptodate time on
- * the local client.
- *
- * If \a kms_only is set then we do not consider the recently seen size (rss)
- * when updating the known minimum size (kms).  Even when merging RSS, we will
- * take the KMS value if it's larger.  This prevents getattr from stomping on
- * dirty cached pages which extend the file size. */
-int lov_merge_lvb(struct obd_export *exp,
-		  struct lov_stripe_md *lsm, struct ost_lvb *lvb, int kms_only)
-{
-	int   rc;
-	__u64 kms;
-
-	lov_stripe_lock(lsm);
-	rc = lov_merge_lvb_kms(lsm, lvb, &kms);
-	lov_stripe_unlock(lsm);
-	if (kms_only)
-		lvb->lvb_size = kms;
-
-	CDEBUG(D_INODE, "merged for ID "DOSTID" s=%llu m=%llu a=%llu c=%llu b=%llu\n",
-	       POSTID(&lsm->lsm_oi), lvb->lvb_size, lvb->lvb_mtime,
-	       lvb->lvb_atime, lvb->lvb_ctime, lvb->lvb_blocks);
-	return rc;
-}
-
 /* Must be called under the lov_stripe_lock() */
 int lov_adjust_kms(struct obd_export *exp, struct lov_stripe_md *lsm,
 		   u64 size, int shrink)
diff --git a/drivers/staging/lustre/lustre/lov/lov_obd.c b/drivers/staging/lustre/lustre/lov/lov_obd.c
index cb778df..a1f8c7e 100644
--- a/drivers/staging/lustre/lustre/lov/lov_obd.c
+++ b/drivers/staging/lustre/lustre/lov/lov_obd.c
@@ -1113,54 +1113,6 @@ out:
 	return rc ? rc : err;
 }
 
-static int lov_getattr(const struct lu_env *env, struct obd_export *exp,
-		       struct obd_info *oinfo)
-{
-	struct lov_request_set *set;
-	struct lov_request *req;
-	struct list_head *pos;
-	struct lov_obd *lov;
-	int err = 0, rc = 0;
-
-	LASSERT(oinfo);
-	ASSERT_LSM_MAGIC(oinfo->oi_md);
-
-	if (!exp || !exp->exp_obd)
-		return -ENODEV;
-
-	lov = &exp->exp_obd->u.lov;
-
-	rc = lov_prep_getattr_set(exp, oinfo, &set);
-	if (rc)
-		return rc;
-
-	list_for_each(pos, &set->set_list) {
-		req = list_entry(pos, struct lov_request, rq_link);
-
-		CDEBUG(D_INFO, "objid "DOSTID"[%d] has subobj "DOSTID" at idx"
-		       " %u\n", POSTID(&oinfo->oi_oa->o_oi), req->rq_stripe,
-		       POSTID(&req->rq_oi.oi_oa->o_oi), req->rq_idx);
-
-		rc = obd_getattr(env, lov->lov_tgts[req->rq_idx]->ltd_exp,
-				 &req->rq_oi);
-		err = lov_update_common_set(set, req, rc);
-		if (err) {
-			CERROR("%s: getattr objid "DOSTID" subobj "
-			       DOSTID" on OST idx %d: rc = %d\n",
-			       exp->exp_obd->obd_name,
-			       POSTID(&oinfo->oi_oa->o_oi),
-			       POSTID(&req->rq_oi.oi_oa->o_oi),
-			       req->rq_idx, err);
-			break;
-		}
-	}
-
-	rc = lov_fini_getattr_set(set);
-	if (err)
-		rc = err;
-	return rc;
-}
-
 static int lov_getattr_interpret(struct ptlrpc_request_set *rqset,
 				 void *data, int rc)
 {
@@ -1232,57 +1184,6 @@ out:
 	return rc ? rc : err;
 }
 
-static int lov_setattr(const struct lu_env *env, struct obd_export *exp,
-		       struct obd_info *oinfo, struct obd_trans_info *oti)
-{
-	struct lov_request_set *set;
-	struct lov_obd *lov;
-	struct list_head *pos;
-	struct lov_request *req;
-	int err = 0, rc = 0;
-
-	LASSERT(oinfo);
-	ASSERT_LSM_MAGIC(oinfo->oi_md);
-
-	if (!exp || !exp->exp_obd)
-		return -ENODEV;
-
-	/* for now, we only expect the following updates here */
-	LASSERT(!(oinfo->oi_oa->o_valid & ~(OBD_MD_FLID | OBD_MD_FLTYPE |
-					    OBD_MD_FLMODE | OBD_MD_FLATIME |
-					    OBD_MD_FLMTIME | OBD_MD_FLCTIME |
-					    OBD_MD_FLFLAGS | OBD_MD_FLSIZE |
-					    OBD_MD_FLGROUP | OBD_MD_FLUID |
-					    OBD_MD_FLGID | OBD_MD_FLFID |
-					    OBD_MD_FLGENER)));
-	lov = &exp->exp_obd->u.lov;
-	rc = lov_prep_setattr_set(exp, oinfo, oti, &set);
-	if (rc)
-		return rc;
-
-	list_for_each(pos, &set->set_list) {
-		req = list_entry(pos, struct lov_request, rq_link);
-
-		rc = obd_setattr(env, lov->lov_tgts[req->rq_idx]->ltd_exp,
-				 &req->rq_oi, NULL);
-		err = lov_update_setattr_set(set, req, rc);
-		if (err) {
-			CERROR("%s: setattr objid "DOSTID" subobj "
-			       DOSTID" on OST idx %d: rc = %d\n",
-			       exp->exp_obd->obd_name,
-			       POSTID(&set->set_oi->oi_oa->o_oi),
-			       POSTID(&req->rq_oi.oi_oa->o_oi), req->rq_idx,
-			       err);
-			if (!rc)
-				rc = err;
-		}
-	}
-	err = lov_fini_setattr_set(set);
-	if (!rc)
-		rc = err;
-	return rc;
-}
-
 static int lov_setattr_interpret(struct ptlrpc_request_set *rqset,
 				 void *data, int rc)
 {
@@ -1365,297 +1266,6 @@ static int lov_setattr_async(struct obd_export *exp, struct obd_info *oinfo,
 	return 0;
 }
 
-static int lov_punch_interpret(struct ptlrpc_request_set *rqset,
-			       void *data, int rc)
-{
-	struct lov_request_set *lovset = (struct lov_request_set *)data;
-	int err;
-
-	if (rc)
-		atomic_set(&lovset->set_completes, 0);
-	err = lov_fini_punch_set(lovset);
-	return rc ? rc : err;
-}
-
-/* FIXME: maybe we'll just make one node the authoritative attribute node, then
- * we can send this 'punch' to just the authoritative node and the nodes
- * that the punch will affect. */
-static int lov_punch(const struct lu_env *env, struct obd_export *exp,
-		     struct obd_info *oinfo, struct obd_trans_info *oti,
-		     struct ptlrpc_request_set *rqset)
-{
-	struct lov_request_set *set;
-	struct lov_obd *lov;
-	struct list_head *pos;
-	struct lov_request *req;
-	int rc = 0;
-
-	LASSERT(oinfo);
-	ASSERT_LSM_MAGIC(oinfo->oi_md);
-
-	if (!exp || !exp->exp_obd)
-		return -ENODEV;
-
-	lov = &exp->exp_obd->u.lov;
-	rc = lov_prep_punch_set(exp, oinfo, oti, &set);
-	if (rc)
-		return rc;
-
-	list_for_each(pos, &set->set_list) {
-		req = list_entry(pos, struct lov_request, rq_link);
-
-		rc = obd_punch(env, lov->lov_tgts[req->rq_idx]->ltd_exp,
-			       &req->rq_oi, NULL, rqset);
-		if (rc) {
-			CERROR("%s: punch objid "DOSTID" subobj "DOSTID
-			       " on OST idx %d: rc = %d\n",
-			       exp->exp_obd->obd_name,
-			       POSTID(&set->set_oi->oi_oa->o_oi),
-			       POSTID(&req->rq_oi.oi_oa->o_oi), req->rq_idx, rc);
-			break;
-		}
-	}
-
-	if (rc || list_empty(&rqset->set_requests)) {
-		int err;
-		err = lov_fini_punch_set(set);
-		return rc ? rc : err;
-	}
-
-	LASSERT(rqset->set_interpret == NULL);
-	rqset->set_interpret = lov_punch_interpret;
-	rqset->set_arg = (void *)set;
-
-	return 0;
-}
-
-static int lov_sync_interpret(struct ptlrpc_request_set *rqset,
-			      void *data, int rc)
-{
-	struct lov_request_set *lovset = data;
-	int err;
-
-	if (rc)
-		atomic_set(&lovset->set_completes, 0);
-	err = lov_fini_sync_set(lovset);
-	return rc ?: err;
-}
-
-static int lov_sync(const struct lu_env *env, struct obd_export *exp,
-		    struct obd_info *oinfo, u64 start, u64 end,
-		    struct ptlrpc_request_set *rqset)
-{
-	struct lov_request_set *set = NULL;
-	struct lov_obd *lov;
-	struct list_head *pos;
-	struct lov_request *req;
-	int rc = 0;
-
-	ASSERT_LSM_MAGIC(oinfo->oi_md);
-	LASSERT(rqset != NULL);
-
-	if (!exp->exp_obd)
-		return -ENODEV;
-
-	lov = &exp->exp_obd->u.lov;
-	rc = lov_prep_sync_set(exp, oinfo, start, end, &set);
-	if (rc)
-		return rc;
-
-	CDEBUG(D_INFO, "fsync objid "DOSTID" [%#llx, %#llx]\n",
-	       POSTID(&set->set_oi->oi_oa->o_oi), start, end);
-
-	list_for_each(pos, &set->set_list) {
-		req = list_entry(pos, struct lov_request, rq_link);
-
-		rc = obd_sync(env, lov->lov_tgts[req->rq_idx]->ltd_exp,
-			      &req->rq_oi, req->rq_oi.oi_policy.l_extent.start,
-			      req->rq_oi.oi_policy.l_extent.end, rqset);
-		if (rc) {
-			CERROR("%s: fsync objid "DOSTID" subobj "DOSTID
-			       " on OST idx %d: rc = %d\n",
-			       exp->exp_obd->obd_name,
-			       POSTID(&set->set_oi->oi_oa->o_oi),
-			       POSTID(&req->rq_oi.oi_oa->o_oi), req->rq_idx,
-			       rc);
-			break;
-		}
-	}
-
-	/* If we are not waiting for responses on async requests, return. */
-	if (rc || list_empty(&rqset->set_requests)) {
-		int err = lov_fini_sync_set(set);
-
-		return rc ?: err;
-	}
-
-	LASSERT(rqset->set_interpret == NULL);
-	rqset->set_interpret = lov_sync_interpret;
-	rqset->set_arg = (void *)set;
-
-	return 0;
-}
-
-static int lov_brw_check(struct lov_obd *lov, struct obd_info *lov_oinfo,
-			 u32 oa_bufs, struct brw_page *pga)
-{
-	struct obd_info oinfo = { { { 0 } } };
-	int i, rc = 0;
-
-	oinfo.oi_oa = lov_oinfo->oi_oa;
-
-	/* The caller just wants to know if there's a chance that this
-	 * I/O can succeed */
-	for (i = 0; i < oa_bufs; i++) {
-		int stripe = lov_stripe_number(lov_oinfo->oi_md, pga[i].off);
-		int ost = lov_oinfo->oi_md->lsm_oinfo[stripe]->loi_ost_idx;
-		u64 start, end;
-
-		if (!lov_stripe_intersects(lov_oinfo->oi_md, i, pga[i].off,
-					   pga[i].off + pga[i].count - 1,
-					   &start, &end))
-			continue;
-
-		if (!lov->lov_tgts[ost] || !lov->lov_tgts[ost]->ltd_active) {
-			CDEBUG(D_HA, "lov idx %d inactive\n", ost);
-			return -EIO;
-		}
-
-		rc = obd_brw(OBD_BRW_CHECK, lov->lov_tgts[ost]->ltd_exp, &oinfo,
-			     1, &pga[i], NULL);
-		if (rc)
-			break;
-	}
-	return rc;
-}
-
-static int lov_brw(int cmd, struct obd_export *exp, struct obd_info *oinfo,
-		   u32 oa_bufs, struct brw_page *pga,
-		   struct obd_trans_info *oti)
-{
-	struct lov_request_set *set;
-	struct lov_request *req;
-	struct list_head *pos;
-	struct lov_obd *lov = &exp->exp_obd->u.lov;
-	int err, rc = 0;
-
-	ASSERT_LSM_MAGIC(oinfo->oi_md);
-
-	if (cmd == OBD_BRW_CHECK) {
-		rc = lov_brw_check(lov, oinfo, oa_bufs, pga);
-		return rc;
-	}
-
-	rc = lov_prep_brw_set(exp, oinfo, oa_bufs, pga, oti, &set);
-	if (rc)
-		return rc;
-
-	list_for_each(pos, &set->set_list) {
-		struct obd_export *sub_exp;
-		struct brw_page *sub_pga;
-		req = list_entry(pos, struct lov_request, rq_link);
-
-		sub_exp = lov->lov_tgts[req->rq_idx]->ltd_exp;
-		sub_pga = set->set_pga + req->rq_pgaidx;
-		rc = obd_brw(cmd, sub_exp, &req->rq_oi, req->rq_oabufs,
-			     sub_pga, oti);
-		if (rc)
-			break;
-		lov_update_common_set(set, req, rc);
-	}
-
-	err = lov_fini_brw_set(set);
-	if (!rc)
-		rc = err;
-	return rc;
-}
-
-static int lov_enqueue_interpret(struct ptlrpc_request_set *rqset,
-				 void *data, int rc)
-{
-	struct lov_request_set *lovset = (struct lov_request_set *)data;
-
-	rc = lov_fini_enqueue_set(lovset, lovset->set_ei->ei_mode, rc, rqset);
-	return rc;
-}
-
-static int lov_enqueue(struct obd_export *exp, struct obd_info *oinfo,
-		       struct ldlm_enqueue_info *einfo,
-		       struct ptlrpc_request_set *rqset)
-{
-	ldlm_mode_t mode = einfo->ei_mode;
-	struct lov_request_set *set;
-	struct lov_request *req;
-	struct list_head *pos;
-	struct lov_obd *lov;
-	ldlm_error_t rc;
-
-	LASSERT(oinfo);
-	ASSERT_LSM_MAGIC(oinfo->oi_md);
-	LASSERT(mode == (mode & -mode));
-
-	/* we should never be asked to replay a lock this way. */
-	LASSERT((oinfo->oi_flags & LDLM_FL_REPLAY) == 0);
-
-	if (!exp || !exp->exp_obd)
-		return -ENODEV;
-
-	lov = &exp->exp_obd->u.lov;
-	rc = lov_prep_enqueue_set(exp, oinfo, einfo, &set);
-	if (rc)
-		return rc;
-
-	list_for_each(pos, &set->set_list) {
-		req = list_entry(pos, struct lov_request, rq_link);
-
-		rc = obd_enqueue(lov->lov_tgts[req->rq_idx]->ltd_exp,
-				 &req->rq_oi, einfo, rqset);
-		if (rc != ELDLM_OK)
-			GOTO(out, rc);
-	}
-
-	if (rqset && !list_empty(&rqset->set_requests)) {
-		LASSERT(rc == 0);
-		LASSERT(rqset->set_interpret == NULL);
-		rqset->set_interpret = lov_enqueue_interpret;
-		rqset->set_arg = (void *)set;
-		return rc;
-	}
-out:
-	rc = lov_fini_enqueue_set(set, mode, rc, rqset);
-	return rc;
-}
-
-static int lov_change_cbdata(struct obd_export *exp,
-			     struct lov_stripe_md *lsm, ldlm_iterator_t it,
-			     void *data)
-{
-	struct lov_obd *lov;
-	int rc = 0, i;
-
-	ASSERT_LSM_MAGIC(lsm);
-
-	if (!exp || !exp->exp_obd)
-		return -ENODEV;
-
-	lov = &exp->exp_obd->u.lov;
-	for (i = 0; i < lsm->lsm_stripe_count; i++) {
-		struct lov_stripe_md submd;
-		struct lov_oinfo *loi = lsm->lsm_oinfo[i];
-
-		if (!lov->lov_tgts[loi->loi_ost_idx]) {
-			CDEBUG(D_HA, "lov idx %d NULL \n", loi->loi_ost_idx);
-			continue;
-		}
-
-		submd.lsm_oi = loi->loi_oi;
-		submd.lsm_stripe_count = 0;
-		rc = obd_change_cbdata(lov->lov_tgts[loi->loi_ost_idx]->ltd_exp,
-				       &submd, it, data);
-	}
-	return rc;
-}
-
 /* find any ldlm lock of the inode in lov
  * return 0    not find
  *	1    find one
@@ -1691,106 +1301,6 @@ static int lov_find_cbdata(struct obd_export *exp,
 	return rc;
 }
 
-static int lov_cancel(struct obd_export *exp, struct lov_stripe_md *lsm,
-		      __u32 mode, struct lustre_handle *lockh)
-{
-	struct lov_request_set *set;
-	struct obd_info oinfo;
-	struct lov_request *req;
-	struct list_head *pos;
-	struct lov_obd *lov;
-	struct lustre_handle *lov_lockhp;
-	int err = 0, rc = 0;
-
-	ASSERT_LSM_MAGIC(lsm);
-
-	if (!exp || !exp->exp_obd)
-		return -ENODEV;
-
-	LASSERT(lockh);
-	lov = &exp->exp_obd->u.lov;
-	rc = lov_prep_cancel_set(exp, &oinfo, lsm, mode, lockh, &set);
-	if (rc)
-		return rc;
-
-	list_for_each(pos, &set->set_list) {
-		req = list_entry(pos, struct lov_request, rq_link);
-		lov_lockhp = set->set_lockh->llh_handles + req->rq_stripe;
-
-		rc = obd_cancel(lov->lov_tgts[req->rq_idx]->ltd_exp,
-				req->rq_oi.oi_md, mode, lov_lockhp);
-		rc = lov_update_common_set(set, req, rc);
-		if (rc) {
-			CERROR("%s: cancel objid "DOSTID" subobj "
-			       DOSTID" on OST idx %d: rc = %d\n",
-			       exp->exp_obd->obd_name, POSTID(&lsm->lsm_oi),
-			       POSTID(&req->rq_oi.oi_md->lsm_oi),
-			       req->rq_idx, rc);
-			err = rc;
-		}
-
-	}
-	lov_fini_cancel_set(set);
-	return err;
-}
-
-static int lov_cancel_unused(struct obd_export *exp,
-			     struct lov_stripe_md *lsm,
-			     ldlm_cancel_flags_t flags, void *opaque)
-{
-	struct lov_obd *lov;
-	int rc = 0, i;
-
-	if (!exp || !exp->exp_obd)
-		return -ENODEV;
-
-	lov = &exp->exp_obd->u.lov;
-	if (lsm == NULL) {
-		for (i = 0; i < lov->desc.ld_tgt_count; i++) {
-			int err;
-			if (!lov->lov_tgts[i] || !lov->lov_tgts[i]->ltd_exp)
-				continue;
-
-			err = obd_cancel_unused(lov->lov_tgts[i]->ltd_exp, NULL,
-						flags, opaque);
-			if (!rc)
-				rc = err;
-		}
-		return rc;
-	}
-
-	ASSERT_LSM_MAGIC(lsm);
-
-	for (i = 0; i < lsm->lsm_stripe_count; i++) {
-		struct lov_stripe_md submd;
-		struct lov_oinfo *loi = lsm->lsm_oinfo[i];
-		int idx = loi->loi_ost_idx;
-		int err;
-
-		if (!lov->lov_tgts[idx]) {
-			CDEBUG(D_HA, "lov idx %d NULL\n", idx);
-			continue;
-		}
-
-		if (!lov->lov_tgts[idx]->ltd_active)
-			CDEBUG(D_HA, "lov idx %d inactive\n", idx);
-
-		submd.lsm_oi = loi->loi_oi;
-		submd.lsm_stripe_count = 0;
-		err = obd_cancel_unused(lov->lov_tgts[idx]->ltd_exp,
-					&submd, flags, opaque);
-		if (err && lov->lov_tgts[idx]->ltd_active) {
-			CERROR("%s: cancel unused objid "DOSTID
-			       " subobj "DOSTID" on OST idx %d: rc = %d\n",
-			       exp->exp_obd->obd_name, POSTID(&lsm->lsm_oi),
-			       POSTID(&loi->loi_oi), idx, err);
-			if (!rc)
-				rc = err;
-		}
-	}
-	return rc;
-}
-
 int lov_statfs_interpret(struct ptlrpc_request_set *rqset, void *data, int rc)
 {
 	struct lov_request_set *lovset = (struct lov_request_set *)data;
@@ -1960,15 +1470,9 @@ static int lov_iocontrol(unsigned int cmd, struct obd_export *exp, int len,
 		obd_ioctl_freedata(buf, len);
 		break;
 	}
-	case LL_IOC_LOV_SETSTRIPE:
-		rc = lov_setstripe(exp, len, karg, uarg);
-		break;
 	case LL_IOC_LOV_GETSTRIPE:
 		rc = lov_getstripe(exp, karg, uarg);
 		break;
-	case LL_IOC_LOV_SETEA:
-		rc = lov_setea(exp, karg, uarg);
-		break;
 	case OBD_IOC_QUOTACTL: {
 		struct if_quotactl *qctl = karg;
 		struct lov_tgt_desc *tgt = NULL;
@@ -2625,29 +2129,6 @@ static int lov_set_info_async(const struct lu_env *env, struct obd_export *exp,
 	return rc;
 }
 
-static int lov_extent_calc(struct obd_export *exp, struct lov_stripe_md *lsm,
-			   int cmd, __u64 *offset)
-{
-	__u32 ssize = lsm->lsm_stripe_size;
-	__u64 start;
-
-	start = *offset;
-	lov_do_div64(start, ssize);
-	start = start * ssize;
-
-	CDEBUG(D_DLMTRACE, "offset %llu, stripe %u, start %llu, end %llu\n",
-	       *offset, ssize, start, start + ssize - 1);
-	if (cmd == OBD_CALC_STRIPE_END) {
-		*offset = start + ssize - 1;
-	} else if (cmd == OBD_CALC_STRIPE_START) {
-		*offset = start;
-	} else {
-		LBUG();
-	}
-
-	return 0;
-}
-
 void lov_stripe_lock(struct lov_stripe_md *md)
 {
 	LASSERT(md->lsm_lock_owner != current_pid());
@@ -2783,24 +2264,13 @@ struct obd_ops lov_obd_ops = {
 	.o_unpackmd	    = lov_unpackmd,
 	.o_create	      = lov_create,
 	.o_destroy	     = lov_destroy,
-	.o_getattr	     = lov_getattr,
 	.o_getattr_async       = lov_getattr_async,
-	.o_setattr	     = lov_setattr,
 	.o_setattr_async       = lov_setattr_async,
-	.o_brw		 = lov_brw,
-	.o_merge_lvb	   = lov_merge_lvb,
 	.o_adjust_kms	  = lov_adjust_kms,
-	.o_punch	       = lov_punch,
-	.o_sync		= lov_sync,
-	.o_enqueue	     = lov_enqueue,
-	.o_change_cbdata       = lov_change_cbdata,
 	.o_find_cbdata	 = lov_find_cbdata,
-	.o_cancel	      = lov_cancel,
-	.o_cancel_unused       = lov_cancel_unused,
 	.o_iocontrol	   = lov_iocontrol,
 	.o_get_info	    = lov_get_info,
 	.o_set_info_async      = lov_set_info_async,
-	.o_extent_calc	 = lov_extent_calc,
 	.o_notify	      = lov_notify,
 	.o_pool_new	    = lov_pool_new,
 	.o_pool_rem	    = lov_pool_remove,
diff --git a/drivers/staging/lustre/lustre/lov/lov_pack.c b/drivers/staging/lustre/lustre/lov/lov_pack.c
index 62ea223..db5ce8b 100644
--- a/drivers/staging/lustre/lustre/lov/lov_pack.c
+++ b/drivers/staging/lustre/lustre/lov/lov_pack.c
@@ -403,178 +403,6 @@ int lov_unpackmd(struct obd_export *exp,  struct lov_stripe_md **lsmp,
 	return lsm_size;
 }
 
-static int __lov_setstripe(struct obd_export *exp, int max_lmm_size,
-			   struct lov_stripe_md **lsmp,
-			   struct lov_user_md *lump)
-{
-	struct obd_device *obd = class_exp2obd(exp);
-	struct lov_obd *lov = &obd->u.lov;
-	char buffer[sizeof(struct lov_user_md_v3)];
-	struct lov_user_md_v3 *lumv3 = (struct lov_user_md_v3 *)&buffer[0];
-	struct lov_user_md_v1 *lumv1 = (struct lov_user_md_v1 *)&buffer[0];
-	int lmm_magic;
-	__u16 stripe_count;
-	int rc;
-	int cplen = 0;
-
-	rc = lov_lum_swab_if_needed(lumv3, &lmm_magic, lump);
-	if (rc)
-		return rc;
-
-	/* in the rest of the tests, as *lumv1 and lumv3 have the same
-	 * fields, we use lumv1 to avoid code duplication */
-
-	if (lumv1->lmm_pattern == 0) {
-		lumv1->lmm_pattern = lov->desc.ld_pattern ?
-			lov->desc.ld_pattern : LOV_PATTERN_RAID0;
-	}
-
-	if (lov_pattern(lumv1->lmm_pattern) != LOV_PATTERN_RAID0) {
-		CDEBUG(D_IOCTL, "bad userland stripe pattern: %#x\n",
-		       lumv1->lmm_pattern);
-		return -EINVAL;
-	}
-
-	/* 64kB is the largest common page size we see (ia64), and matches the
-	 * check in lfs */
-	if (lumv1->lmm_stripe_size & (LOV_MIN_STRIPE_SIZE - 1)) {
-		CDEBUG(D_IOCTL, "stripe size %u not multiple of %u, fixing\n",
-		       lumv1->lmm_stripe_size, LOV_MIN_STRIPE_SIZE);
-		lumv1->lmm_stripe_size = LOV_MIN_STRIPE_SIZE;
-	}
-
-	if ((lumv1->lmm_stripe_offset >= lov->desc.ld_tgt_count) &&
-	    (lumv1->lmm_stripe_offset !=
-	     (typeof(lumv1->lmm_stripe_offset))(-1))) {
-		CDEBUG(D_IOCTL, "stripe offset %u > number of OSTs %u\n",
-		       lumv1->lmm_stripe_offset, lov->desc.ld_tgt_count);
-		return -EINVAL;
-	}
-	stripe_count = lov_get_stripecnt(lov, lmm_magic,
-					 lumv1->lmm_stripe_count);
-
-	if (max_lmm_size) {
-		int max_stripes = (max_lmm_size -
-				   lov_mds_md_size(0, lmm_magic)) /
-				   sizeof(struct lov_ost_data_v1);
-		if (unlikely(max_stripes < stripe_count)) {
-			CDEBUG(D_IOCTL, "stripe count reset from %d to %d\n",
-			       stripe_count, max_stripes);
-			stripe_count = max_stripes;
-		}
-	}
-
-	if (lmm_magic == LOV_USER_MAGIC_V3) {
-		struct pool_desc *pool;
-
-		/* In the function below, .hs_keycmp resolves to
-		 * pool_hashkey_keycmp() */
-		/* coverity[overrun-buffer-val] */
-		pool = lov_find_pool(lov, lumv3->lmm_pool_name);
-		if (pool != NULL) {
-			if (lumv3->lmm_stripe_offset !=
-			    (typeof(lumv3->lmm_stripe_offset))(-1)) {
-				rc = lov_check_index_in_pool(
-					lumv3->lmm_stripe_offset, pool);
-				if (rc < 0) {
-					lov_pool_putref(pool);
-					return -EINVAL;
-				}
-			}
-
-			if (stripe_count > pool_tgt_count(pool))
-				stripe_count = pool_tgt_count(pool);
-
-			lov_pool_putref(pool);
-		}
-	}
-
-	if (lumv1->lmm_pattern & LOV_PATTERN_F_RELEASED)
-		stripe_count = 0;
-
-	rc = lov_alloc_memmd(lsmp, stripe_count, lumv1->lmm_pattern, lmm_magic);
-
-	if (rc >= 0) {
-		(*lsmp)->lsm_oinfo[0]->loi_ost_idx = lumv1->lmm_stripe_offset;
-		(*lsmp)->lsm_stripe_size = lumv1->lmm_stripe_size;
-		if (lmm_magic == LOV_USER_MAGIC_V3) {
-			cplen = strlcpy((*lsmp)->lsm_pool_name,
-					lumv3->lmm_pool_name,
-					sizeof((*lsmp)->lsm_pool_name));
-			if (cplen >= sizeof((*lsmp)->lsm_pool_name))
-				rc = -E2BIG;
-		}
-		rc = 0;
-	}
-
-	return rc;
-}
-
-/* Configure object striping information on a new file.
- *
- * @lmmu is a pointer to a user struct with one or more of the fields set to
- * indicate the application preference: lmm_stripe_count, lmm_stripe_size,
- * lmm_stripe_offset, and lmm_stripe_pattern.  lmm_magic must be LOV_MAGIC.
- * @lsmp is a pointer to an in-core stripe MD that needs to be filled in.
- */
-int lov_setstripe(struct obd_export *exp, int max_lmm_size,
-		  struct lov_stripe_md **lsmp, struct lov_user_md *lump)
-{
-	int rc;
-	mm_segment_t seg;
-
-	seg = get_fs();
-	set_fs(KERNEL_DS);
-
-	rc = __lov_setstripe(exp, max_lmm_size, lsmp, lump);
-	set_fs(seg);
-	return rc;
-}
-
-int lov_setea(struct obd_export *exp, struct lov_stripe_md **lsmp,
-	      struct lov_user_md *lump)
-{
-	int i;
-	int rc;
-	struct obd_export *oexp;
-	struct lov_obd *lov = &exp->exp_obd->u.lov;
-	u64 last_id = 0;
-	struct lov_user_ost_data_v1 *lmm_objects;
-
-	if (lump->lmm_magic == LOV_USER_MAGIC_V3)
-		lmm_objects = ((struct lov_user_md_v3 *)lump)->lmm_objects;
-	else
-		lmm_objects = lump->lmm_objects;
-
-	for (i = 0; i < lump->lmm_stripe_count; i++) {
-		__u32 len = sizeof(last_id);
-		oexp = lov->lov_tgts[lmm_objects[i].l_ost_idx]->ltd_exp;
-		rc = obd_get_info(NULL, oexp, sizeof(KEY_LAST_ID), KEY_LAST_ID,
-				  &len, &last_id, NULL);
-		if (rc)
-			return rc;
-		if (ostid_id(&lmm_objects[i].l_ost_oi) > last_id) {
-			CERROR("Setting EA for object > than last id on"
-			       " ost idx %d "DOSTID" > %lld \n",
-			       lmm_objects[i].l_ost_idx,
-			       POSTID(&lmm_objects[i].l_ost_oi), last_id);
-			return -EINVAL;
-		}
-	}
-
-	rc = lov_setstripe(exp, 0, lsmp, lump);
-	if (rc)
-		return rc;
-
-	for (i = 0; i < lump->lmm_stripe_count; i++) {
-		(*lsmp)->lsm_oinfo[i]->loi_ost_idx =
-			lmm_objects[i].l_ost_idx;
-		(*lsmp)->lsm_oinfo[i]->loi_oi = lmm_objects[i].l_ost_oi;
-	}
-	return 0;
-}
-
-
 /* Retrieve object striping information.
  *
  * @lump is a pointer to an in-core struct with lmm_ost_count indicating
diff --git a/drivers/staging/lustre/lustre/lov/lov_request.c b/drivers/staging/lustre/lustre/lov/lov_request.c
index d00ab79..19d4d70 100644
--- a/drivers/staging/lustre/lustre/lov/lov_request.c
+++ b/drivers/staging/lustre/lustre/lov/lov_request.c
@@ -194,418 +194,6 @@ out:
 	return rc;
 }
 
-static int lov_update_enqueue_lov(struct obd_export *exp,
-				  struct lustre_handle *lov_lockhp,
-				  struct lov_oinfo *loi, __u64 flags, int idx,
-				  struct ost_id *oi, int rc)
-{
-	struct lov_obd *lov = &exp->exp_obd->u.lov;
-
-	if (rc != ELDLM_OK &&
-	    !(rc == ELDLM_LOCK_ABORTED && (flags & LDLM_FL_HAS_INTENT))) {
-		memset(lov_lockhp, 0, sizeof(*lov_lockhp));
-		if (lov->lov_tgts[idx] && lov->lov_tgts[idx]->ltd_active) {
-			/* -EUSERS used by OST to report file contention */
-			if (rc != -EINTR && rc != -EUSERS)
-				CERROR("%s: enqueue objid "DOSTID" subobj"
-				       DOSTID" on OST idx %d: rc %d\n",
-				       exp->exp_obd->obd_name,
-				       POSTID(oi), POSTID(&loi->loi_oi),
-				       loi->loi_ost_idx, rc);
-		} else
-			rc = ELDLM_OK;
-	}
-	return rc;
-}
-
-int lov_update_enqueue_set(struct lov_request *req, __u32 mode, int rc)
-{
-	struct lov_request_set *set = req->rq_rqset;
-	struct lustre_handle *lov_lockhp;
-	struct obd_info *oi = set->set_oi;
-	struct lov_oinfo *loi;
-
-	LASSERT(oi != NULL);
-
-	lov_lockhp = set->set_lockh->llh_handles + req->rq_stripe;
-	loi = oi->oi_md->lsm_oinfo[req->rq_stripe];
-
-	/* XXX LOV STACKING: OSC gets a copy, created in lov_prep_enqueue_set
-	 * and that copy can be arbitrarily out of date.
-	 *
-	 * The LOV API is due for a serious rewriting anyways, and this
-	 * can be addressed then. */
-
-	lov_stripe_lock(oi->oi_md);
-	osc_update_enqueue(lov_lockhp, loi, oi->oi_flags,
-			   &req->rq_oi.oi_md->lsm_oinfo[0]->loi_lvb, mode, rc);
-	if (rc == ELDLM_LOCK_ABORTED && (oi->oi_flags & LDLM_FL_HAS_INTENT))
-		memset(lov_lockhp, 0, sizeof(*lov_lockhp));
-	rc = lov_update_enqueue_lov(set->set_exp, lov_lockhp, loi, oi->oi_flags,
-				    req->rq_idx, &oi->oi_md->lsm_oi, rc);
-	lov_stripe_unlock(oi->oi_md);
-	lov_update_set(set, req, rc);
-	return rc;
-}
-
-/* The callback for osc_enqueue that updates lov info for every OSC request. */
-static int cb_update_enqueue(void *cookie, int rc)
-{
-	struct obd_info *oinfo = cookie;
-	struct ldlm_enqueue_info *einfo;
-	struct lov_request *lovreq;
-
-	lovreq = container_of(oinfo, struct lov_request, rq_oi);
-	einfo = lovreq->rq_rqset->set_ei;
-	return lov_update_enqueue_set(lovreq, einfo->ei_mode, rc);
-}
-
-static int enqueue_done(struct lov_request_set *set, __u32 mode)
-{
-	struct lov_request *req;
-	struct lov_obd *lov = &set->set_exp->exp_obd->u.lov;
-	int completes = atomic_read(&set->set_completes);
-	int rc = 0;
-
-	/* enqueue/match success, just return */
-	if (completes && completes == atomic_read(&set->set_success))
-		return 0;
-
-	/* cancel enqueued/matched locks */
-	list_for_each_entry(req, &set->set_list, rq_link) {
-		struct lustre_handle *lov_lockhp;
-
-		if (!req->rq_complete || req->rq_rc)
-			continue;
-
-		lov_lockhp = set->set_lockh->llh_handles + req->rq_stripe;
-		LASSERT(lov_lockhp);
-		if (!lustre_handle_is_used(lov_lockhp))
-			continue;
-
-		rc = obd_cancel(lov->lov_tgts[req->rq_idx]->ltd_exp,
-				req->rq_oi.oi_md, mode, lov_lockhp);
-		if (rc && lov->lov_tgts[req->rq_idx] &&
-		    lov->lov_tgts[req->rq_idx]->ltd_active)
-			CERROR("%s: cancelling obdjid "DOSTID" on OST"
-			       "idx %d error: rc = %d\n",
-			       set->set_exp->exp_obd->obd_name,
-			       POSTID(&req->rq_oi.oi_md->lsm_oi),
-			       req->rq_idx, rc);
-	}
-	if (set->set_lockh)
-		lov_llh_put(set->set_lockh);
-	return rc;
-}
-
-int lov_fini_enqueue_set(struct lov_request_set *set, __u32 mode, int rc,
-			 struct ptlrpc_request_set *rqset)
-{
-	int ret = 0;
-
-	if (set == NULL)
-		return 0;
-	LASSERT(set->set_exp);
-	/* Do enqueue_done only for sync requests and if any request
-	 * succeeded. */
-	if (!rqset) {
-		if (rc)
-			atomic_set(&set->set_completes, 0);
-		ret = enqueue_done(set, mode);
-	} else if (set->set_lockh)
-		lov_llh_put(set->set_lockh);
-
-	lov_put_reqset(set);
-
-	return rc ? rc : ret;
-}
-
-static void lov_llh_addref(void *llhp)
-{
-	struct lov_lock_handles *llh = llhp;
-
-	atomic_inc(&llh->llh_refcount);
-	CDEBUG(D_INFO, "GETting llh %p : new refcount %d\n", llh,
-	       atomic_read(&llh->llh_refcount));
-}
-
-static struct portals_handle_ops lov_handle_ops = {
-	.hop_addref = lov_llh_addref,
-	.hop_free   = NULL,
-};
-
-static struct lov_lock_handles *lov_llh_new(struct lov_stripe_md *lsm)
-{
-	struct lov_lock_handles *llh;
-
-	OBD_ALLOC(llh, sizeof(*llh) +
-		  sizeof(*llh->llh_handles) * lsm->lsm_stripe_count);
-	if (llh == NULL)
-		return NULL;
-
-	atomic_set(&llh->llh_refcount, 2);
-	llh->llh_stripe_count = lsm->lsm_stripe_count;
-	INIT_LIST_HEAD(&llh->llh_handle.h_link);
-	class_handle_hash(&llh->llh_handle, &lov_handle_ops);
-
-	return llh;
-}
-
-int lov_prep_enqueue_set(struct obd_export *exp, struct obd_info *oinfo,
-			 struct ldlm_enqueue_info *einfo,
-			 struct lov_request_set **reqset)
-{
-	struct lov_obd *lov = &exp->exp_obd->u.lov;
-	struct lov_request_set *set;
-	int i, rc = 0;
-
-	OBD_ALLOC(set, sizeof(*set));
-	if (set == NULL)
-		return -ENOMEM;
-	lov_init_set(set);
-
-	set->set_exp = exp;
-	set->set_oi = oinfo;
-	set->set_ei = einfo;
-	set->set_lockh = lov_llh_new(oinfo->oi_md);
-	if (set->set_lockh == NULL)
-		GOTO(out_set, rc = -ENOMEM);
-	oinfo->oi_lockh->cookie = set->set_lockh->llh_handle.h_cookie;
-
-	for (i = 0; i < oinfo->oi_md->lsm_stripe_count; i++) {
-		struct lov_oinfo *loi;
-		struct lov_request *req;
-		u64 start, end;
-
-		loi = oinfo->oi_md->lsm_oinfo[i];
-		if (!lov_stripe_intersects(oinfo->oi_md, i,
-					   oinfo->oi_policy.l_extent.start,
-					   oinfo->oi_policy.l_extent.end,
-					   &start, &end))
-			continue;
-
-		if (!lov_check_and_wait_active(lov, loi->loi_ost_idx)) {
-			CDEBUG(D_HA, "lov idx %d inactive\n", loi->loi_ost_idx);
-			continue;
-		}
-
-		OBD_ALLOC(req, sizeof(*req));
-		if (req == NULL)
-			GOTO(out_set, rc = -ENOMEM);
-
-		req->rq_buflen = sizeof(*req->rq_oi.oi_md) +
-			sizeof(struct lov_oinfo *) +
-			sizeof(struct lov_oinfo);
-		OBD_ALLOC_LARGE(req->rq_oi.oi_md, req->rq_buflen);
-		if (req->rq_oi.oi_md == NULL) {
-			OBD_FREE(req, sizeof(*req));
-			GOTO(out_set, rc = -ENOMEM);
-		}
-		req->rq_oi.oi_md->lsm_oinfo[0] =
-			((void *)req->rq_oi.oi_md) + sizeof(*req->rq_oi.oi_md) +
-			sizeof(struct lov_oinfo *);
-
-		/* Set lov request specific parameters. */
-		req->rq_oi.oi_lockh = set->set_lockh->llh_handles + i;
-		req->rq_oi.oi_cb_up = cb_update_enqueue;
-		req->rq_oi.oi_flags = oinfo->oi_flags;
-
-		LASSERT(req->rq_oi.oi_lockh);
-
-		req->rq_oi.oi_policy.l_extent.gid =
-			oinfo->oi_policy.l_extent.gid;
-		req->rq_oi.oi_policy.l_extent.start = start;
-		req->rq_oi.oi_policy.l_extent.end = end;
-
-		req->rq_idx = loi->loi_ost_idx;
-		req->rq_stripe = i;
-
-		/* XXX LOV STACKING: submd should be from the subobj */
-		req->rq_oi.oi_md->lsm_oi = loi->loi_oi;
-		req->rq_oi.oi_md->lsm_stripe_count = 0;
-		req->rq_oi.oi_md->lsm_oinfo[0]->loi_kms_valid =
-			loi->loi_kms_valid;
-		req->rq_oi.oi_md->lsm_oinfo[0]->loi_kms = loi->loi_kms;
-		req->rq_oi.oi_md->lsm_oinfo[0]->loi_lvb = loi->loi_lvb;
-
-		lov_set_add_req(req, set);
-	}
-	if (!set->set_count)
-		GOTO(out_set, rc = -EIO);
-	*reqset = set;
-	return 0;
-out_set:
-	lov_fini_enqueue_set(set, einfo->ei_mode, rc, NULL);
-	return rc;
-}
-
-int lov_fini_match_set(struct lov_request_set *set, __u32 mode, __u64 flags)
-{
-	int rc = 0;
-
-	if (set == NULL)
-		return 0;
-	LASSERT(set->set_exp);
-	rc = enqueue_done(set, mode);
-	if ((set->set_count == atomic_read(&set->set_success)) &&
-	    (flags & LDLM_FL_TEST_LOCK))
-		lov_llh_put(set->set_lockh);
-
-	lov_put_reqset(set);
-
-	return rc;
-}
-
-int lov_prep_match_set(struct obd_export *exp, struct obd_info *oinfo,
-		       struct lov_stripe_md *lsm, ldlm_policy_data_t *policy,
-		       __u32 mode, struct lustre_handle *lockh,
-		       struct lov_request_set **reqset)
-{
-	struct lov_obd *lov = &exp->exp_obd->u.lov;
-	struct lov_request_set *set;
-	int i, rc = 0;
-
-	OBD_ALLOC(set, sizeof(*set));
-	if (set == NULL)
-		return -ENOMEM;
-	lov_init_set(set);
-
-	set->set_exp = exp;
-	set->set_oi = oinfo;
-	set->set_oi->oi_md = lsm;
-	set->set_lockh = lov_llh_new(lsm);
-	if (set->set_lockh == NULL)
-		GOTO(out_set, rc = -ENOMEM);
-	lockh->cookie = set->set_lockh->llh_handle.h_cookie;
-
-	for (i = 0; i < lsm->lsm_stripe_count; i++) {
-		struct lov_oinfo *loi;
-		struct lov_request *req;
-		u64 start, end;
-
-		loi = lsm->lsm_oinfo[i];
-		if (!lov_stripe_intersects(lsm, i, policy->l_extent.start,
-					   policy->l_extent.end, &start, &end))
-			continue;
-
-		/* FIXME raid1 should grace this error */
-		if (!lov_check_and_wait_active(lov, loi->loi_ost_idx)) {
-			CDEBUG(D_HA, "lov idx %d inactive\n", loi->loi_ost_idx);
-			GOTO(out_set, rc = -EIO);
-		}
-
-		OBD_ALLOC(req, sizeof(*req));
-		if (req == NULL)
-			GOTO(out_set, rc = -ENOMEM);
-
-		req->rq_buflen = sizeof(*req->rq_oi.oi_md);
-		OBD_ALLOC_LARGE(req->rq_oi.oi_md, req->rq_buflen);
-		if (req->rq_oi.oi_md == NULL) {
-			OBD_FREE(req, sizeof(*req));
-			GOTO(out_set, rc = -ENOMEM);
-		}
-
-		req->rq_oi.oi_policy.l_extent.start = start;
-		req->rq_oi.oi_policy.l_extent.end = end;
-		req->rq_oi.oi_policy.l_extent.gid = policy->l_extent.gid;
-
-		req->rq_idx = loi->loi_ost_idx;
-		req->rq_stripe = i;
-
-		/* XXX LOV STACKING: submd should be from the subobj */
-		req->rq_oi.oi_md->lsm_oi = loi->loi_oi;
-		req->rq_oi.oi_md->lsm_stripe_count = 0;
-
-		lov_set_add_req(req, set);
-	}
-	if (!set->set_count)
-		GOTO(out_set, rc = -EIO);
-	*reqset = set;
-	return rc;
-out_set:
-	lov_fini_match_set(set, mode, 0);
-	return rc;
-}
-
-int lov_fini_cancel_set(struct lov_request_set *set)
-{
-	int rc = 0;
-
-	if (set == NULL)
-		return 0;
-
-	LASSERT(set->set_exp);
-	if (set->set_lockh)
-		lov_llh_put(set->set_lockh);
-
-	lov_put_reqset(set);
-
-	return rc;
-}
-
-int lov_prep_cancel_set(struct obd_export *exp, struct obd_info *oinfo,
-			struct lov_stripe_md *lsm, __u32 mode,
-			struct lustre_handle *lockh,
-			struct lov_request_set **reqset)
-{
-	struct lov_request_set *set;
-	int i, rc = 0;
-
-	OBD_ALLOC(set, sizeof(*set));
-	if (set == NULL)
-		return -ENOMEM;
-	lov_init_set(set);
-
-	set->set_exp = exp;
-	set->set_oi = oinfo;
-	set->set_oi->oi_md = lsm;
-	set->set_lockh = lov_handle2llh(lockh);
-	if (set->set_lockh == NULL) {
-		CERROR("LOV: invalid lov lock handle %p\n", lockh);
-		GOTO(out_set, rc = -EINVAL);
-	}
-	lockh->cookie = set->set_lockh->llh_handle.h_cookie;
-
-	for (i = 0; i < lsm->lsm_stripe_count; i++) {
-		struct lov_request *req;
-		struct lustre_handle *lov_lockhp;
-		struct lov_oinfo *loi = lsm->lsm_oinfo[i];
-
-		lov_lockhp = set->set_lockh->llh_handles + i;
-		if (!lustre_handle_is_used(lov_lockhp)) {
-			CDEBUG(D_INFO, "lov idx %d subobj "DOSTID" no lock\n",
-			       loi->loi_ost_idx, POSTID(&loi->loi_oi));
-			continue;
-		}
-
-		OBD_ALLOC(req, sizeof(*req));
-		if (req == NULL)
-			GOTO(out_set, rc = -ENOMEM);
-
-		req->rq_buflen = sizeof(*req->rq_oi.oi_md);
-		OBD_ALLOC_LARGE(req->rq_oi.oi_md, req->rq_buflen);
-		if (req->rq_oi.oi_md == NULL) {
-			OBD_FREE(req, sizeof(*req));
-			GOTO(out_set, rc = -ENOMEM);
-		}
-
-		req->rq_idx = loi->loi_ost_idx;
-		req->rq_stripe = i;
-
-		/* XXX LOV STACKING: submd should be from the subobj */
-		req->rq_oi.oi_md->lsm_oi = loi->loi_oi;
-		req->rq_oi.oi_md->lsm_stripe_count = 0;
-
-		lov_set_add_req(req, set);
-	}
-	if (!set->set_count)
-		GOTO(out_set, rc = -EIO);
-	*reqset = set;
-	return rc;
-out_set:
-	lov_fini_cancel_set(set);
-	return rc;
-}
 static int common_attr_done(struct lov_request_set *set)
 {
 	struct list_head *pos;
@@ -657,164 +245,6 @@ out:
 
 }
 
-static int brw_done(struct lov_request_set *set)
-{
-	struct lov_stripe_md *lsm = set->set_oi->oi_md;
-	struct lov_oinfo     *loi = NULL;
-	struct list_head *pos;
-	struct lov_request *req;
-
-	list_for_each(pos, &set->set_list) {
-		req = list_entry(pos, struct lov_request, rq_link);
-
-		if (!req->rq_complete || req->rq_rc)
-			continue;
-
-		loi = lsm->lsm_oinfo[req->rq_stripe];
-
-		if (req->rq_oi.oi_oa->o_valid & OBD_MD_FLBLOCKS)
-			loi->loi_lvb.lvb_blocks = req->rq_oi.oi_oa->o_blocks;
-	}
-
-	return 0;
-}
-
-int lov_fini_brw_set(struct lov_request_set *set)
-{
-	int rc = 0;
-
-	if (set == NULL)
-		return 0;
-	LASSERT(set->set_exp);
-	if (atomic_read(&set->set_completes)) {
-		rc = brw_done(set);
-		/* FIXME update qos data here */
-	}
-	lov_put_reqset(set);
-
-	return rc;
-}
-
-int lov_prep_brw_set(struct obd_export *exp, struct obd_info *oinfo,
-		     u32 oa_bufs, struct brw_page *pga,
-		     struct obd_trans_info *oti,
-		     struct lov_request_set **reqset)
-{
-	struct {
-		u32       index;
-		u32       count;
-		u32       off;
-	} *info = NULL;
-	struct lov_request_set *set;
-	struct lov_obd *lov = &exp->exp_obd->u.lov;
-	int rc = 0, i, shift;
-
-	OBD_ALLOC(set, sizeof(*set));
-	if (set == NULL)
-		return -ENOMEM;
-	lov_init_set(set);
-
-	set->set_exp = exp;
-	set->set_oti = oti;
-	set->set_oi = oinfo;
-	set->set_oabufs = oa_bufs;
-	OBD_ALLOC_LARGE(set->set_pga, oa_bufs * sizeof(*set->set_pga));
-	if (!set->set_pga)
-		GOTO(out, rc = -ENOMEM);
-
-	OBD_ALLOC_LARGE(info, sizeof(*info) * oinfo->oi_md->lsm_stripe_count);
-	if (!info)
-		GOTO(out, rc = -ENOMEM);
-
-	/* calculate the page count for each stripe */
-	for (i = 0; i < oa_bufs; i++) {
-		int stripe = lov_stripe_number(oinfo->oi_md, pga[i].off);
-		info[stripe].count++;
-	}
-
-	/* alloc and initialize lov request */
-	shift = 0;
-	for (i = 0; i < oinfo->oi_md->lsm_stripe_count; i++) {
-		struct lov_oinfo *loi = NULL;
-		struct lov_request *req;
-
-		if (info[i].count == 0)
-			continue;
-
-		loi = oinfo->oi_md->lsm_oinfo[i];
-		if (!lov_check_and_wait_active(lov, loi->loi_ost_idx)) {
-			CDEBUG(D_HA, "lov idx %d inactive\n", loi->loi_ost_idx);
-			GOTO(out, rc = -EIO);
-		}
-
-		OBD_ALLOC(req, sizeof(*req));
-		if (req == NULL)
-			GOTO(out, rc = -ENOMEM);
-
-		OBDO_ALLOC(req->rq_oi.oi_oa);
-		if (req->rq_oi.oi_oa == NULL) {
-			OBD_FREE(req, sizeof(*req));
-			GOTO(out, rc = -ENOMEM);
-		}
-
-		if (oinfo->oi_oa) {
-			memcpy(req->rq_oi.oi_oa, oinfo->oi_oa,
-			       sizeof(*req->rq_oi.oi_oa));
-		}
-		req->rq_oi.oi_oa->o_oi = loi->loi_oi;
-		req->rq_oi.oi_oa->o_stripe_idx = i;
-
-		req->rq_buflen = sizeof(*req->rq_oi.oi_md);
-		OBD_ALLOC_LARGE(req->rq_oi.oi_md, req->rq_buflen);
-		if (req->rq_oi.oi_md == NULL) {
-			OBDO_FREE(req->rq_oi.oi_oa);
-			OBD_FREE(req, sizeof(*req));
-			GOTO(out, rc = -ENOMEM);
-		}
-
-		req->rq_idx = loi->loi_ost_idx;
-		req->rq_stripe = i;
-
-		/* XXX LOV STACKING */
-		req->rq_oi.oi_md->lsm_oi = loi->loi_oi;
-		req->rq_oabufs = info[i].count;
-		req->rq_pgaidx = shift;
-		shift += req->rq_oabufs;
-
-		/* remember the index for sort brw_page array */
-		info[i].index = req->rq_pgaidx;
-
-		req->rq_oi.oi_capa = oinfo->oi_capa;
-
-		lov_set_add_req(req, set);
-	}
-	if (!set->set_count)
-		GOTO(out, rc = -EIO);
-
-	/* rotate & sort the brw_page array */
-	for (i = 0; i < oa_bufs; i++) {
-		int stripe = lov_stripe_number(oinfo->oi_md, pga[i].off);
-
-		shift = info[stripe].index + info[stripe].off;
-		LASSERT(shift < oa_bufs);
-		set->set_pga[shift] = pga[i];
-		lov_stripe_offset(oinfo->oi_md, pga[i].off, stripe,
-				  &set->set_pga[shift].off);
-		info[stripe].off++;
-	}
-out:
-	if (info)
-		OBD_FREE_LARGE(info,
-			       sizeof(*info) * oinfo->oi_md->lsm_stripe_count);
-
-	if (rc == 0)
-		*reqset = set;
-	else
-		lov_fini_brw_set(set);
-
-	return rc;
-}
-
 int lov_fini_getattr_set(struct lov_request_set *set)
 {
 	int rc = 0;
@@ -1093,219 +523,6 @@ out_set:
 	return rc;
 }
 
-int lov_fini_punch_set(struct lov_request_set *set)
-{
-	int rc = 0;
-
-	if (set == NULL)
-		return 0;
-	LASSERT(set->set_exp);
-	if (atomic_read(&set->set_completes)) {
-		rc = -EIO;
-		/* FIXME update qos data here */
-		if (atomic_read(&set->set_success))
-			rc = common_attr_done(set);
-	}
-
-	lov_put_reqset(set);
-
-	return rc;
-}
-
-int lov_update_punch_set(struct lov_request_set *set,
-			 struct lov_request *req, int rc)
-{
-	struct lov_obd *lov = &req->rq_rqset->set_exp->exp_obd->u.lov;
-	struct lov_stripe_md *lsm = req->rq_rqset->set_oi->oi_md;
-
-	lov_update_set(set, req, rc);
-
-	/* grace error on inactive ost */
-	if (rc && !lov->lov_tgts[req->rq_idx]->ltd_active)
-		rc = 0;
-
-	if (rc == 0) {
-		lov_stripe_lock(lsm);
-		if (req->rq_oi.oi_oa->o_valid & OBD_MD_FLBLOCKS) {
-			lsm->lsm_oinfo[req->rq_stripe]->loi_lvb.lvb_blocks =
-				req->rq_oi.oi_oa->o_blocks;
-		}
-
-		lov_stripe_unlock(lsm);
-	}
-
-	return rc;
-}
-
-/* The callback for osc_punch that finalizes a request info when a response
- * is received. */
-static int cb_update_punch(void *cookie, int rc)
-{
-	struct obd_info *oinfo = cookie;
-	struct lov_request *lovreq;
-
-	lovreq = container_of(oinfo, struct lov_request, rq_oi);
-	return lov_update_punch_set(lovreq->rq_rqset, lovreq, rc);
-}
-
-int lov_prep_punch_set(struct obd_export *exp, struct obd_info *oinfo,
-		       struct obd_trans_info *oti,
-		       struct lov_request_set **reqset)
-{
-	struct lov_request_set *set;
-	struct lov_obd *lov = &exp->exp_obd->u.lov;
-	int rc = 0, i;
-
-	OBD_ALLOC(set, sizeof(*set));
-	if (set == NULL)
-		return -ENOMEM;
-	lov_init_set(set);
-
-	set->set_oi = oinfo;
-	set->set_exp = exp;
-
-	for (i = 0; i < oinfo->oi_md->lsm_stripe_count; i++) {
-		struct lov_oinfo *loi = oinfo->oi_md->lsm_oinfo[i];
-		struct lov_request *req;
-		u64 rs, re;
-
-		if (!lov_stripe_intersects(oinfo->oi_md, i,
-					   oinfo->oi_policy.l_extent.start,
-					   oinfo->oi_policy.l_extent.end,
-					   &rs, &re))
-			continue;
-
-		if (!lov_check_and_wait_active(lov, loi->loi_ost_idx)) {
-			CDEBUG(D_HA, "lov idx %d inactive\n", loi->loi_ost_idx);
-			GOTO(out_set, rc = -EIO);
-		}
-
-		OBD_ALLOC(req, sizeof(*req));
-		if (req == NULL)
-			GOTO(out_set, rc = -ENOMEM);
-		req->rq_stripe = i;
-		req->rq_idx = loi->loi_ost_idx;
-
-		OBDO_ALLOC(req->rq_oi.oi_oa);
-		if (req->rq_oi.oi_oa == NULL) {
-			OBD_FREE(req, sizeof(*req));
-			GOTO(out_set, rc = -ENOMEM);
-		}
-		memcpy(req->rq_oi.oi_oa, oinfo->oi_oa,
-		       sizeof(*req->rq_oi.oi_oa));
-		req->rq_oi.oi_oa->o_oi = loi->loi_oi;
-		req->rq_oi.oi_oa->o_valid |= OBD_MD_FLGROUP;
-
-		req->rq_oi.oi_oa->o_stripe_idx = i;
-		req->rq_oi.oi_cb_up = cb_update_punch;
-
-		req->rq_oi.oi_policy.l_extent.start = rs;
-		req->rq_oi.oi_policy.l_extent.end = re;
-		req->rq_oi.oi_policy.l_extent.gid = -1;
-
-		req->rq_oi.oi_capa = oinfo->oi_capa;
-
-		lov_set_add_req(req, set);
-	}
-	if (!set->set_count)
-		GOTO(out_set, rc = -EIO);
-	*reqset = set;
-	return rc;
-out_set:
-	lov_fini_punch_set(set);
-	return rc;
-}
-
-int lov_fini_sync_set(struct lov_request_set *set)
-{
-	int rc = 0;
-
-	if (set == NULL)
-		return 0;
-	LASSERT(set->set_exp);
-	if (atomic_read(&set->set_completes)) {
-		if (!atomic_read(&set->set_success))
-			rc = -EIO;
-		/* FIXME update qos data here */
-	}
-
-	lov_put_reqset(set);
-
-	return rc;
-}
-
-/* The callback for osc_sync that finalizes a request info when a
- * response is received. */
-static int cb_sync_update(void *cookie, int rc)
-{
-	struct obd_info *oinfo = cookie;
-	struct lov_request *lovreq;
-
-	lovreq = container_of(oinfo, struct lov_request, rq_oi);
-	return lov_update_common_set(lovreq->rq_rqset, lovreq, rc);
-}
-
-int lov_prep_sync_set(struct obd_export *exp, struct obd_info *oinfo,
-		      u64 start, u64 end,
-		      struct lov_request_set **reqset)
-{
-	struct lov_request_set *set;
-	struct lov_obd *lov = &exp->exp_obd->u.lov;
-	int rc = 0, i;
-
-	OBD_ALLOC_PTR(set);
-	if (set == NULL)
-		return -ENOMEM;
-	lov_init_set(set);
-
-	set->set_exp = exp;
-	set->set_oi = oinfo;
-
-	for (i = 0; i < oinfo->oi_md->lsm_stripe_count; i++) {
-		struct lov_oinfo *loi = oinfo->oi_md->lsm_oinfo[i];
-		struct lov_request *req;
-		u64 rs, re;
-
-		if (!lov_check_and_wait_active(lov, loi->loi_ost_idx)) {
-			CDEBUG(D_HA, "lov idx %d inactive\n", loi->loi_ost_idx);
-			continue;
-		}
-
-		if (!lov_stripe_intersects(oinfo->oi_md, i, start, end, &rs,
-					   &re))
-			continue;
-
-		OBD_ALLOC_PTR(req);
-		if (req == NULL)
-			GOTO(out_set, rc = -ENOMEM);
-		req->rq_stripe = i;
-		req->rq_idx = loi->loi_ost_idx;
-
-		OBDO_ALLOC(req->rq_oi.oi_oa);
-		if (req->rq_oi.oi_oa == NULL) {
-			OBD_FREE(req, sizeof(*req));
-			GOTO(out_set, rc = -ENOMEM);
-		}
-		*req->rq_oi.oi_oa = *oinfo->oi_oa;
-		req->rq_oi.oi_oa->o_oi = loi->loi_oi;
-		req->rq_oi.oi_oa->o_stripe_idx = i;
-
-		req->rq_oi.oi_policy.l_extent.start = rs;
-		req->rq_oi.oi_policy.l_extent.end = re;
-		req->rq_oi.oi_policy.l_extent.gid = -1;
-		req->rq_oi.oi_cb_up = cb_sync_update;
-
-		lov_set_add_req(req, set);
-	}
-	if (!set->set_count)
-		GOTO(out_set, rc = -EIO);
-	*reqset = set;
-	return rc;
-out_set:
-	lov_fini_sync_set(set);
-	return rc;
-}
-
 #define LOV_U64_MAX ((__u64)~0ULL)
 #define LOV_SUM_MAX(tot, add)					   \
 	do {							    \
-- 
1.7.9.5


^ permalink raw reply related	[flat|nested] 13+ messages in thread

* [PATCH 02/12] staging/lustre/osc: remove unused OBD methods
  2014-09-05 20:08 [PATCH 00/12] staging/lustre: yet more dead code removal John L. Hammond
  2014-09-05 20:08 ` [PATCH 01/12] staging/lustre/lov: remove unused OBD methods John L. Hammond
@ 2014-09-05 20:08 ` John L. Hammond
  2014-09-05 20:08 ` [PATCH 03/12] staging/lustre/osc: remove obsolete llog handling code John L. Hammond
                   ` (9 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: John L. Hammond @ 2014-09-05 20:08 UTC (permalink / raw
  To: greg, andreas.dilger, oleg.drokin; +Cc: linux-kernel, John L. Hammond

From: "John L. Hammond" <john.hammond@intel.com>

Remove the unused OBD device methods:
    osc_brw()
    osc_cancel()
    osc_cancel_unused()
    osc_change_cbdata()
    osc_enqueue()
    osc_punch()
    osc_sync()
and their supporting functions.

Signed-off-by: John L. Hammond <john.hammond@intel.com>
---
 drivers/staging/lustre/lustre/osc/osc_request.c |  264 -----------------------
 1 file changed, 264 deletions(-)

diff --git a/drivers/staging/lustre/lustre/osc/osc_request.c b/drivers/staging/lustre/lustre/osc/osc_request.c
index d9f7249..86e9e97 100644
--- a/drivers/staging/lustre/lustre/osc/osc_request.c
+++ b/drivers/staging/lustre/lustre/osc/osc_request.c
@@ -537,17 +537,6 @@ int osc_punch_base(struct obd_export *exp, struct obd_info *oinfo,
 	return 0;
 }
 
-static int osc_punch(const struct lu_env *env, struct obd_export *exp,
-		     struct obd_info *oinfo, struct obd_trans_info *oti,
-		     struct ptlrpc_request_set *rqset)
-{
-	oinfo->oi_oa->o_size   = oinfo->oi_policy.l_extent.start;
-	oinfo->oi_oa->o_blocks = oinfo->oi_policy.l_extent.end;
-	oinfo->oi_oa->o_valid |= OBD_MD_FLSIZE | OBD_MD_FLBLOCKS;
-	return osc_punch_base(exp, oinfo,
-			      oinfo->oi_cb_up, oinfo, rqset);
-}
-
 static int osc_sync_interpret(const struct lu_env *env,
 			      struct ptlrpc_request *req,
 			      void *arg, int rc)
@@ -614,22 +603,6 @@ int osc_sync_base(struct obd_export *exp, struct obd_info *oinfo,
 	return 0;
 }
 
-static int osc_sync(const struct lu_env *env, struct obd_export *exp,
-		    struct obd_info *oinfo, u64 start, u64 end,
-		    struct ptlrpc_request_set *set)
-{
-	if (!oinfo->oi_oa) {
-		CDEBUG(D_INFO, "oa NULL\n");
-		return -EINVAL;
-	}
-
-	oinfo->oi_oa->o_size = start;
-	oinfo->oi_oa->o_blocks = end;
-	oinfo->oi_oa->o_valid |= (OBD_MD_FLSIZE | OBD_MD_FLBLOCKS);
-
-	return osc_sync_base(exp, oinfo, oinfo->oi_cb_up, oinfo, set);
-}
-
 /* Find and cancel locally locks matched by @mode in the resource found by
  * @objid. Found locks are added into @cancel list. Returns the amount of
  * locks added to @cancels list. */
@@ -1618,74 +1591,6 @@ out:
 	return rc;
 }
 
-static int osc_brw_internal(int cmd, struct obd_export *exp, struct obdo *oa,
-			    struct lov_stripe_md *lsm,
-			    u32 page_count, struct brw_page **pga,
-			    struct obd_capa *ocapa)
-{
-	struct ptlrpc_request *req;
-	int		    rc;
-	wait_queue_head_t	    waitq;
-	int		    generation, resends = 0;
-	struct l_wait_info     lwi;
-
-	init_waitqueue_head(&waitq);
-	generation = exp->exp_obd->u.cli.cl_import->imp_generation;
-
-restart_bulk:
-	rc = osc_brw_prep_request(cmd, &exp->exp_obd->u.cli, oa, lsm,
-				  page_count, pga, &req, ocapa, 0, resends);
-	if (rc != 0)
-		return rc;
-
-	if (resends) {
-		req->rq_generation_set = 1;
-		req->rq_import_generation = generation;
-		req->rq_sent = get_seconds() + resends;
-	}
-
-	rc = ptlrpc_queue_wait(req);
-
-	if (rc == -ETIMEDOUT && req->rq_resend) {
-		DEBUG_REQ(D_HA, req,  "BULK TIMEOUT");
-		ptlrpc_req_finished(req);
-		goto restart_bulk;
-	}
-
-	rc = osc_brw_fini_request(req, rc);
-
-	ptlrpc_req_finished(req);
-	/* When server return -EINPROGRESS, client should always retry
-	 * regardless of the number of times the bulk was resent already.*/
-	if (osc_recoverable_error(rc)) {
-		resends++;
-		if (rc != -EINPROGRESS &&
-		    !client_should_resend(resends, &exp->exp_obd->u.cli)) {
-			CERROR("%s: too many resend retries for object: "
-			       ""DOSTID", rc = %d.\n", exp->exp_obd->obd_name,
-			       POSTID(&oa->o_oi), rc);
-			goto out;
-		}
-		if (generation !=
-		    exp->exp_obd->u.cli.cl_import->imp_generation) {
-			CDEBUG(D_HA, "%s: resend cross eviction for object: "
-			       ""DOSTID", rc = %d.\n", exp->exp_obd->obd_name,
-			       POSTID(&oa->o_oi), rc);
-			goto out;
-		}
-
-		lwi = LWI_TIMEOUT_INTR(cfs_time_seconds(resends), NULL, NULL,
-				       NULL);
-		l_wait_event(waitq, 0, &lwi);
-
-		goto restart_bulk;
-	}
-out:
-	if (rc == -EAGAIN || rc == -EINPROGRESS)
-		rc = -EIO;
-	return rc;
-}
-
 static int osc_brw_redo_request(struct ptlrpc_request *request,
 				struct osc_brw_async_args *aa, int rc)
 {
@@ -1789,125 +1694,12 @@ static void sort_brw_pages(struct brw_page **array, int num)
 	} while (stride > 1);
 }
 
-static u32 max_unfragmented_pages(struct brw_page **pg, u32 pages)
-{
-	int count = 1;
-	int offset;
-	int i = 0;
-
-	LASSERT (pages > 0);
-	offset = pg[i]->off & ~CFS_PAGE_MASK;
-
-	for (;;) {
-		pages--;
-		if (pages == 0)	 /* that's all */
-			return count;
-
-		if (offset + pg[i]->count < PAGE_CACHE_SIZE)
-			return count;   /* doesn't end on page boundary */
-
-		i++;
-		offset = pg[i]->off & ~CFS_PAGE_MASK;
-		if (offset != 0)	/* doesn't start on page boundary */
-			return count;
-
-		count++;
-	}
-}
-
-static struct brw_page **osc_build_ppga(struct brw_page *pga, u32 count)
-{
-	struct brw_page **ppga;
-	int i;
-
-	OBD_ALLOC(ppga, sizeof(*ppga) * count);
-	if (ppga == NULL)
-		return NULL;
-
-	for (i = 0; i < count; i++)
-		ppga[i] = pga + i;
-	return ppga;
-}
-
 static void osc_release_ppga(struct brw_page **ppga, u32 count)
 {
 	LASSERT(ppga != NULL);
 	OBD_FREE(ppga, sizeof(*ppga) * count);
 }
 
-static int osc_brw(int cmd, struct obd_export *exp, struct obd_info *oinfo,
-		   u32 page_count, struct brw_page *pga,
-		   struct obd_trans_info *oti)
-{
-	struct obdo *saved_oa = NULL;
-	struct brw_page **ppga, **orig;
-	struct obd_import *imp = class_exp2cliimp(exp);
-	struct client_obd *cli;
-	int rc, page_count_orig;
-
-	LASSERT((imp != NULL) && (imp->imp_obd != NULL));
-	cli = &imp->imp_obd->u.cli;
-
-	if (cmd & OBD_BRW_CHECK) {
-		/* The caller just wants to know if there's a chance that this
-		 * I/O can succeed */
-
-		if (imp->imp_invalid)
-			return -EIO;
-		return 0;
-	}
-
-	/* test_brw with a failed create can trip this, maybe others. */
-	LASSERT(cli->cl_max_pages_per_rpc);
-
-	rc = 0;
-
-	orig = ppga = osc_build_ppga(pga, page_count);
-	if (ppga == NULL)
-		return -ENOMEM;
-	page_count_orig = page_count;
-
-	sort_brw_pages(ppga, page_count);
-	while (page_count) {
-		u32 pages_per_brw;
-
-		if (page_count > cli->cl_max_pages_per_rpc)
-			pages_per_brw = cli->cl_max_pages_per_rpc;
-		else
-			pages_per_brw = page_count;
-
-		pages_per_brw = max_unfragmented_pages(ppga, pages_per_brw);
-
-		if (saved_oa != NULL) {
-			/* restore previously saved oa */
-			*oinfo->oi_oa = *saved_oa;
-		} else if (page_count > pages_per_brw) {
-			/* save a copy of oa (brw will clobber it) */
-			OBDO_ALLOC(saved_oa);
-			if (saved_oa == NULL)
-				GOTO(out, rc = -ENOMEM);
-			*saved_oa = *oinfo->oi_oa;
-		}
-
-		rc = osc_brw_internal(cmd, exp, oinfo->oi_oa, oinfo->oi_md,
-				      pages_per_brw, ppga, oinfo->oi_capa);
-
-		if (rc != 0)
-			break;
-
-		page_count -= pages_per_brw;
-		ppga += pages_per_brw;
-	}
-
-out:
-	osc_release_ppga(orig, page_count_orig);
-
-	if (saved_oa != NULL)
-		OBDO_FREE(saved_oa);
-
-	return rc;
-}
-
 static int brw_interpret(const struct lu_env *env,
 			 struct ptlrpc_request *req, void *data, int rc)
 {
@@ -2267,17 +2059,6 @@ static int osc_set_data_with_check(struct lustre_handle *lockh,
 	return set;
 }
 
-static int osc_change_cbdata(struct obd_export *exp, struct lov_stripe_md *lsm,
-			     ldlm_iterator_t replace, void *data)
-{
-	struct ldlm_res_id res_id;
-	struct obd_device *obd = class_exp2obd(exp);
-
-	ostid_build_res_name(&lsm->lsm_oi, &res_id);
-	ldlm_resource_iterate(obd->obd_namespace, &res_id, replace, data);
-	return 0;
-}
-
 /* find any ldlm lock of the inode in osc
  * return 0    not find
  *	1    find one
@@ -2590,22 +2371,6 @@ int osc_enqueue_base(struct obd_export *exp, struct ldlm_res_id *res_id,
 	return rc;
 }
 
-static int osc_enqueue(struct obd_export *exp, struct obd_info *oinfo,
-		       struct ldlm_enqueue_info *einfo,
-		       struct ptlrpc_request_set *rqset)
-{
-	struct ldlm_res_id res_id;
-	int rc;
-
-	ostid_build_res_name(&oinfo->oi_md->lsm_oi, &res_id);
-	rc = osc_enqueue_base(exp, &res_id, &oinfo->oi_flags, &oinfo->oi_policy,
-			      &oinfo->oi_md->lsm_oinfo[0]->loi_lvb,
-			      oinfo->oi_md->lsm_oinfo[0]->loi_kms_valid,
-			      oinfo->oi_cb_up, oinfo, einfo, oinfo->oi_lockh,
-			      rqset, rqset != NULL, 0);
-	return rc;
-}
-
 int osc_match_base(struct obd_export *exp, struct ldlm_res_id *res_id,
 		   __u32 type, ldlm_policy_data_t *policy, __u32 mode,
 		   __u64 *flags, void *data, struct lustre_handle *lockh,
@@ -2659,28 +2424,6 @@ int osc_cancel_base(struct lustre_handle *lockh, __u32 mode)
 	return 0;
 }
 
-static int osc_cancel(struct obd_export *exp, struct lov_stripe_md *md,
-		      __u32 mode, struct lustre_handle *lockh)
-{
-	return osc_cancel_base(lockh, mode);
-}
-
-static int osc_cancel_unused(struct obd_export *exp,
-			     struct lov_stripe_md *lsm,
-			     ldlm_cancel_flags_t flags,
-			     void *opaque)
-{
-	struct obd_device *obd = class_exp2obd(exp);
-	struct ldlm_res_id res_id, *resp = NULL;
-
-	if (lsm != NULL) {
-		ostid_build_res_name(&lsm->lsm_oi, &res_id);
-		resp = &res_id;
-	}
-
-	return ldlm_cli_cancel_unused(obd->obd_namespace, resp, flags, opaque);
-}
-
 static int osc_statfs_interpret(const struct lu_env *env,
 				struct ptlrpc_request *req,
 				struct osc_async_args *aa, int rc)
@@ -3589,14 +3332,7 @@ struct obd_ops osc_obd_ops = {
 	.o_getattr_async	= osc_getattr_async,
 	.o_setattr	      = osc_setattr,
 	.o_setattr_async	= osc_setattr_async,
-	.o_brw		  = osc_brw,
-	.o_punch		= osc_punch,
-	.o_sync		 = osc_sync,
-	.o_enqueue	      = osc_enqueue,
-	.o_change_cbdata	= osc_change_cbdata,
 	.o_find_cbdata	  = osc_find_cbdata,
-	.o_cancel	       = osc_cancel,
-	.o_cancel_unused	= osc_cancel_unused,
 	.o_iocontrol	    = osc_iocontrol,
 	.o_get_info	     = osc_get_info,
 	.o_set_info_async       = osc_set_info_async,
-- 
1.7.9.5


^ permalink raw reply related	[flat|nested] 13+ messages in thread

* [PATCH 03/12] staging/lustre/osc: remove obsolete llog handling code
  2014-09-05 20:08 [PATCH 00/12] staging/lustre: yet more dead code removal John L. Hammond
  2014-09-05 20:08 ` [PATCH 01/12] staging/lustre/lov: remove unused OBD methods John L. Hammond
  2014-09-05 20:08 ` [PATCH 02/12] staging/lustre/osc: " John L. Hammond
@ 2014-09-05 20:08 ` John L. Hammond
  2014-09-05 20:08 ` [PATCH 04/12] staging/lustre: remove obd_ost.h John L. Hammond
                   ` (8 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: John L. Hammond @ 2014-09-05 20:08 UTC (permalink / raw
  To: greg, andreas.dilger, oleg.drokin; +Cc: linux-kernel, John L. Hammond

From: "John L. Hammond" <john.hammond@intel.com>

In osc_request.c there is no reason to handle any llog contexts since
they are never setup. Remove the functions unused function
osc_llog_init() and the obsolete function osc_llog_finish(). Remove
the llog cleanup code in osc_disconnect() and osc_precleanup().

Signed-off-by: John L. Hammond <john.hammond@intel.com>
---
 drivers/staging/lustre/lustre/osc/osc_request.c |   47 +----------------------
 1 file changed, 1 insertion(+), 46 deletions(-)

diff --git a/drivers/staging/lustre/lustre/osc/osc_request.c b/drivers/staging/lustre/lustre/osc/osc_request.c
index 86e9e97..ecca3eb 100644
--- a/drivers/staging/lustre/lustre/osc/osc_request.c
+++ b/drivers/staging/lustre/lustre/osc/osc_request.c
@@ -47,10 +47,10 @@
 
 #include "../include/lustre_ha.h"
 #include "../include/lprocfs_status.h"
-#include "../include/lustre_log.h"
 #include "../include/lustre_debug.h"
 #include "../include/lustre_param.h"
 #include "../include/lustre_fid.h"
+#include "../include/obd_class.h"
 #include "osc_internal.h"
 #include "osc_cl_internal.h"
 
@@ -2961,32 +2961,6 @@ static int osc_set_info_async(const struct lu_env *env, struct obd_export *exp,
 	return 0;
 }
 
-
-static int osc_llog_init(struct obd_device *obd, struct obd_llog_group *olg,
-			 struct obd_device *disk_obd, int *index)
-{
-	/* this code is not supposed to be used with LOD/OSP
-	 * to be removed soon */
-	LBUG();
-	return 0;
-}
-
-static int osc_llog_finish(struct obd_device *obd, int count)
-{
-	struct llog_ctxt *ctxt;
-
-	ctxt = llog_get_context(obd, LLOG_MDS_OST_ORIG_CTXT);
-	if (ctxt) {
-		llog_cat_close(NULL, ctxt->loc_handle);
-		llog_cleanup(NULL, ctxt);
-	}
-
-	ctxt = llog_get_context(obd, LLOG_SIZE_REPL_CTXT);
-	if (ctxt)
-		llog_cleanup(NULL, ctxt);
-	return 0;
-}
-
 static int osc_reconnect(const struct lu_env *env,
 			 struct obd_export *exp, struct obd_device *obd,
 			 struct obd_uuid *cluuid,
@@ -3016,22 +2990,8 @@ static int osc_reconnect(const struct lu_env *env,
 static int osc_disconnect(struct obd_export *exp)
 {
 	struct obd_device *obd = class_exp2obd(exp);
-	struct llog_ctxt  *ctxt;
 	int rc;
 
-	ctxt = llog_get_context(obd, LLOG_SIZE_REPL_CTXT);
-	if (ctxt) {
-		if (obd->u.cli.cl_conn_count == 1) {
-			/* Flush any remaining cancel messages out to the
-			 * target */
-			llog_sync(ctxt, exp, 0);
-		}
-		llog_ctxt_put(ctxt);
-	} else {
-		CDEBUG(D_HA, "No LLOG_SIZE_REPL_CTXT found in obd %p\n",
-		       obd);
-	}
-
 	rc = client_disconnect_export(exp);
 	/**
 	 * Initially we put del_shrink_grant before disconnect_export, but it
@@ -3254,9 +3214,6 @@ static int osc_precleanup(struct obd_device *obd, enum obd_cleanup_stage stage)
 		obd_cleanup_client_import(obd);
 		ptlrpc_lprocfs_unregister_obd(obd);
 		lprocfs_obd_cleanup(obd);
-		rc = obd_llog_finish(obd, 0);
-		if (rc != 0)
-			CERROR("failed to cleanup llogging subsystems\n");
 		break;
 		}
 	}
@@ -3337,8 +3294,6 @@ struct obd_ops osc_obd_ops = {
 	.o_get_info	     = osc_get_info,
 	.o_set_info_async       = osc_set_info_async,
 	.o_import_event	 = osc_import_event,
-	.o_llog_init	    = osc_llog_init,
-	.o_llog_finish	  = osc_llog_finish,
 	.o_process_config       = osc_process_config,
 	.o_quotactl	     = osc_quotactl,
 	.o_quotacheck	   = osc_quotacheck,
-- 
1.7.9.5


^ permalink raw reply related	[flat|nested] 13+ messages in thread

* [PATCH 04/12] staging/lustre: remove obd_ost.h
  2014-09-05 20:08 [PATCH 00/12] staging/lustre: yet more dead code removal John L. Hammond
                   ` (2 preceding siblings ...)
  2014-09-05 20:08 ` [PATCH 03/12] staging/lustre/osc: remove obsolete llog handling code John L. Hammond
@ 2014-09-05 20:08 ` John L. Hammond
  2014-09-05 20:08 ` [PATCH 05/12] staging/lustre/mdc: remove unused OBD methods John L. Hammond
                   ` (7 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: John L. Hammond @ 2014-09-05 20:08 UTC (permalink / raw
  To: greg, andreas.dilger, oleg.drokin; +Cc: linux-kernel, John L. Hammond

From: "John L. Hammond" <john.hammond@intel.com>

Move the structures defined in lustre/include/obd_ost.h to the one
file that uses them (lustre/osc/osc_request.c). Remove the unused
function osc_update_enqueue(). Remove the then empty header
lustre/include/obd_ost.h.

Signed-off-by: John L. Hammond <john.hammond@intel.com>
---
 .../staging/lustre/lustre/include/lustre_lite.h    |    1 -
 drivers/staging/lustre/lustre/include/lustre_log.h |    1 -
 drivers/staging/lustre/lustre/include/obd_ost.h    |  100 --------------------
 drivers/staging/lustre/lustre/lov/lov_obd.c        |    1 -
 drivers/staging/lustre/lustre/lov/lov_request.c    |    1 -
 drivers/staging/lustre/lustre/obdclass/debug.c     |    1 -
 drivers/staging/lustre/lustre/obdclass/genops.c    |    1 -
 .../staging/lustre/lustre/osc/osc_cl_internal.h    |    1 -
 drivers/staging/lustre/lustre/osc/osc_quota.c      |    2 +-
 drivers/staging/lustre/lustre/osc/osc_request.c    |   90 +++++++++---------
 drivers/staging/lustre/lustre/ptlrpc/recover.c     |    1 -
 11 files changed, 44 insertions(+), 156 deletions(-)
 delete mode 100644 drivers/staging/lustre/lustre/include/obd_ost.h

diff --git a/drivers/staging/lustre/lustre/include/lustre_lite.h b/drivers/staging/lustre/lustre/include/lustre_lite.h
index c10c0d3..df557c2 100644
--- a/drivers/staging/lustre/lustre/include/lustre_lite.h
+++ b/drivers/staging/lustre/lustre/include/lustre_lite.h
@@ -45,7 +45,6 @@
 #include "linux/lustre_lite.h"
 
 #include "obd_class.h"
-#include "obd_ost.h"
 #include "lustre_net.h"
 #include "lustre_mds.h"
 #include "lustre_ha.h"
diff --git a/drivers/staging/lustre/lustre/include/lustre_log.h b/drivers/staging/lustre/lustre/include/lustre_log.h
index 2f50b81..36a2ffb 100644
--- a/drivers/staging/lustre/lustre/include/lustre_log.h
+++ b/drivers/staging/lustre/lustre/include/lustre_log.h
@@ -57,7 +57,6 @@
  */
 
 #include "obd_class.h"
-#include "obd_ost.h"
 #include "lustre/lustre_idl.h"
 #include "dt_object.h"
 
diff --git a/drivers/staging/lustre/lustre/include/obd_ost.h b/drivers/staging/lustre/lustre/include/obd_ost.h
deleted file mode 100644
index a679bb1..0000000
--- a/drivers/staging/lustre/lustre/include/obd_ost.h
+++ /dev/null
@@ -1,100 +0,0 @@
-/*
- * GPL HEADER START
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 only,
- * as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * General Public License version 2 for more details (a copy is included
- * in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU General Public License
- * version 2 along with this program; If not, see
- * http://www.sun.com/software/products/lustre/docs/GPLv2.pdf
- *
- * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
- * CA 95054 USA or visit www.sun.com if you need additional information or
- * have any questions.
- *
- * GPL HEADER END
- */
-/*
- * Copyright (c) 2007, 2010, Oracle and/or its affiliates. All rights reserved.
- * Use is subject to license terms.
- *
- * Copyright (c) 2012, Intel Corporation.
- */
-/*
- * This file is part of Lustre, http://www.lustre.org/
- * Lustre is a trademark of Sun Microsystems, Inc.
- *
- * lustre/include/obd_ost.h
- *
- * Data structures for object storage targets and client: OST & OSC's
- *
- * See also lustre_idl.h for wire formats of requests.
- */
-
-#ifndef _LUSTRE_OST_H
-#define _LUSTRE_OST_H
-
-#include "obd_class.h"
-
-struct osc_brw_async_args {
-	struct obdo       *aa_oa;
-	int		aa_requested_nob;
-	int		aa_nio_count;
-	u32		aa_page_count;
-	int		aa_resends;
-	struct brw_page  **aa_ppga;
-	struct client_obd *aa_cli;
-	struct list_head	 aa_oaps;
-	struct list_head	 aa_exts;
-	struct obd_capa   *aa_ocapa;
-	struct cl_req     *aa_clerq;
-};
-
-#define osc_grant_args osc_brw_async_args
-struct osc_async_args {
-	struct obd_info   *aa_oi;
-};
-
-struct osc_setattr_args {
-	struct obdo	 *sa_oa;
-	obd_enqueue_update_f sa_upcall;
-	void		*sa_cookie;
-};
-
-struct osc_fsync_args {
-	struct obd_info     *fa_oi;
-	obd_enqueue_update_f fa_upcall;
-	void		*fa_cookie;
-};
-
-struct osc_enqueue_args {
-	struct obd_export	*oa_exp;
-	__u64		    *oa_flags;
-	obd_enqueue_update_f      oa_upcall;
-	void		     *oa_cookie;
-	struct ost_lvb	   *oa_lvb;
-	struct lustre_handle     *oa_lockh;
-	struct ldlm_enqueue_info *oa_ei;
-	unsigned int	      oa_agl:1;
-};
-
-extern void osc_update_enqueue(struct lustre_handle *lov_lockhp,
-			       struct lov_oinfo *loi, __u64 flags,
-			       struct ost_lvb *lvb, __u32 mode, int rc);
-
-#if 0
-int osc_extent_blocking_cb(struct ldlm_lock *lock,
-			   struct ldlm_lock_desc *new, void *data,
-			   int flag);
-#endif
-
-#endif
diff --git a/drivers/staging/lustre/lustre/lov/lov_obd.c b/drivers/staging/lustre/lustre/lov/lov_obd.c
index a1f8c7e..d1eb6df 100644
--- a/drivers/staging/lustre/lustre/lov/lov_obd.c
+++ b/drivers/staging/lustre/lustre/lov/lov_obd.c
@@ -51,7 +51,6 @@
 #include "../include/lustre_dlm.h"
 #include "../include/lustre_mds.h"
 #include "../include/obd_class.h"
-#include "../include/obd_ost.h"
 #include "../include/lprocfs_status.h"
 #include "../include/lustre_param.h"
 #include "../include/cl_object.h"
diff --git a/drivers/staging/lustre/lustre/lov/lov_request.c b/drivers/staging/lustre/lustre/lov/lov_request.c
index 19d4d70..f576750 100644
--- a/drivers/staging/lustre/lustre/lov/lov_request.c
+++ b/drivers/staging/lustre/lustre/lov/lov_request.c
@@ -39,7 +39,6 @@
 #include "../../include/linux/libcfs/libcfs.h"
 
 #include "../include/obd_class.h"
-#include "../include/obd_ost.h"
 #include "../include/lustre/lustre_idl.h"
 #include "lov_internal.h"
 
diff --git a/drivers/staging/lustre/lustre/obdclass/debug.c b/drivers/staging/lustre/lustre/obdclass/debug.c
index e8aa42b..d0f8f87 100644
--- a/drivers/staging/lustre/lustre/obdclass/debug.c
+++ b/drivers/staging/lustre/lustre/obdclass/debug.c
@@ -41,7 +41,6 @@
 #define DEBUG_SUBSYSTEM D_OTHER
 
 
-#include "../include/obd_ost.h"
 #include "../include/obd_support.h"
 #include "../include/lustre_debug.h"
 #include "../include/lustre_net.h"
diff --git a/drivers/staging/lustre/lustre/obdclass/genops.c b/drivers/staging/lustre/lustre/obdclass/genops.c
index c2e561d..d5bfbb8 100644
--- a/drivers/staging/lustre/lustre/obdclass/genops.c
+++ b/drivers/staging/lustre/lustre/obdclass/genops.c
@@ -40,7 +40,6 @@
  */
 
 #define DEBUG_SUBSYSTEM S_CLASS
-#include "../include/obd_ost.h"
 #include "../include/obd_class.h"
 #include "../include/lprocfs_status.h"
 
diff --git a/drivers/staging/lustre/lustre/osc/osc_cl_internal.h b/drivers/staging/lustre/lustre/osc/osc_cl_internal.h
index 3aa80d9..ebbd95c 100644
--- a/drivers/staging/lustre/lustre/osc/osc_cl_internal.h
+++ b/drivers/staging/lustre/lustre/osc/osc_cl_internal.h
@@ -50,7 +50,6 @@
 
 #include "../include/obd.h"
 /* osc_build_res_name() */
-#include "../include/obd_ost.h"
 #include "../include/cl_object.h"
 #include "../include/lclient.h"
 #include "osc_internal.h"
diff --git a/drivers/staging/lustre/lustre/osc/osc_quota.c b/drivers/staging/lustre/lustre/osc/osc_quota.c
index 6987261..6690f14 100644
--- a/drivers/staging/lustre/lustre/osc/osc_quota.c
+++ b/drivers/staging/lustre/lustre/osc/osc_quota.c
@@ -28,7 +28,7 @@
  * Code originally extracted from quota directory
  */
 
-#include "../include/obd_ost.h"
+#include "../include/obd_class.h"
 #include "osc_internal.h"
 
 static inline struct osc_quota_info *osc_oqi_alloc(u32 id)
diff --git a/drivers/staging/lustre/lustre/osc/osc_request.c b/drivers/staging/lustre/lustre/osc/osc_request.c
index ecca3eb..e10bacb 100644
--- a/drivers/staging/lustre/lustre/osc/osc_request.c
+++ b/drivers/staging/lustre/lustre/osc/osc_request.c
@@ -43,7 +43,6 @@
 #include "../include/lustre_net.h"
 #include "../include/lustre/lustre_user.h"
 #include "../include/obd_cksum.h"
-#include "../include/obd_ost.h"
 
 #include "../include/lustre_ha.h"
 #include "../include/lprocfs_status.h"
@@ -54,6 +53,47 @@
 #include "osc_internal.h"
 #include "osc_cl_internal.h"
 
+struct osc_brw_async_args {
+	struct obdo       *aa_oa;
+	int		aa_requested_nob;
+	int		aa_nio_count;
+	u32		aa_page_count;
+	int		aa_resends;
+	struct brw_page  **aa_ppga;
+	struct client_obd *aa_cli;
+	struct list_head	 aa_oaps;
+	struct list_head	 aa_exts;
+	struct obd_capa   *aa_ocapa;
+	struct cl_req     *aa_clerq;
+};
+
+struct osc_async_args {
+	struct obd_info   *aa_oi;
+};
+
+struct osc_setattr_args {
+	struct obdo	 *sa_oa;
+	obd_enqueue_update_f sa_upcall;
+	void		*sa_cookie;
+};
+
+struct osc_fsync_args {
+	struct obd_info     *fa_oi;
+	obd_enqueue_update_f fa_upcall;
+	void		*fa_cookie;
+};
+
+struct osc_enqueue_args {
+	struct obd_export	*oa_exp;
+	__u64		    *oa_flags;
+	obd_enqueue_update_f      oa_upcall;
+	void		     *oa_cookie;
+	struct ost_lvb	   *oa_lvb;
+	struct lustre_handle     *oa_lockh;
+	struct ldlm_enqueue_info *oa_ei;
+	unsigned int	      oa_agl:1;
+};
+
 static void osc_release_ppga(struct brw_page **ppga, u32 count);
 static int brw_interpret(const struct lu_env *env,
 			 struct ptlrpc_request *req, void *data, int rc);
@@ -846,7 +886,7 @@ static int osc_shrink_grant_interpret(const struct lu_env *env,
 				      void *aa, int rc)
 {
 	struct client_obd *cli = &req->rq_import->imp_obd->u.cli;
-	struct obdo *oa = ((struct osc_grant_args *)aa)->aa_oa;
+	struct obdo *oa = ((struct osc_brw_async_args *)aa)->aa_oa;
 	struct ost_body *body;
 
 	if (rc != 0) {
@@ -2174,50 +2214,6 @@ static int osc_enqueue_interpret(const struct lu_env *env,
 	return rc;
 }
 
-void osc_update_enqueue(struct lustre_handle *lov_lockhp,
-			struct lov_oinfo *loi, __u64 flags,
-			struct ost_lvb *lvb, __u32 mode, int rc)
-{
-	struct ldlm_lock *lock = ldlm_handle2lock(lov_lockhp);
-
-	if (rc == ELDLM_OK) {
-		__u64 tmp;
-
-		LASSERT(lock != NULL);
-		loi->loi_lvb = *lvb;
-		tmp = loi->loi_lvb.lvb_size;
-		/* Extend KMS up to the end of this lock and no further
-		 * A lock on [x,y] means a KMS of up to y + 1 bytes! */
-		if (tmp > lock->l_policy_data.l_extent.end)
-			tmp = lock->l_policy_data.l_extent.end + 1;
-		if (tmp >= loi->loi_kms) {
-			LDLM_DEBUG(lock, "lock acquired, setting rss=%llu, kms=%llu",
-				   loi->loi_lvb.lvb_size, tmp);
-			loi_kms_set(loi, tmp);
-		} else {
-			LDLM_DEBUG(lock, "lock acquired, setting rss=%llu; leaving kms=%llu, end=%llu",
-				   loi->loi_lvb.lvb_size, loi->loi_kms,
-				   lock->l_policy_data.l_extent.end);
-		}
-		ldlm_lock_allow_match(lock);
-	} else if (rc == ELDLM_LOCK_ABORTED && (flags & LDLM_FL_HAS_INTENT)) {
-		LASSERT(lock != NULL);
-		loi->loi_lvb = *lvb;
-		ldlm_lock_allow_match(lock);
-		CDEBUG(D_INODE, "glimpsed, setting rss=%llu; leaving kms=%llu\n",
-		       loi->loi_lvb.lvb_size, loi->loi_kms);
-		rc = ELDLM_OK;
-	}
-
-	if (lock != NULL) {
-		if (rc != ELDLM_OK)
-			ldlm_lock_fail_match(lock);
-
-		LDLM_LOCK_PUT(lock);
-	}
-}
-EXPORT_SYMBOL(osc_update_enqueue);
-
 struct ptlrpc_request_set *PTLRPCD_SET = (void *)1;
 
 /* When enqueuing asynchronously, locks are not ordered, we can obtain a lock
@@ -2935,7 +2931,7 @@ static int osc_set_info_async(const struct lu_env *env, struct obd_export *exp,
 	memcpy(tmp, val, vallen);
 
 	if (KEY_IS(KEY_GRANT_SHRINK)) {
-		struct osc_grant_args *aa;
+		struct osc_brw_async_args *aa;
 		struct obdo *oa;
 
 		CLASSERT(sizeof(*aa) <= sizeof(req->rq_async_args));
diff --git a/drivers/staging/lustre/lustre/ptlrpc/recover.c b/drivers/staging/lustre/lustre/ptlrpc/recover.c
index 5e4a1a5..e26e5b8 100644
--- a/drivers/staging/lustre/lustre/ptlrpc/recover.c
+++ b/drivers/staging/lustre/lustre/ptlrpc/recover.c
@@ -47,7 +47,6 @@
 #include "../include/lustre_import.h"
 #include "../include/lustre_export.h"
 #include "../include/obd.h"
-#include "../include/obd_ost.h"
 #include "../include/obd_class.h"
 #include <linux/list.h>
 
-- 
1.7.9.5


^ permalink raw reply related	[flat|nested] 13+ messages in thread

* [PATCH 05/12] staging/lustre/mdc: remove unused OBD methods
  2014-09-05 20:08 [PATCH 00/12] staging/lustre: yet more dead code removal John L. Hammond
                   ` (3 preceding siblings ...)
  2014-09-05 20:08 ` [PATCH 04/12] staging/lustre: remove obd_ost.h John L. Hammond
@ 2014-09-05 20:08 ` John L. Hammond
  2014-09-05 20:08 ` [PATCH 06/12] staging/lustre/mdc: inline llog methods John L. Hammond
                   ` (6 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: John L. Hammond @ 2014-09-05 20:08 UTC (permalink / raw
  To: greg, andreas.dilger, oleg.drokin; +Cc: linux-kernel, John L. Hammond

From: "John L. Hammond" <john.hammond@intel.com>

Remove the unused OBD device methods mdc_pin() and mdc_unpin().

Signed-off-by: John L. Hammond <john.hammond@intel.com>
---
 drivers/staging/lustre/lustre/mdc/mdc_request.c |   90 -----------------------
 1 file changed, 90 deletions(-)

diff --git a/drivers/staging/lustre/lustre/mdc/mdc_request.c b/drivers/staging/lustre/lustre/mdc/mdc_request.c
index e6e2515..bc219d1 100644
--- a/drivers/staging/lustre/lustre/mdc/mdc_request.c
+++ b/drivers/staging/lustre/lustre/mdc/mdc_request.c
@@ -2263,94 +2263,6 @@ int mdc_get_info(const struct lu_env *env, struct obd_export *exp,
 	return rc;
 }
 
-static int mdc_pin(struct obd_export *exp, const struct lu_fid *fid,
-		   struct obd_capa *oc, struct obd_client_handle *handle,
-		   int flags)
-{
-	struct ptlrpc_request *req;
-	struct mdt_body       *body;
-	int		    rc;
-
-	req = ptlrpc_request_alloc(class_exp2cliimp(exp), &RQF_MDS_PIN);
-	if (req == NULL)
-		return -ENOMEM;
-
-	mdc_set_capa_size(req, &RMF_CAPA1, oc);
-
-	rc = ptlrpc_request_pack(req, LUSTRE_MDS_VERSION, MDS_PIN);
-	if (rc) {
-		ptlrpc_request_free(req);
-		return rc;
-	}
-
-	mdc_pack_body(req, fid, oc, 0, 0, -1, flags);
-
-	ptlrpc_request_set_replen(req);
-
-	mdc_get_rpc_lock(exp->exp_obd->u.cli.cl_rpc_lock, NULL);
-	rc = ptlrpc_queue_wait(req);
-	mdc_put_rpc_lock(exp->exp_obd->u.cli.cl_rpc_lock, NULL);
-	if (rc) {
-		CERROR("Pin failed: %d\n", rc);
-		goto err_out;
-	}
-
-	body = req_capsule_server_get(&req->rq_pill, &RMF_MDT_BODY);
-	if (body == NULL) {
-		rc = -EPROTO;
-		goto err_out;
-	}
-
-	handle->och_fh = body->handle;
-	handle->och_magic = OBD_CLIENT_HANDLE_MAGIC;
-
-	handle->och_mod = obd_mod_alloc();
-	if (handle->och_mod == NULL) {
-		DEBUG_REQ(D_ERROR, req, "can't allocate md_open_data");
-		rc = -ENOMEM;
-		goto err_out;
-	}
-	handle->och_mod->mod_open_req = req; /* will be dropped by unpin */
-
-	return 0;
-
-err_out:
-	ptlrpc_req_finished(req);
-	return rc;
-}
-
-static int mdc_unpin(struct obd_export *exp, struct obd_client_handle *handle,
-		     int flag)
-{
-	struct ptlrpc_request *req;
-	struct mdt_body       *body;
-	int		    rc;
-
-	req = ptlrpc_request_alloc_pack(class_exp2cliimp(exp), &RQF_MDS_UNPIN,
-					LUSTRE_MDS_VERSION, MDS_UNPIN);
-	if (req == NULL)
-		return -ENOMEM;
-
-	body = req_capsule_client_get(&req->rq_pill, &RMF_MDT_BODY);
-	body->handle = handle->och_fh;
-	body->flags = flag;
-
-	ptlrpc_request_set_replen(req);
-
-	mdc_get_rpc_lock(exp->exp_obd->u.cli.cl_rpc_lock, NULL);
-	rc = ptlrpc_queue_wait(req);
-	mdc_put_rpc_lock(exp->exp_obd->u.cli.cl_rpc_lock, NULL);
-
-	if (rc != 0)
-		CERROR("Unpin failed: %d\n", rc);
-
-	ptlrpc_req_finished(req);
-	ptlrpc_req_finished(handle->och_mod->mod_open_req);
-
-	obd_mod_put(handle->och_mod);
-	return rc;
-}
-
 int mdc_sync(struct obd_export *exp, const struct lu_fid *fid,
 	     struct obd_capa *oc, struct ptlrpc_request **request)
 {
@@ -2756,8 +2668,6 @@ struct obd_ops mdc_obd_ops = {
 	.o_iocontrol	= mdc_iocontrol,
 	.o_set_info_async   = mdc_set_info_async,
 	.o_statfs	   = mdc_statfs,
-	.o_pin	      = mdc_pin,
-	.o_unpin	    = mdc_unpin,
 	.o_fid_init	    = client_fid_init,
 	.o_fid_fini	    = client_fid_fini,
 	.o_fid_alloc	= mdc_fid_alloc,
-- 
1.7.9.5


^ permalink raw reply related	[flat|nested] 13+ messages in thread

* [PATCH 06/12] staging/lustre/mdc: inline llog methods
  2014-09-05 20:08 [PATCH 00/12] staging/lustre: yet more dead code removal John L. Hammond
                   ` (4 preceding siblings ...)
  2014-09-05 20:08 ` [PATCH 05/12] staging/lustre/mdc: remove unused OBD methods John L. Hammond
@ 2014-09-05 20:08 ` John L. Hammond
  2014-09-05 20:08 ` [PATCH 07/12] staging/lustre/mgc: inline mgc_cancel() John L. Hammond
                   ` (5 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: John L. Hammond @ 2014-09-05 20:08 UTC (permalink / raw
  To: greg, andreas.dilger, oleg.drokin; +Cc: linux-kernel, John L. Hammond

From: "John L. Hammond" <john.hammond@intel.com>

In mdc_setup() and mdc_precleanup() call mdc_llog_init() and
mdc_llog_finish() directly rather than through the OBD method wrappers
obd_llog_init() and obd_llod_finish(). Simplify the prototypes of
mdc_llog_init() and mdc_llog_finish() according to their uses.

Signed-off-by: John L. Hammond <john.hammond@intel.com>
---
 drivers/staging/lustre/lustre/mdc/mdc_request.c |   67 ++++++++++-------------
 1 file changed, 29 insertions(+), 38 deletions(-)

diff --git a/drivers/staging/lustre/lustre/mdc/mdc_request.c b/drivers/staging/lustre/lustre/mdc/mdc_request.c
index bc219d1..780cb00 100644
--- a/drivers/staging/lustre/lustre/mdc/mdc_request.c
+++ b/drivers/staging/lustre/lustre/mdc/mdc_request.c
@@ -2394,6 +2394,33 @@ struct ldlm_valblock_ops inode_lvbo = {
 	.lvbo_free = mdc_resource_inode_free,
 };
 
+static int mdc_llog_init(struct obd_device *obd)
+{
+	struct obd_llog_group	*olg = &obd->obd_olg;
+	struct llog_ctxt	*ctxt;
+	int			 rc;
+
+	rc = llog_setup(NULL, obd, olg, LLOG_CHANGELOG_REPL_CTXT, obd,
+			&llog_client_ops);
+	if (rc)
+		return rc;
+
+	ctxt = llog_group_get_ctxt(olg, LLOG_CHANGELOG_REPL_CTXT);
+	llog_initiator_connect(ctxt);
+	llog_ctxt_put(ctxt);
+
+	return 0;
+}
+
+static void mdc_llog_finish(struct obd_device *obd)
+{
+	struct llog_ctxt *ctxt;
+
+	ctxt = llog_get_context(obd, LLOG_CHANGELOG_REPL_CTXT);
+	if (ctxt)
+		llog_cleanup(NULL, ctxt);
+}
+
 static int mdc_setup(struct obd_device *obd, struct lustre_cfg *cfg)
 {
 	struct client_obd *cli = &obd->u.cli;
@@ -2426,7 +2453,7 @@ static int mdc_setup(struct obd_device *obd, struct lustre_cfg *cfg)
 
 	obd->obd_namespace->ns_lvbo = &inode_lvbo;
 
-	rc = obd_llog_init(obd, &obd->obd_olg, obd, NULL);
+	rc = mdc_llog_init(obd);
 	if (rc) {
 		mdc_cleanup(obd);
 		CERROR("failed to setup llogging subsystems\n");
@@ -2487,9 +2514,7 @@ static int mdc_precleanup(struct obd_device *obd, enum obd_cleanup_stage stage)
 		ptlrpc_lprocfs_unregister_obd(obd);
 		lprocfs_obd_cleanup(obd);
 
-		rc = obd_llog_finish(obd, 0);
-		if (rc != 0)
-			CERROR("failed to cleanup llogging subsystems\n");
+		mdc_llog_finish(obd);
 		break;
 	}
 	return rc;
@@ -2507,38 +2532,6 @@ static int mdc_cleanup(struct obd_device *obd)
 	return client_obd_cleanup(obd);
 }
 
-
-static int mdc_llog_init(struct obd_device *obd, struct obd_llog_group *olg,
-			 struct obd_device *tgt, int *index)
-{
-	struct llog_ctxt	*ctxt;
-	int			 rc;
-
-	LASSERT(olg == &obd->obd_olg);
-
-	rc = llog_setup(NULL, obd, olg, LLOG_CHANGELOG_REPL_CTXT, tgt,
-			&llog_client_ops);
-	if (rc)
-		return rc;
-
-	ctxt = llog_group_get_ctxt(olg, LLOG_CHANGELOG_REPL_CTXT);
-	llog_initiator_connect(ctxt);
-	llog_ctxt_put(ctxt);
-
-	return 0;
-}
-
-static int mdc_llog_finish(struct obd_device *obd, int count)
-{
-	struct llog_ctxt *ctxt;
-
-	ctxt = llog_get_context(obd, LLOG_CHANGELOG_REPL_CTXT);
-	if (ctxt)
-		llog_cleanup(NULL, ctxt);
-
-	return 0;
-}
-
 static int mdc_process_config(struct obd_device *obd, u32 len, void *buf)
 {
 	struct lustre_cfg *lcfg = buf;
@@ -2672,8 +2665,6 @@ struct obd_ops mdc_obd_ops = {
 	.o_fid_fini	    = client_fid_fini,
 	.o_fid_alloc	= mdc_fid_alloc,
 	.o_import_event     = mdc_import_event,
-	.o_llog_init	= mdc_llog_init,
-	.o_llog_finish      = mdc_llog_finish,
 	.o_get_info	 = mdc_get_info,
 	.o_process_config   = mdc_process_config,
 	.o_get_uuid	 = mdc_get_uuid,
-- 
1.7.9.5


^ permalink raw reply related	[flat|nested] 13+ messages in thread

* [PATCH 07/12] staging/lustre/mgc: inline mgc_cancel()
  2014-09-05 20:08 [PATCH 00/12] staging/lustre: yet more dead code removal John L. Hammond
                   ` (5 preceding siblings ...)
  2014-09-05 20:08 ` [PATCH 06/12] staging/lustre/mdc: inline llog methods John L. Hammond
@ 2014-09-05 20:08 ` John L. Hammond
  2014-09-05 20:08 ` [PATCH 08/12] staging/lustre: remove unused OBD methods John L. Hammond
                   ` (4 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: John L. Hammond @ 2014-09-05 20:08 UTC (permalink / raw
  To: greg, andreas.dilger, oleg.drokin; +Cc: linux-kernel, John L. Hammond

From: "John L. Hammond" <john.hammond@intel.com>

The function mgc_cancel() is never invoked as an OBD device method and
is only called directly from mgc_process_log() so remove it.

Signed-off-by: John L. Hammond <john.hammond@intel.com>
---
 drivers/staging/lustre/lustre/mgc/mgc_request.c |   17 ++---------------
 1 file changed, 2 insertions(+), 15 deletions(-)

diff --git a/drivers/staging/lustre/lustre/mgc/mgc_request.c b/drivers/staging/lustre/lustre/mgc/mgc_request.c
index 970e91c..cb0e6f9 100644
--- a/drivers/staging/lustre/lustre/mgc/mgc_request.c
+++ b/drivers/staging/lustre/lustre/mgc/mgc_request.c
@@ -904,14 +904,6 @@ static int mgc_enqueue(struct obd_export *exp, struct lov_stripe_md *lsm,
 	return rc;
 }
 
-static int mgc_cancel(struct obd_export *exp, struct lov_stripe_md *md,
-		      __u32 mode, struct lustre_handle *lockh)
-{
-	ldlm_lock_decref(lockh, mode);
-
-	return 0;
-}
-
 static void mgc_notify_active(struct obd_device *unused)
 {
 	/* wakeup mgc_requeue_thread to requeue mgc lock */
@@ -1679,12 +1671,8 @@ int mgc_process_log(struct obd_device *mgc, struct config_llog_data *cld)
 	mutex_unlock(&cld->cld_lock);
 
 	/* Now drop the lock so MGS can revoke it */
-	if (!rcl) {
-		rcl = mgc_cancel(mgc->u.cli.cl_mgc_mgsexp, NULL,
-				 LCK_CR, &lockh);
-		if (rcl)
-			CERROR("Can't drop cfg lock: %d\n", rcl);
-	}
+	if (!rcl)
+		ldlm_lock_decref(&lockh, LCK_CR);
 
 	return rc;
 }
@@ -1814,7 +1802,6 @@ struct obd_ops mgc_obd_ops = {
 	.o_connect      = client_connect_import,
 	.o_disconnect   = client_disconnect_export,
 	/* .o_enqueue      = mgc_enqueue, */
-	.o_cancel       = mgc_cancel,
 	/* .o_iocontrol    = mgc_iocontrol, */
 	.o_set_info_async = mgc_set_info_async,
 	.o_get_info       = mgc_get_info,
-- 
1.7.9.5


^ permalink raw reply related	[flat|nested] 13+ messages in thread

* [PATCH 08/12] staging/lustre: remove unused OBD methods
  2014-09-05 20:08 [PATCH 00/12] staging/lustre: yet more dead code removal John L. Hammond
                   ` (6 preceding siblings ...)
  2014-09-05 20:08 ` [PATCH 07/12] staging/lustre/mgc: inline mgc_cancel() John L. Hammond
@ 2014-09-05 20:08 ` John L. Hammond
  2014-09-05 20:08 ` [PATCH 09/12] staging/lustre/mgc: remove server specific llog handling John L. Hammond
                   ` (3 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: John L. Hammond @ 2014-09-05 20:08 UTC (permalink / raw
  To: greg, andreas.dilger, oleg.drokin; +Cc: linux-kernel, John L. Hammond

From: "John L. Hammond" <john.hammond@intel.com>

Remove the unused OBD device methods:
    obd_brw()
    obd_cancel()
    obd_cancel_unused()
    obd_change_cbdata()
    obd_create_async()
    obd_enqueue()
    obd_enqueue_rqset()
    obd_extent_calc()
    obd_llog_connect()
    obd_llog_finish()
    obd_llog_init()
    obd_merge_lvb()
    obd_pin()
    obd_pin_observer()
    obd_ping()
    obd_precreate()
    obd_punch()
    obd_punch_rqset()
    obd_sync()
    obd_sync_rqset()
    obd_unpin()
    obd_unpin_observer()

Signed-off-by: John L. Hammond <john.hammond@intel.com>
---
 drivers/staging/lustre/lustre/include/lustre_log.h |    5 -
 drivers/staging/lustre/lustre/include/obd.h        |   47 ----
 drivers/staging/lustre/lustre/include/obd_class.h  |  279 --------------------
 drivers/staging/lustre/lustre/obdclass/llog_obd.c  |   25 --
 .../lustre/lustre/obdclass/lprocfs_status.c        |   20 --
 5 files changed, 376 deletions(-)

diff --git a/drivers/staging/lustre/lustre/include/lustre_log.h b/drivers/staging/lustre/lustre/include/lustre_log.h
index 36a2ffb..c10029c 100644
--- a/drivers/staging/lustre/lustre/include/lustre_log.h
+++ b/drivers/staging/lustre/lustre/include/lustre_log.h
@@ -206,11 +206,6 @@ int llog_sync(struct llog_ctxt *ctxt, struct obd_export *exp, int flags);
 int llog_cancel(const struct lu_env *env, struct llog_ctxt *ctxt,
 		struct llog_cookie *cookies, int flags);
 
-int obd_llog_init(struct obd_device *obd, struct obd_llog_group *olg,
-		  struct obd_device *disk_obd, int *idx);
-
-int obd_llog_finish(struct obd_device *obd, int count);
-
 /* llog_ioctl.c */
 int llog_ioctl(const struct lu_env *env, struct llog_ctxt *ctxt, int cmd,
 	       struct obd_ioctl_data *data);
diff --git a/drivers/staging/lustre/lustre/include/obd.h b/drivers/staging/lustre/lustre/include/obd.h
index 9f13878..66fc457 100644
--- a/drivers/staging/lustre/lustre/include/obd.h
+++ b/drivers/staging/lustre/lustre/include/obd.h
@@ -1189,13 +1189,9 @@ struct obd_ops {
 			  struct lov_mds_md *disk_src, int disk_len);
 	int (*o_preallocate)(struct lustre_handle *, u32 *req, u64 *ids);
 	/* FIXME: add fid capability support for create & destroy! */
-	int (*o_precreate)(struct obd_export *exp);
 	int (*o_create)(const struct lu_env *env, struct obd_export *exp,
 			struct obdo *oa, struct lov_stripe_md **ea,
 			struct obd_trans_info *oti);
-	int (*o_create_async)(struct obd_export *exp,  struct obd_info *oinfo,
-			      struct lov_stripe_md **ea,
-			      struct obd_trans_info *oti);
 	int (*o_destroy)(const struct lu_env *env, struct obd_export *exp,
 			 struct obdo *oa, struct lov_stripe_md *ea,
 			 struct obd_trans_info *oti, struct obd_export *md_exp,
@@ -1209,28 +1205,8 @@ struct obd_ops {
 			 struct obd_info *oinfo);
 	int (*o_getattr_async)(struct obd_export *exp, struct obd_info *oinfo,
 			       struct ptlrpc_request_set *set);
-	int (*o_brw)(int rw, struct obd_export *exp, struct obd_info *oinfo,
-		     u32 oa_bufs, struct brw_page *pgarr,
-		     struct obd_trans_info *oti);
-	int (*o_merge_lvb)(struct obd_export *exp, struct lov_stripe_md *lsm,
-			   struct ost_lvb *lvb, int kms_only);
 	int (*o_adjust_kms)(struct obd_export *exp, struct lov_stripe_md *lsm,
 			    u64 size, int shrink);
-	int (*o_punch)(const struct lu_env *, struct obd_export *exp,
-		       struct obd_info *oinfo, struct obd_trans_info *oti,
-		       struct ptlrpc_request_set *rqset);
-	int (*o_sync)(const struct lu_env *env, struct obd_export *exp,
-		      struct obd_info *oinfo, u64 start, u64 end,
-		      struct ptlrpc_request_set *set);
-	int (*o_migrate)(struct lustre_handle *conn, struct lov_stripe_md *dst,
-			 struct lov_stripe_md *src, u64 start,
-			 u64 end, struct obd_trans_info *oti);
-	int (*o_copy)(struct lustre_handle *dstconn, struct lov_stripe_md *dst,
-		      struct lustre_handle *srconn, struct lov_stripe_md *src,
-		      u64 start, u64 end, struct obd_trans_info *);
-	int (*o_iterate)(struct lustre_handle *conn,
-			 int (*)(u64, u64, void *),
-			 u64 *startid, u64 seq, void *data);
 	int (*o_preprw)(const struct lu_env *env, int cmd,
 			struct obd_export *exp, struct obdo *oa, int objcount,
 			struct obd_ioobj *obj, struct niobuf_remote *remote,
@@ -1242,33 +1218,12 @@ struct obd_ops {
 			  struct niobuf_remote *remote, int pages,
 			  struct niobuf_local *local,
 			  struct obd_trans_info *oti, int rc);
-	int (*o_enqueue)(struct obd_export *, struct obd_info *oinfo,
-			 struct ldlm_enqueue_info *einfo,
-			 struct ptlrpc_request_set *rqset);
-	int (*o_change_cbdata)(struct obd_export *, struct lov_stripe_md *,
-			       ldlm_iterator_t it, void *data);
 	int (*o_find_cbdata)(struct obd_export *, struct lov_stripe_md *,
 			     ldlm_iterator_t it, void *data);
-	int (*o_cancel)(struct obd_export *, struct lov_stripe_md *md,
-			__u32 mode, struct lustre_handle *);
-	int (*o_cancel_unused)(struct obd_export *, struct lov_stripe_md *,
-			       ldlm_cancel_flags_t flags, void *opaque);
 	int (*o_init_export)(struct obd_export *exp);
 	int (*o_destroy_export)(struct obd_export *exp);
-	int (*o_extent_calc)(struct obd_export *, struct lov_stripe_md *,
-			     int cmd, u64 *);
-
-	/* llog related obd_methods */
-	int (*o_llog_init)(struct obd_device *obd, struct obd_llog_group *grp,
-			   struct obd_device *disk_obd, int *idx);
-	int (*o_llog_finish)(struct obd_device *obd, int count);
-	int (*o_llog_connect)(struct obd_export *, struct llogd_conn_body *);
 
 	/* metadata-only methods */
-	int (*o_pin)(struct obd_export *, const struct lu_fid *fid,
-		     struct obd_capa *, struct obd_client_handle *, int flag);
-	int (*o_unpin)(struct obd_export *, struct obd_client_handle *, int);
-
 	int (*o_import_event)(struct obd_device *, struct obd_import *,
 			      enum obd_import_event);
 
@@ -1284,8 +1239,6 @@ struct obd_ops {
 	int (*o_quotactl)(struct obd_device *, struct obd_export *,
 			  struct obd_quotactl *);
 
-	int (*o_ping)(const struct lu_env *, struct obd_export *exp);
-
 	/* pools methods */
 	int (*o_pool_new)(struct obd_device *obd, char *poolname);
 	int (*o_pool_del)(struct obd_device *obd, char *poolname);
diff --git a/drivers/staging/lustre/lustre/include/obd_class.h b/drivers/staging/lustre/lustre/include/obd_class.h
index 65143ab..9030171 100644
--- a/drivers/staging/lustre/lustre/include/obd_class.h
+++ b/drivers/staging/lustre/lustre/include/obd_class.h
@@ -776,31 +776,6 @@ static inline int obd_free_memmd(struct obd_export *exp,
 	return rc;
 }
 
-static inline int obd_precreate(struct obd_export *exp)
-{
-	int rc;
-
-	EXP_CHECK_DT_OP(exp, precreate);
-	OBD_COUNTER_INCREMENT(exp->exp_obd, precreate);
-
-	rc = OBP(exp->exp_obd, precreate)(exp);
-	return rc;
-}
-
-static inline int obd_create_async(struct obd_export *exp,
-				   struct obd_info *oinfo,
-				   struct lov_stripe_md **ea,
-				   struct obd_trans_info *oti)
-{
-	int rc;
-
-	EXP_CHECK_DT_OP(exp, create_async);
-	EXP_COUNTER_INCREMENT(exp, create_async);
-
-	rc = OBP(exp->exp_obd, create_async)(exp, oinfo, ea, oti);
-	return rc;
-}
-
 static inline int obd_create(const struct lu_env *env, struct obd_export *exp,
 			     struct obdo *obdo, struct lov_stripe_md **ea,
 			     struct obd_trans_info *oti)
@@ -1037,17 +1012,6 @@ static inline int obd_fid_alloc(struct obd_export *exp,
 	return rc;
 }
 
-static inline int obd_ping(const struct lu_env *env, struct obd_export *exp)
-{
-	int rc;
-
-	OBD_CHECK_DT_OP(exp->exp_obd, ping, 0);
-	EXP_COUNTER_INCREMENT(exp, ping);
-
-	rc = OBP(exp->exp_obd, ping)(env, exp);
-	return rc;
-}
-
 static inline int obd_pool_new(struct obd_device *obd, char *poolname)
 {
 	int rc;
@@ -1126,17 +1090,6 @@ static inline int obd_destroy_export(struct obd_export *exp)
 	return 0;
 }
 
-static inline int obd_extent_calc(struct obd_export *exp,
-				  struct lov_stripe_md *md,
-				  int cmd, u64 *offset)
-{
-	int rc;
-
-	EXP_CHECK_DT_OP(exp, extent_calc);
-	rc = OBP(exp->exp_obd, extent_calc)(exp, md, cmd, offset);
-	return rc;
-}
-
 static inline struct dentry *
 obd_lvfs_fid2dentry(struct obd_export *exp, struct ost_id *oi, __u32 gen)
 {
@@ -1244,92 +1197,6 @@ static inline int obd_statfs(const struct lu_env *env, struct obd_export *exp,
 	return rc;
 }
 
-static inline int obd_sync_rqset(struct obd_export *exp, struct obd_info *oinfo,
-				 u64 start, u64 end)
-{
-	struct ptlrpc_request_set *set = NULL;
-	int rc;
-
-	OBD_CHECK_DT_OP(exp->exp_obd, sync, -EOPNOTSUPP);
-	EXP_COUNTER_INCREMENT(exp, sync);
-
-	set =  ptlrpc_prep_set();
-	if (set == NULL)
-		return -ENOMEM;
-
-	rc = OBP(exp->exp_obd, sync)(NULL, exp, oinfo, start, end, set);
-	if (rc == 0)
-		rc = ptlrpc_set_wait(set);
-	ptlrpc_set_destroy(set);
-	return rc;
-}
-
-static inline int obd_sync(const struct lu_env *env, struct obd_export *exp,
-			   struct obd_info *oinfo, u64 start, u64 end,
-			   struct ptlrpc_request_set *set)
-{
-	int rc;
-
-	OBD_CHECK_DT_OP(exp->exp_obd, sync, -EOPNOTSUPP);
-	EXP_COUNTER_INCREMENT(exp, sync);
-
-	rc = OBP(exp->exp_obd, sync)(env, exp, oinfo, start, end, set);
-	return rc;
-}
-
-static inline int obd_punch_rqset(struct obd_export *exp,
-				  struct obd_info *oinfo,
-				  struct obd_trans_info *oti)
-{
-	struct ptlrpc_request_set *set = NULL;
-	int rc;
-
-	EXP_CHECK_DT_OP(exp, punch);
-	EXP_COUNTER_INCREMENT(exp, punch);
-
-	set =  ptlrpc_prep_set();
-	if (set == NULL)
-		return -ENOMEM;
-
-	rc = OBP(exp->exp_obd, punch)(NULL, exp, oinfo, oti, set);
-	if (rc == 0)
-		rc = ptlrpc_set_wait(set);
-	ptlrpc_set_destroy(set);
-	return rc;
-}
-
-static inline int obd_punch(const struct lu_env *env, struct obd_export *exp,
-			    struct obd_info *oinfo, struct obd_trans_info *oti,
-			    struct ptlrpc_request_set *rqset)
-{
-	int rc;
-
-	EXP_CHECK_DT_OP(exp, punch);
-	EXP_COUNTER_INCREMENT(exp, punch);
-
-	rc = OBP(exp->exp_obd, punch)(env, exp, oinfo, oti, rqset);
-	return rc;
-}
-
-static inline int obd_brw(int cmd, struct obd_export *exp,
-			  struct obd_info *oinfo, u32 oa_bufs,
-			  struct brw_page *pg, struct obd_trans_info *oti)
-{
-	int rc;
-
-	EXP_CHECK_DT_OP(exp, brw);
-	EXP_COUNTER_INCREMENT(exp, brw);
-
-	if (!(cmd & (OBD_BRW_RWMASK | OBD_BRW_CHECK))) {
-		CERROR("obd_brw: cmd must be OBD_BRW_READ, OBD_BRW_WRITE, "
-		       "or OBD_BRW_CHECK\n");
-		LBUG();
-	}
-
-	rc = OBP(exp->exp_obd, brw)(cmd, exp, oinfo, oa_bufs, pg, oti);
-	return rc;
-}
-
 static inline int obd_preprw(const struct lu_env *env, int cmd,
 			     struct obd_export *exp, struct obdo *oa,
 			     int objcount, struct obd_ioobj *obj,
@@ -1363,19 +1230,6 @@ static inline int obd_commitrw(const struct lu_env *env, int cmd,
 	return rc;
 }
 
-static inline int obd_merge_lvb(struct obd_export *exp,
-				struct lov_stripe_md *lsm,
-				struct ost_lvb *lvb, int kms_only)
-{
-	int rc;
-
-	EXP_CHECK_DT_OP(exp, merge_lvb);
-	EXP_COUNTER_INCREMENT(exp, merge_lvb);
-
-	rc = OBP(exp->exp_obd, merge_lvb)(exp, lsm, lvb, kms_only);
-	return rc;
-}
-
 static inline int obd_adjust_kms(struct obd_export *exp,
 				 struct lov_stripe_md *lsm, u64 size,
 				 int shrink)
@@ -1401,54 +1255,6 @@ static inline int obd_iocontrol(unsigned int cmd, struct obd_export *exp,
 	return rc;
 }
 
-static inline int obd_enqueue_rqset(struct obd_export *exp,
-				    struct obd_info *oinfo,
-				    struct ldlm_enqueue_info *einfo)
-{
-	struct ptlrpc_request_set *set = NULL;
-	int rc;
-
-	EXP_CHECK_DT_OP(exp, enqueue);
-	EXP_COUNTER_INCREMENT(exp, enqueue);
-
-	set =  ptlrpc_prep_set();
-	if (set == NULL)
-		return -ENOMEM;
-
-	rc = OBP(exp->exp_obd, enqueue)(exp, oinfo, einfo, set);
-	if (rc == 0)
-		rc = ptlrpc_set_wait(set);
-	ptlrpc_set_destroy(set);
-	return rc;
-}
-
-static inline int obd_enqueue(struct obd_export *exp,
-			      struct obd_info *oinfo,
-			      struct ldlm_enqueue_info *einfo,
-			      struct ptlrpc_request_set *set)
-{
-	int rc;
-
-	EXP_CHECK_DT_OP(exp, enqueue);
-	EXP_COUNTER_INCREMENT(exp, enqueue);
-
-	rc = OBP(exp->exp_obd, enqueue)(exp, oinfo, einfo, set);
-	return rc;
-}
-
-static inline int obd_change_cbdata(struct obd_export *exp,
-				    struct lov_stripe_md *lsm,
-				    ldlm_iterator_t it, void *data)
-{
-	int rc;
-
-	EXP_CHECK_DT_OP(exp, change_cbdata);
-	EXP_COUNTER_INCREMENT(exp, change_cbdata);
-
-	rc = OBP(exp->exp_obd, change_cbdata)(exp, lsm, it, data);
-	return rc;
-}
-
 static inline int obd_find_cbdata(struct obd_export *exp,
 				  struct lov_stripe_md *lsm,
 				  ldlm_iterator_t it, void *data)
@@ -1462,59 +1268,6 @@ static inline int obd_find_cbdata(struct obd_export *exp,
 	return rc;
 }
 
-static inline int obd_cancel(struct obd_export *exp,
-			     struct lov_stripe_md *ea, __u32 mode,
-			     struct lustre_handle *lockh)
-{
-	int rc;
-
-	EXP_CHECK_DT_OP(exp, cancel);
-	EXP_COUNTER_INCREMENT(exp, cancel);
-
-	rc = OBP(exp->exp_obd, cancel)(exp, ea, mode, lockh);
-	return rc;
-}
-
-static inline int obd_cancel_unused(struct obd_export *exp,
-				    struct lov_stripe_md *ea,
-				    ldlm_cancel_flags_t flags,
-				    void *opaque)
-{
-	int rc;
-
-	EXP_CHECK_DT_OP(exp, cancel_unused);
-	EXP_COUNTER_INCREMENT(exp, cancel_unused);
-
-	rc = OBP(exp->exp_obd, cancel_unused)(exp, ea, flags, opaque);
-	return rc;
-}
-
-static inline int obd_pin(struct obd_export *exp, const struct lu_fid *fid,
-			  struct obd_capa *oc, struct obd_client_handle *handle,
-			  int flag)
-{
-	int rc;
-
-	EXP_CHECK_DT_OP(exp, pin);
-	EXP_COUNTER_INCREMENT(exp, pin);
-
-	rc = OBP(exp->exp_obd, pin)(exp, fid, oc, handle, flag);
-	return rc;
-}
-
-static inline int obd_unpin(struct obd_export *exp,
-			    struct obd_client_handle *handle, int flag)
-{
-	int rc;
-
-	EXP_CHECK_DT_OP(exp, unpin);
-	EXP_COUNTER_INCREMENT(exp, unpin);
-
-	rc = OBP(exp->exp_obd, unpin)(exp, handle, flag);
-	return rc;
-}
-
-
 static inline void obd_import_event(struct obd_device *obd,
 				    struct obd_import *imp,
 				    enum obd_import_event event)
@@ -1529,19 +1282,6 @@ static inline void obd_import_event(struct obd_device *obd,
 	}
 }
 
-static inline int obd_llog_connect(struct obd_export *exp,
-				   struct llogd_conn_body *body)
-{
-	int rc;
-
-	OBD_CHECK_DT_OP(exp->exp_obd, llog_connect, 0);
-	EXP_COUNTER_INCREMENT(exp, llog_connect);
-
-	rc = OBP(exp->exp_obd, llog_connect)(exp, body);
-	return rc;
-}
-
-
 static inline int obd_notify(struct obd_device *obd,
 			     struct obd_device *watched,
 			     enum obd_notify_event ev,
@@ -1661,25 +1401,6 @@ static inline int obd_register_observer(struct obd_device *obd,
 	return 0;
 }
 
-static inline int obd_pin_observer(struct obd_device *obd,
-				   struct obd_device **observer)
-{
-	down_read(&obd->obd_observer_link_sem);
-	if (!obd->obd_observer) {
-		*observer = NULL;
-		up_read(&obd->obd_observer_link_sem);
-		return -ENOENT;
-	}
-	*observer = obd->obd_observer;
-	return 0;
-}
-
-static inline int obd_unpin_observer(struct obd_device *obd)
-{
-	up_read(&obd->obd_observer_link_sem);
-	return 0;
-}
-
 #if 0
 static inline int obd_register_page_removal_cb(struct obd_export *exp,
 					       obd_page_removal_cb_t cb,
diff --git a/drivers/staging/lustre/lustre/obdclass/llog_obd.c b/drivers/staging/lustre/lustre/obdclass/llog_obd.c
index 8ff01d3..da769db 100644
--- a/drivers/staging/lustre/lustre/obdclass/llog_obd.c
+++ b/drivers/staging/lustre/lustre/obdclass/llog_obd.c
@@ -242,31 +242,6 @@ int llog_cancel(const struct lu_env *env, struct llog_ctxt *ctxt,
 }
 EXPORT_SYMBOL(llog_cancel);
 
-int obd_llog_init(struct obd_device *obd, struct obd_llog_group *olg,
-		  struct obd_device *disk_obd, int *index)
-{
-	int rc;
-
-	OBD_CHECK_DT_OP(obd, llog_init, 0);
-	OBD_COUNTER_INCREMENT(obd, llog_init);
-
-	rc = OBP(obd, llog_init)(obd, olg, disk_obd, index);
-	return rc;
-}
-EXPORT_SYMBOL(obd_llog_init);
-
-int obd_llog_finish(struct obd_device *obd, int count)
-{
-	int rc;
-
-	OBD_CHECK_DT_OP(obd, llog_finish, 0);
-	OBD_COUNTER_INCREMENT(obd, llog_finish);
-
-	rc = OBP(obd, llog_finish)(obd, count);
-	return rc;
-}
-EXPORT_SYMBOL(obd_llog_finish);
-
 /* context key constructor/destructor: llog_key_init, llog_key_fini */
 LU_KEY_INIT_FINI(llog, struct llog_thread_info);
 /* context key: llog_thread_key */
diff --git a/drivers/staging/lustre/lustre/obdclass/lprocfs_status.c b/drivers/staging/lustre/lustre/obdclass/lprocfs_status.c
index 7893c2d..f315ec7 100644
--- a/drivers/staging/lustre/lustre/obdclass/lprocfs_status.c
+++ b/drivers/staging/lustre/lustre/obdclass/lprocfs_status.c
@@ -1309,44 +1309,24 @@ void lprocfs_init_ops_stats(int num_private_stats, struct lprocfs_stats *stats)
 	LPROCFS_OBD_OP_INIT(num_private_stats, stats, packmd);
 	LPROCFS_OBD_OP_INIT(num_private_stats, stats, unpackmd);
 	LPROCFS_OBD_OP_INIT(num_private_stats, stats, preallocate);
-	LPROCFS_OBD_OP_INIT(num_private_stats, stats, precreate);
 	LPROCFS_OBD_OP_INIT(num_private_stats, stats, create);
-	LPROCFS_OBD_OP_INIT(num_private_stats, stats, create_async);
 	LPROCFS_OBD_OP_INIT(num_private_stats, stats, destroy);
 	LPROCFS_OBD_OP_INIT(num_private_stats, stats, setattr);
 	LPROCFS_OBD_OP_INIT(num_private_stats, stats, setattr_async);
 	LPROCFS_OBD_OP_INIT(num_private_stats, stats, getattr);
 	LPROCFS_OBD_OP_INIT(num_private_stats, stats, getattr_async);
-	LPROCFS_OBD_OP_INIT(num_private_stats, stats, brw);
-	LPROCFS_OBD_OP_INIT(num_private_stats, stats, merge_lvb);
 	LPROCFS_OBD_OP_INIT(num_private_stats, stats, adjust_kms);
-	LPROCFS_OBD_OP_INIT(num_private_stats, stats, punch);
-	LPROCFS_OBD_OP_INIT(num_private_stats, stats, sync);
-	LPROCFS_OBD_OP_INIT(num_private_stats, stats, migrate);
-	LPROCFS_OBD_OP_INIT(num_private_stats, stats, copy);
-	LPROCFS_OBD_OP_INIT(num_private_stats, stats, iterate);
 	LPROCFS_OBD_OP_INIT(num_private_stats, stats, preprw);
 	LPROCFS_OBD_OP_INIT(num_private_stats, stats, commitrw);
-	LPROCFS_OBD_OP_INIT(num_private_stats, stats, enqueue);
-	LPROCFS_OBD_OP_INIT(num_private_stats, stats, change_cbdata);
 	LPROCFS_OBD_OP_INIT(num_private_stats, stats, find_cbdata);
-	LPROCFS_OBD_OP_INIT(num_private_stats, stats, cancel);
-	LPROCFS_OBD_OP_INIT(num_private_stats, stats, cancel_unused);
 	LPROCFS_OBD_OP_INIT(num_private_stats, stats, init_export);
 	LPROCFS_OBD_OP_INIT(num_private_stats, stats, destroy_export);
-	LPROCFS_OBD_OP_INIT(num_private_stats, stats, extent_calc);
-	LPROCFS_OBD_OP_INIT(num_private_stats, stats, llog_init);
-	LPROCFS_OBD_OP_INIT(num_private_stats, stats, llog_connect);
-	LPROCFS_OBD_OP_INIT(num_private_stats, stats, llog_finish);
-	LPROCFS_OBD_OP_INIT(num_private_stats, stats, pin);
-	LPROCFS_OBD_OP_INIT(num_private_stats, stats, unpin);
 	LPROCFS_OBD_OP_INIT(num_private_stats, stats, import_event);
 	LPROCFS_OBD_OP_INIT(num_private_stats, stats, notify);
 	LPROCFS_OBD_OP_INIT(num_private_stats, stats, health_check);
 	LPROCFS_OBD_OP_INIT(num_private_stats, stats, get_uuid);
 	LPROCFS_OBD_OP_INIT(num_private_stats, stats, quotacheck);
 	LPROCFS_OBD_OP_INIT(num_private_stats, stats, quotactl);
-	LPROCFS_OBD_OP_INIT(num_private_stats, stats, ping);
 	LPROCFS_OBD_OP_INIT(num_private_stats, stats, pool_new);
 	LPROCFS_OBD_OP_INIT(num_private_stats, stats, pool_rem);
 	LPROCFS_OBD_OP_INIT(num_private_stats, stats, pool_add);
-- 
1.7.9.5


^ permalink raw reply related	[flat|nested] 13+ messages in thread

* [PATCH 09/12] staging/lustre/mgc: remove server specific llog handling
  2014-09-05 20:08 [PATCH 00/12] staging/lustre: yet more dead code removal John L. Hammond
                   ` (7 preceding siblings ...)
  2014-09-05 20:08 ` [PATCH 08/12] staging/lustre: remove unused OBD methods John L. Hammond
@ 2014-09-05 20:08 ` John L. Hammond
  2014-09-05 20:08 ` [PATCH 10/12] staging/lustre/ptlrpc: remove sptlrpc_conf_target_get_rules() John L. Hammond
                   ` (2 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: John L. Hammond @ 2014-09-05 20:08 UTC (permalink / raw
  To: greg, andreas.dilger, oleg.drokin; +Cc: linux-kernel, John L. Hammond

From: "John L. Hammond" <john.hammond@intel.com>

In mgc_process_cfg_log() remove code to handle
LLOG_CONFIG_ORIG_CTXT. This context is not setup on clients.

Signed-off-by: John L. Hammond <john.hammond@intel.com>
---
 drivers/staging/lustre/lustre/mgc/mgc_request.c |   84 ++---------------------
 1 file changed, 4 insertions(+), 80 deletions(-)

diff --git a/drivers/staging/lustre/lustre/mgc/mgc_request.c b/drivers/staging/lustre/lustre/mgc/mgc_request.c
index cb0e6f9..bc263ad 100644
--- a/drivers/staging/lustre/lustre/mgc/mgc_request.c
+++ b/drivers/staging/lustre/lustre/mgc/mgc_request.c
@@ -1461,54 +1461,11 @@ out:
 	return rc;
 }
 
-static int mgc_llog_local_copy(const struct lu_env *env,
-			       struct obd_device *obd,
-			       struct llog_ctxt *rctxt,
-			       struct llog_ctxt *lctxt, char *logname)
-{
-	char	*temp_log;
-	int	 rc;
-
-
-
-	/*
-	 * - copy it to backup using llog_backup()
-	 * - copy remote llog to logname using llog_backup()
-	 * - if failed then move backup to logname again
-	 */
-
-	OBD_ALLOC(temp_log, strlen(logname) + 1);
-	if (!temp_log)
-		return -ENOMEM;
-	sprintf(temp_log, "%sT", logname);
-
-	/* make a copy of local llog at first */
-	rc = llog_backup(env, obd, lctxt, lctxt, logname, temp_log);
-	if (rc < 0 && rc != -ENOENT)
-		goto out;
-	/* copy remote llog to the local copy */
-	rc = llog_backup(env, obd, rctxt, lctxt, logname, logname);
-	if (rc == -ENOENT) {
-		/* no remote llog, delete local one too */
-		llog_erase(env, lctxt, NULL, logname);
-	} else if (rc < 0) {
-		/* error during backup, get local one back from the copy */
-		llog_backup(env, obd, lctxt, lctxt, temp_log, logname);
-out:
-		CERROR("%s: failed to copy remote log %s: rc = %d\n",
-		       obd->obd_name, logname, rc);
-	}
-	llog_erase(env, lctxt, NULL, temp_log);
-	OBD_FREE(temp_log, strlen(logname) + 1);
-	return rc;
-}
-
 /* local_only means it cannot get remote llogs */
 static int mgc_process_cfg_log(struct obd_device *mgc,
 			       struct config_llog_data *cld, int local_only)
 {
-	struct llog_ctxt	*ctxt, *lctxt = NULL;
-	struct dt_object        *cl_mgc_dir = mgc->u.cli.cl_mgc_configs_dir;
+	struct llog_ctxt	*ctxt;
 	struct lustre_sb_info	*lsi = NULL;
 	int			 rc = 0;
 	bool			 sptlrpc_started = false;
@@ -1538,40 +1495,9 @@ static int mgc_process_cfg_log(struct obd_device *mgc,
 	ctxt = llog_get_context(mgc, LLOG_CONFIG_REPL_CTXT);
 	LASSERT(ctxt);
 
-	lctxt = llog_get_context(mgc, LLOG_CONFIG_ORIG_CTXT);
-
-	/* Copy the setup log locally if we can. Don't mess around if we're
-	 * running an MGS though (logs are already local). */
-	if (lctxt && lsi && IS_SERVER(lsi) && !IS_MGS(lsi) &&
-	    cl_mgc_dir != NULL &&
-	    lu2dt_dev(cl_mgc_dir->do_lu.lo_dev) == lsi->lsi_dt_dev) {
-		if (!local_only)
-			/* Only try to copy log if we have the lock. */
-			rc = mgc_llog_local_copy(env, mgc, ctxt, lctxt,
-						 cld->cld_logname);
-		if (local_only || rc) {
-			if (llog_is_empty(env, lctxt, cld->cld_logname)) {
-				LCONSOLE_ERROR_MSG(0x13a,
-						   "Failed to get MGS log %s and no local copy.\n",
-						   cld->cld_logname);
-				rc = -ENOENT;
-				goto out_pop;
-			}
-			CDEBUG(D_MGC,
-			       "Failed to get MGS log %s, using local copy for now, will try to update later.\n",
-			       cld->cld_logname);
-		}
-		/* Now, whether we copied or not, start using the local llog.
-		 * If we failed to copy, we'll start using whatever the old
-		 * log has. */
-		llog_ctxt_put(ctxt);
-		ctxt = lctxt;
-		lctxt = NULL;
-	} else {
-		if (local_only) /* no local log at client side */ {
-			rc = -EIO;
-			goto out_pop;
-		}
+	if (local_only) /* no local log at client side */ {
+		rc = -EIO;
+		goto out_pop;
 	}
 
 	if (cld_is_sptlrpc(cld)) {
@@ -1587,8 +1513,6 @@ static int mgc_process_cfg_log(struct obd_device *mgc,
 
 out_pop:
 	__llog_ctxt_put(env, ctxt);
-	if (lctxt)
-		__llog_ctxt_put(env, lctxt);
 
 	/*
 	 * update settings on existing OBDs. doing it inside
-- 
1.7.9.5


^ permalink raw reply related	[flat|nested] 13+ messages in thread

* [PATCH 10/12] staging/lustre/ptlrpc: remove sptlrpc_conf_target_get_rules()
  2014-09-05 20:08 [PATCH 00/12] staging/lustre: yet more dead code removal John L. Hammond
                   ` (8 preceding siblings ...)
  2014-09-05 20:08 ` [PATCH 09/12] staging/lustre/mgc: remove server specific llog handling John L. Hammond
@ 2014-09-05 20:08 ` John L. Hammond
  2014-09-05 20:08 ` [PATCH 11/12] staging/lustre/obdclass: remove llog_ioctl.c John L. Hammond
  2014-09-05 20:08 ` [PATCH 12/12] staging/lustre/obdclass: remove local_storage.[ch] John L. Hammond
  11 siblings, 0 replies; 13+ messages in thread
From: John L. Hammond @ 2014-09-05 20:08 UTC (permalink / raw
  To: greg, andreas.dilger, oleg.drokin; +Cc: linux-kernel, John L. Hammond

From: "John L. Hammond" <john.hammond@intel.com>

Remove the unused function sptlrpc_conf_target_get_rules() and its
supporting functions.

Signed-off-by: John L. Hammond <john.hammond@intel.com>
---
 drivers/staging/lustre/lustre/include/lustre_sec.h |    3 -
 drivers/staging/lustre/lustre/ptlrpc/sec_config.c  |  327 --------------------
 2 files changed, 330 deletions(-)

diff --git a/drivers/staging/lustre/lustre/include/lustre_sec.h b/drivers/staging/lustre/lustre/include/lustre_sec.h
index c4669e2..dff70a5 100644
--- a/drivers/staging/lustre/lustre/include/lustre_sec.h
+++ b/drivers/staging/lustre/lustre/include/lustre_sec.h
@@ -347,9 +347,6 @@ void sptlrpc_conf_log_stop(const char *logname);
 void sptlrpc_conf_log_update_begin(const char *logname);
 void sptlrpc_conf_log_update_end(const char *logname);
 void sptlrpc_conf_client_adapt(struct obd_device *obd);
-int  sptlrpc_conf_target_get_rules(struct obd_device *obd,
-				   struct sptlrpc_rule_set *rset,
-				   int initial);
 void sptlrpc_target_choose_flavor(struct sptlrpc_rule_set *rset,
 				  enum lustre_sec_part from,
 				  lnet_nid_t nid,
diff --git a/drivers/staging/lustre/lustre/ptlrpc/sec_config.c b/drivers/staging/lustre/lustre/ptlrpc/sec_config.c
index c9e9da7..56ba9e4 100644
--- a/drivers/staging/lustre/lustre/ptlrpc/sec_config.c
+++ b/drivers/staging/lustre/lustre/ptlrpc/sec_config.c
@@ -41,13 +41,8 @@
 #include <linux/key.h>
 
 #include "../include/obd.h"
-#include "../include/obd_class.h"
 #include "../include/obd_support.h"
-#include "../include/lustre_net.h"
 #include "../include/lustre_import.h"
-#include "../include/lustre_log.h"
-#include "../include/lustre_disk.h"
-#include "../include/lustre_dlm.h"
 #include "../include/lustre_param.h"
 #include "../include/lustre_sec.h"
 
@@ -450,46 +445,6 @@ void sptlrpc_rule_set_dump(struct sptlrpc_rule_set *rset)
 }
 EXPORT_SYMBOL(sptlrpc_rule_set_dump);
 
-static int sptlrpc_rule_set_extract(struct sptlrpc_rule_set *gen,
-				    struct sptlrpc_rule_set *tgt,
-				    enum lustre_sec_part from,
-				    enum lustre_sec_part to,
-				    struct sptlrpc_rule_set *rset)
-{
-	struct sptlrpc_rule_set *src[2] = { gen, tgt };
-	struct sptlrpc_rule     *rule;
-	int		      i, n, rc;
-
-	might_sleep();
-
-	/* merge general rules firstly, then target-specific rules */
-	for (i = 0; i < 2; i++) {
-		if (src[i] == NULL)
-			continue;
-
-		for (n = 0; n < src[i]->srs_nrule; n++) {
-			rule = &src[i]->srs_rules[n];
-
-			if (from != LUSTRE_SP_ANY &&
-			    rule->sr_from != LUSTRE_SP_ANY &&
-			    rule->sr_from != from)
-				continue;
-			if (to != LUSTRE_SP_ANY &&
-			    rule->sr_to != LUSTRE_SP_ANY &&
-			    rule->sr_to != to)
-				continue;
-
-			rc = sptlrpc_rule_set_merge(rset, rule);
-			if (rc) {
-				CERROR("can't merge: %d\n", rc);
-				return rc;
-			}
-		}
-	}
-
-	return 0;
-}
-
 /**********************************
  * sptlrpc configuration support  *
  **********************************/
@@ -927,288 +882,6 @@ void sptlrpc_conf_client_adapt(struct obd_device *obd)
 }
 EXPORT_SYMBOL(sptlrpc_conf_client_adapt);
 
-
-static void rule2string(struct sptlrpc_rule *r, char *buf, int buflen)
-{
-	char    dirbuf[8];
-	char   *net;
-	char   *ptr = buf;
-
-	if (r->sr_netid == LNET_NIDNET(LNET_NID_ANY))
-		net = "default";
-	else
-		net = libcfs_net2str(r->sr_netid);
-
-	if (r->sr_from == LUSTRE_SP_ANY && r->sr_to == LUSTRE_SP_ANY)
-		dirbuf[0] = '\0';
-	else
-		snprintf(dirbuf, sizeof(dirbuf), ".%s2%s",
-			 sptlrpc_part2name(r->sr_from),
-			 sptlrpc_part2name(r->sr_to));
-
-	ptr += snprintf(buf, buflen, "srpc.flavor.%s%s=", net, dirbuf);
-
-	sptlrpc_flavor2name(&r->sr_flvr, ptr, buflen - (ptr - buf));
-	buf[buflen - 1] = '\0';
-}
-
-static int sptlrpc_record_rule_set(struct llog_handle *llh,
-				   char *target,
-				   struct sptlrpc_rule_set *rset)
-{
-	struct lustre_cfg_bufs  bufs;
-	struct lustre_cfg      *lcfg;
-	struct llog_rec_hdr     rec;
-	int		     buflen;
-	char		    param[48];
-	int		     i, rc;
-
-	for (i = 0; i < rset->srs_nrule; i++) {
-		rule2string(&rset->srs_rules[i], param, sizeof(param));
-
-		lustre_cfg_bufs_reset(&bufs, NULL);
-		lustre_cfg_bufs_set_string(&bufs, 1, target);
-		lustre_cfg_bufs_set_string(&bufs, 2, param);
-		lcfg = lustre_cfg_new(LCFG_SPTLRPC_CONF, &bufs);
-		LASSERT(lcfg);
-
-		buflen = lustre_cfg_len(lcfg->lcfg_bufcount,
-					lcfg->lcfg_buflens);
-		rec.lrh_len = llog_data_len(buflen);
-		rec.lrh_type = OBD_CFG_REC;
-		rc = llog_write(NULL, llh, &rec, NULL, 0, (void *)lcfg, -1);
-		if (rc)
-			CERROR("failed to write a rec: rc = %d\n", rc);
-		lustre_cfg_free(lcfg);
-	}
-	return 0;
-}
-
-static int sptlrpc_record_rules(struct llog_handle *llh,
-				struct sptlrpc_conf *conf)
-{
-	struct sptlrpc_conf_tgt *conf_tgt;
-
-	sptlrpc_record_rule_set(llh, conf->sc_fsname, &conf->sc_rset);
-
-	list_for_each_entry(conf_tgt, &conf->sc_tgts, sct_list) {
-		sptlrpc_record_rule_set(llh, conf_tgt->sct_name,
-					&conf_tgt->sct_rset);
-	}
-	return 0;
-}
-
-#define LOG_SPTLRPC_TMP "sptlrpc.tmp"
-#define LOG_SPTLRPC     "sptlrpc"
-
-static
-int sptlrpc_target_local_copy_conf(struct obd_device *obd,
-				   struct sptlrpc_conf *conf)
-{
-	struct llog_handle   *llh = NULL;
-	struct llog_ctxt     *ctxt;
-	struct lvfs_run_ctxt  saved;
-	struct dentry	*dentry;
-	int		   rc;
-
-	ctxt = llog_get_context(obd, LLOG_CONFIG_ORIG_CTXT);
-	if (ctxt == NULL)
-		return -EINVAL;
-
-	push_ctxt(&saved, &obd->obd_lvfs_ctxt, NULL);
-
-	dentry = ll_lookup_one_len(MOUNT_CONFIGS_DIR, cfs_fs_pwd(current->fs),
-				   strlen(MOUNT_CONFIGS_DIR));
-	if (IS_ERR(dentry)) {
-		rc = PTR_ERR(dentry);
-		CERROR("cannot lookup %s directory: rc = %d\n",
-		       MOUNT_CONFIGS_DIR, rc);
-		GOTO(out_ctx, rc);
-	}
-
-	/* erase the old tmp log */
-	rc = llog_erase(NULL, ctxt, NULL, LOG_SPTLRPC_TMP);
-	if (rc < 0 && rc != -ENOENT) {
-		CERROR("%s: cannot erase temporary sptlrpc log: rc = %d\n",
-		       obd->obd_name, rc);
-		GOTO(out_dput, rc);
-	}
-
-	/* write temporary log */
-	rc = llog_open_create(NULL, ctxt, &llh, NULL, LOG_SPTLRPC_TMP);
-	if (rc)
-		GOTO(out_dput, rc);
-	rc = llog_init_handle(NULL, llh, LLOG_F_IS_PLAIN, NULL);
-	if (rc)
-		GOTO(out_close, rc);
-
-	rc = sptlrpc_record_rules(llh, conf);
-
-out_close:
-	llog_close(NULL, llh);
-	if (rc == 0)
-		rc = lustre_rename(dentry, obd->obd_lvfs_ctxt.pwdmnt,
-				   LOG_SPTLRPC_TMP, LOG_SPTLRPC);
-out_dput:
-	l_dput(dentry);
-out_ctx:
-	pop_ctxt(&saved, &obd->obd_lvfs_ctxt, NULL);
-	llog_ctxt_put(ctxt);
-	CDEBUG(D_SEC, "target %s: write local sptlrpc conf: rc = %d\n",
-	       obd->obd_name, rc);
-	return rc;
-}
-
-static int local_read_handler(const struct lu_env *env,
-			      struct llog_handle *llh,
-			      struct llog_rec_hdr *rec, void *data)
-{
-	struct sptlrpc_conf  *conf = (struct sptlrpc_conf *) data;
-	struct lustre_cfg    *lcfg = (struct lustre_cfg *)(rec + 1);
-	int		   cfg_len, rc;
-
-	if (rec->lrh_type != OBD_CFG_REC) {
-		CERROR("unhandled lrh_type: %#x\n", rec->lrh_type);
-		return -EINVAL;
-	}
-
-	cfg_len = rec->lrh_len - sizeof(struct llog_rec_hdr) -
-		  sizeof(struct llog_rec_tail);
-
-	rc = lustre_cfg_sanity_check(lcfg, cfg_len);
-	if (rc) {
-		CERROR("Insane cfg\n");
-		return rc;
-	}
-
-	if (lcfg->lcfg_command != LCFG_SPTLRPC_CONF) {
-		CERROR("invalid command (%x)\n", lcfg->lcfg_command);
-		return -EINVAL;
-	}
-
-	return __sptlrpc_process_config(lcfg, conf);
-}
-
-static
-int sptlrpc_target_local_read_conf(struct obd_device *obd,
-				   struct sptlrpc_conf *conf)
-{
-	struct llog_handle    *llh = NULL;
-	struct llog_ctxt      *ctxt;
-	struct lvfs_run_ctxt   saved;
-	int		    rc;
-
-	LASSERT(conf->sc_updated == 0 && conf->sc_local == 0);
-
-	ctxt = llog_get_context(obd, LLOG_CONFIG_ORIG_CTXT);
-	if (ctxt == NULL) {
-		CERROR("missing llog context\n");
-		return -EINVAL;
-	}
-
-	push_ctxt(&saved, &obd->obd_lvfs_ctxt, NULL);
-
-	rc = llog_open(NULL, ctxt, &llh, NULL, LOG_SPTLRPC, LLOG_OPEN_EXISTS);
-	if (rc < 0) {
-		if (rc == -ENOENT)
-			rc = 0;
-		GOTO(out_pop, rc);
-	}
-
-	rc = llog_init_handle(NULL, llh, LLOG_F_IS_PLAIN, NULL);
-	if (rc)
-		GOTO(out_close, rc);
-
-	if (llog_get_size(llh) <= 1) {
-		CDEBUG(D_SEC, "no local sptlrpc copy found\n");
-		GOTO(out_close, rc = 0);
-	}
-
-	rc = llog_process(NULL, llh, local_read_handler, (void *)conf, NULL);
-
-	if (rc == 0) {
-		conf->sc_local = 1;
-	} else {
-		sptlrpc_conf_free_rsets(conf);
-	}
-
-out_close:
-	llog_close(NULL, llh);
-out_pop:
-	pop_ctxt(&saved, &obd->obd_lvfs_ctxt, NULL);
-	llog_ctxt_put(ctxt);
-	CDEBUG(D_SEC, "target %s: read local sptlrpc conf: rc = %d\n",
-	       obd->obd_name, rc);
-	return rc;
-}
-
-
-/**
- * called by target devices, extract sptlrpc rules which applies to
- * this target, to be used for future rpc flavor checking.
- */
-int sptlrpc_conf_target_get_rules(struct obd_device *obd,
-				  struct sptlrpc_rule_set *rset,
-				  int initial)
-{
-	struct sptlrpc_conf      *conf;
-	struct sptlrpc_conf_tgt  *conf_tgt;
-	enum lustre_sec_part      sp_dst;
-	char		      fsname[MTI_NAME_MAXLEN];
-	int		       rc = 0;
-
-	if (strcmp(obd->obd_type->typ_name, LUSTRE_MDT_NAME) == 0) {
-		sp_dst = LUSTRE_SP_MDT;
-	} else if (strcmp(obd->obd_type->typ_name, LUSTRE_OST_NAME) == 0) {
-		sp_dst = LUSTRE_SP_OST;
-	} else {
-		CERROR("unexpected obd type %s\n", obd->obd_type->typ_name);
-		return -EINVAL;
-	}
-	CDEBUG(D_SEC, "get rules for target %s\n", obd->obd_uuid.uuid);
-
-	target2fsname(obd->obd_uuid.uuid, fsname, sizeof(fsname));
-
-	mutex_lock(&sptlrpc_conf_lock);
-
-	conf = sptlrpc_conf_get(fsname, 0);
-	if (conf == NULL) {
-		CERROR("missing sptlrpc config log\n");
-		GOTO(out, rc);
-	}
-
-	if (conf->sc_updated  == 0) {
-		/*
-		 * always read from local copy. here another option is
-		 * if we already have a local copy (read from another
-		 * target device hosted on the same node) we simply use that.
-		 */
-		if (conf->sc_local)
-			sptlrpc_conf_free_rsets(conf);
-
-		sptlrpc_target_local_read_conf(obd, conf);
-	} else {
-		LASSERT(conf->sc_local == 0);
-
-		/* write a local copy */
-		if (initial || conf->sc_modified)
-			sptlrpc_target_local_copy_conf(obd, conf);
-		else
-			CDEBUG(D_SEC, "unchanged, skip updating local copy\n");
-	}
-
-	/* extract rule set for this target */
-	conf_tgt = sptlrpc_conf_get_tgt(conf, obd->obd_name, 0);
-
-	rc = sptlrpc_rule_set_extract(&conf->sc_rset,
-				      conf_tgt ? &conf_tgt->sct_rset : NULL,
-				      LUSTRE_SP_ANY, sp_dst, rset);
-out:
-	mutex_unlock(&sptlrpc_conf_lock);
-	return rc;
-}
-EXPORT_SYMBOL(sptlrpc_conf_target_get_rules);
-
 int  sptlrpc_conf_init(void)
 {
 	mutex_init(&sptlrpc_conf_lock);
-- 
1.7.9.5


^ permalink raw reply related	[flat|nested] 13+ messages in thread

* [PATCH 11/12] staging/lustre/obdclass: remove llog_ioctl.c
  2014-09-05 20:08 [PATCH 00/12] staging/lustre: yet more dead code removal John L. Hammond
                   ` (9 preceding siblings ...)
  2014-09-05 20:08 ` [PATCH 10/12] staging/lustre/ptlrpc: remove sptlrpc_conf_target_get_rules() John L. Hammond
@ 2014-09-05 20:08 ` John L. Hammond
  2014-09-05 20:08 ` [PATCH 12/12] staging/lustre/obdclass: remove local_storage.[ch] John L. Hammond
  11 siblings, 0 replies; 13+ messages in thread
From: John L. Hammond @ 2014-09-05 20:08 UTC (permalink / raw
  To: greg, andreas.dilger, oleg.drokin; +Cc: linux-kernel, John L. Hammond

From: "John L. Hammond" <john.hammond@intel.com>

Remove the unused function llog_ioctl() and the file
lustre/obdclass/llog_ioctl.c.

Signed-off-by: John L. Hammond <john.hammond@intel.com>
---
 drivers/staging/lustre/lustre/include/lustre_log.h |    4 -
 drivers/staging/lustre/lustre/obdclass/Makefile    |    2 +-
 .../staging/lustre/lustre/obdclass/llog_ioctl.c    |  418 --------------------
 3 files changed, 1 insertion(+), 423 deletions(-)
 delete mode 100644 drivers/staging/lustre/lustre/obdclass/llog_ioctl.c

diff --git a/drivers/staging/lustre/lustre/include/lustre_log.h b/drivers/staging/lustre/lustre/include/lustre_log.h
index c10029c..2187fb6 100644
--- a/drivers/staging/lustre/lustre/include/lustre_log.h
+++ b/drivers/staging/lustre/lustre/include/lustre_log.h
@@ -206,10 +206,6 @@ int llog_sync(struct llog_ctxt *ctxt, struct obd_export *exp, int flags);
 int llog_cancel(const struct lu_env *env, struct llog_ctxt *ctxt,
 		struct llog_cookie *cookies, int flags);
 
-/* llog_ioctl.c */
-int llog_ioctl(const struct lu_env *env, struct llog_ctxt *ctxt, int cmd,
-	       struct obd_ioctl_data *data);
-
 /* llog_net.c */
 int llog_initiator_connect(struct llog_ctxt *ctxt);
 
diff --git a/drivers/staging/lustre/lustre/obdclass/Makefile b/drivers/staging/lustre/lustre/obdclass/Makefile
index c8c95e1..77fd94c 100644
--- a/drivers/staging/lustre/lustre/obdclass/Makefile
+++ b/drivers/staging/lustre/lustre/obdclass/Makefile
@@ -2,7 +2,7 @@ obj-$(CONFIG_LUSTRE_FS) += obdclass.o
 
 obdclass-y := linux/linux-module.o linux/linux-obdo.o linux/linux-sysctl.o \
 	      llog.o llog_cat.o llog_obd.o llog_swab.o class_obd.o debug.o \
-	      genops.o uuid.o llog_ioctl.o lprocfs_status.o		   \
+	      genops.o uuid.o lprocfs_status.o \
 	      lustre_handles.o lustre_peer.o \
 	      local_storage.o statfs_pack.o obdo.o obd_config.o obd_mount.o\
 	      lu_object.o dt_object.o capa.o cl_object.o   \
diff --git a/drivers/staging/lustre/lustre/obdclass/llog_ioctl.c b/drivers/staging/lustre/lustre/obdclass/llog_ioctl.c
deleted file mode 100644
index 9b7fa1d..0000000
--- a/drivers/staging/lustre/lustre/obdclass/llog_ioctl.c
+++ /dev/null
@@ -1,418 +0,0 @@
-/*
- * GPL HEADER START
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 only,
- * as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * General Public License version 2 for more details (a copy is included
- * in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU General Public License
- * version 2 along with this program; If not, see
- * http://www.sun.com/software/products/lustre/docs/GPLv2.pdf
- *
- * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
- * CA 95054 USA or visit www.sun.com if you need additional information or
- * have any questions.
- *
- * GPL HEADER END
- */
-/*
- * Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved.
- * Use is subject to license terms.
- *
- * Copyright (c) 2011, 2012, Intel Corporation.
- */
-/*
- * This file is part of Lustre, http://www.lustre.org/
- * Lustre is a trademark of Sun Microsystems, Inc.
- */
-
-#define DEBUG_SUBSYSTEM S_LOG
-
-#include "../include/obd_class.h"
-#include "../include/lustre_log.h"
-#include "llog_internal.h"
-
-static int str2logid(struct llog_logid *logid, char *str, int len)
-{
-	char *start, *end, *endp;
-	__u64 id, seq;
-
-	start = str;
-	if (*start != '#')
-		return -EINVAL;
-
-	start++;
-	if (start - str >= len - 1)
-		return -EINVAL;
-	end = strchr(start, '#');
-	if (end == NULL || end == start)
-		return -EINVAL;
-
-	*end = '\0';
-	id = simple_strtoull(start, &endp, 0);
-	if (endp != end)
-		return -EINVAL;
-
-	start = ++end;
-	if (start - str >= len - 1)
-		return -EINVAL;
-	end = strchr(start, '#');
-	if (end == NULL || end == start)
-		return -EINVAL;
-
-	*end = '\0';
-	seq = simple_strtoull(start, &endp, 0);
-	if (endp != end)
-		return -EINVAL;
-
-	ostid_set_seq(&logid->lgl_oi, seq);
-	ostid_set_id(&logid->lgl_oi, id);
-
-	start = ++end;
-	if (start - str >= len - 1)
-		return -EINVAL;
-	logid->lgl_ogen = simple_strtoul(start, &endp, 16);
-	if (*endp != '\0')
-		return -EINVAL;
-
-	return 0;
-}
-
-static int llog_check_cb(const struct lu_env *env, struct llog_handle *handle,
-			 struct llog_rec_hdr *rec, void *data)
-{
-	struct obd_ioctl_data *ioc_data = (struct obd_ioctl_data *)data;
-	static int l, remains, from, to;
-	static char *out;
-	char *endp;
-	int cur_index, rc = 0;
-
-	if (ioc_data && ioc_data->ioc_inllen1 > 0) {
-		l = 0;
-		remains = ioc_data->ioc_inllen4 +
-			cfs_size_round(ioc_data->ioc_inllen1) +
-			cfs_size_round(ioc_data->ioc_inllen2) +
-			cfs_size_round(ioc_data->ioc_inllen3);
-		from = simple_strtol(ioc_data->ioc_inlbuf2, &endp, 0);
-		if (*endp != '\0')
-			return -EINVAL;
-		to = simple_strtol(ioc_data->ioc_inlbuf3, &endp, 0);
-		if (*endp != '\0')
-			return -EINVAL;
-		ioc_data->ioc_inllen1 = 0;
-		out = ioc_data->ioc_bulk;
-	}
-
-	cur_index = rec->lrh_index;
-	if (cur_index < from)
-		return 0;
-	if (to > 0 && cur_index > to)
-		return -LLOG_EEMPTY;
-
-	if (handle->lgh_hdr->llh_flags & LLOG_F_IS_CAT) {
-		struct llog_logid_rec	*lir = (struct llog_logid_rec *)rec;
-		struct llog_handle	*loghandle;
-
-		if (rec->lrh_type != LLOG_LOGID_MAGIC) {
-			l = snprintf(out, remains, "[index]: %05d  [type]: "
-				     "%02x  [len]: %04d failed\n",
-				     cur_index, rec->lrh_type,
-				     rec->lrh_len);
-		}
-		if (handle->lgh_ctxt == NULL)
-			return -EOPNOTSUPP;
-		rc = llog_cat_id2handle(env, handle, &loghandle, &lir->lid_id);
-		if (rc) {
-			CDEBUG(D_IOCTL, "cannot find log #"DOSTID"#%08x\n",
-			       POSTID(&lir->lid_id.lgl_oi),
-			       lir->lid_id.lgl_ogen);
-			return rc;
-		}
-		rc = llog_process(env, loghandle, llog_check_cb, NULL, NULL);
-		llog_handle_put(loghandle);
-	} else {
-		bool ok;
-
-		switch (rec->lrh_type) {
-		case OST_SZ_REC:
-		case MDS_UNLINK_REC:
-		case MDS_UNLINK64_REC:
-		case MDS_SETATTR64_REC:
-		case OBD_CFG_REC:
-		case LLOG_GEN_REC:
-		case LLOG_HDR_MAGIC:
-			ok = true;
-			break;
-		default:
-			ok = false;
-		}
-
-		l = snprintf(out, remains, "[index]: %05d  [type]: "
-			     "%02x  [len]: %04d %s\n",
-			     cur_index, rec->lrh_type, rec->lrh_len,
-			     ok ? "ok" : "failed");
-		out += l;
-		remains -= l;
-		if (remains <= 0) {
-			CERROR("%s: no space to print log records\n",
-			       handle->lgh_ctxt->loc_obd->obd_name);
-			return -LLOG_EEMPTY;
-		}
-	}
-	return rc;
-}
-
-static int llog_print_cb(const struct lu_env *env, struct llog_handle *handle,
-			 struct llog_rec_hdr *rec, void *data)
-{
-	struct obd_ioctl_data *ioc_data = (struct obd_ioctl_data *)data;
-	static int l, remains, from, to;
-	static char *out;
-	char *endp;
-	int cur_index;
-
-	if (ioc_data != NULL && ioc_data->ioc_inllen1 > 0) {
-		l = 0;
-		remains = ioc_data->ioc_inllen4 +
-			cfs_size_round(ioc_data->ioc_inllen1) +
-			cfs_size_round(ioc_data->ioc_inllen2) +
-			cfs_size_round(ioc_data->ioc_inllen3);
-		from = simple_strtol(ioc_data->ioc_inlbuf2, &endp, 0);
-		if (*endp != '\0')
-			return -EINVAL;
-		to = simple_strtol(ioc_data->ioc_inlbuf3, &endp, 0);
-		if (*endp != '\0')
-			return -EINVAL;
-		out = ioc_data->ioc_bulk;
-		ioc_data->ioc_inllen1 = 0;
-	}
-
-	cur_index = rec->lrh_index;
-	if (cur_index < from)
-		return 0;
-	if (to > 0 && cur_index > to)
-		return -LLOG_EEMPTY;
-
-	if (handle->lgh_hdr->llh_flags & LLOG_F_IS_CAT) {
-		struct llog_logid_rec *lir = (struct llog_logid_rec *)rec;
-
-		if (rec->lrh_type != LLOG_LOGID_MAGIC) {
-			CERROR("invalid record in catalog\n");
-			return -EINVAL;
-		}
-
-		l = snprintf(out, remains,
-			     "[index]: %05d  [logid]: #"DOSTID"#%08x\n",
-			     cur_index, POSTID(&lir->lid_id.lgl_oi),
-			     lir->lid_id.lgl_ogen);
-	} else if (rec->lrh_type == OBD_CFG_REC) {
-		int rc;
-
-		rc = class_config_parse_rec(rec, out, remains);
-		if (rc < 0)
-			return rc;
-		l = rc;
-	} else {
-		l = snprintf(out, remains,
-			     "[index]: %05d  [type]: %02x  [len]: %04d\n",
-			     cur_index, rec->lrh_type, rec->lrh_len);
-	}
-	out += l;
-	remains -= l;
-	if (remains <= 0) {
-		CERROR("not enough space for print log records\n");
-		return -LLOG_EEMPTY;
-	}
-
-	return 0;
-}
-static int llog_remove_log(const struct lu_env *env, struct llog_handle *cat,
-			   struct llog_logid *logid)
-{
-	struct llog_handle	*log;
-	int			 rc;
-
-	rc = llog_cat_id2handle(env, cat, &log, logid);
-	if (rc) {
-		CDEBUG(D_IOCTL, "cannot find log #"DOSTID"#%08x\n",
-		       POSTID(&logid->lgl_oi), logid->lgl_ogen);
-		return -ENOENT;
-	}
-
-	rc = llog_destroy(env, log);
-	if (rc) {
-		CDEBUG(D_IOCTL, "cannot destroy log\n");
-		GOTO(out, rc);
-	}
-	llog_cat_cleanup(env, cat, log, log->u.phd.phd_cookie.lgc_index);
-out:
-	llog_handle_put(log);
-	return rc;
-
-}
-
-static int llog_delete_cb(const struct lu_env *env, struct llog_handle *handle,
-			  struct llog_rec_hdr *rec, void *data)
-{
-	struct llog_logid_rec	*lir = (struct llog_logid_rec *)rec;
-	int			 rc;
-
-	if (rec->lrh_type != LLOG_LOGID_MAGIC)
-		return -EINVAL;
-	rc = llog_remove_log(env, handle, &lir->lid_id);
-
-	return rc;
-}
-
-
-int llog_ioctl(const struct lu_env *env, struct llog_ctxt *ctxt, int cmd,
-	       struct obd_ioctl_data *data)
-{
-	struct llog_logid	 logid;
-	int			 rc = 0;
-	struct llog_handle	*handle = NULL;
-
-	if (*data->ioc_inlbuf1 == '#') {
-		rc = str2logid(&logid, data->ioc_inlbuf1, data->ioc_inllen1);
-		if (rc)
-			return rc;
-		rc = llog_open(env, ctxt, &handle, &logid, NULL,
-			       LLOG_OPEN_EXISTS);
-		if (rc)
-			return rc;
-	} else if (*data->ioc_inlbuf1 == '$') {
-		char *name = data->ioc_inlbuf1 + 1;
-
-		rc = llog_open(env, ctxt, &handle, NULL, name,
-			       LLOG_OPEN_EXISTS);
-		if (rc)
-			return rc;
-	} else {
-		return -EINVAL;
-	}
-
-	rc = llog_init_handle(env, handle, 0, NULL);
-	if (rc)
-		GOTO(out_close, rc = -ENOENT);
-
-	switch (cmd) {
-	case OBD_IOC_LLOG_INFO: {
-		int	 l;
-		int	 remains = data->ioc_inllen2 +
-				   cfs_size_round(data->ioc_inllen1);
-		char	*out = data->ioc_bulk;
-
-		l = snprintf(out, remains,
-			     "logid:	    #"DOSTID"#%08x\n"
-			     "flags:	    %x (%s)\n"
-			     "records count:    %d\n"
-			     "last index:       %d\n",
-			     POSTID(&handle->lgh_id.lgl_oi),
-			     handle->lgh_id.lgl_ogen,
-			     handle->lgh_hdr->llh_flags,
-			     handle->lgh_hdr->llh_flags &
-			     LLOG_F_IS_CAT ? "cat" : "plain",
-			     handle->lgh_hdr->llh_count,
-			     handle->lgh_last_idx);
-		out += l;
-		remains -= l;
-		if (remains <= 0) {
-			CERROR("%s: not enough space for log header info\n",
-			       ctxt->loc_obd->obd_name);
-			rc = -ENOSPC;
-		}
-		break;
-	}
-	case OBD_IOC_LLOG_CHECK:
-		LASSERT(data->ioc_inllen1 > 0);
-		rc = llog_process(env, handle, llog_check_cb, data, NULL);
-		if (rc == -LLOG_EEMPTY)
-			rc = 0;
-		else if (rc)
-			GOTO(out_close, rc);
-		break;
-	case OBD_IOC_LLOG_PRINT:
-		LASSERT(data->ioc_inllen1 > 0);
-		rc = llog_process(env, handle, llog_print_cb, data, NULL);
-		if (rc == -LLOG_EEMPTY)
-			rc = 0;
-		else if (rc)
-			GOTO(out_close, rc);
-		break;
-	case OBD_IOC_LLOG_CANCEL: {
-		struct llog_cookie cookie;
-		struct llog_logid plain;
-		char *endp;
-
-		cookie.lgc_index = simple_strtoul(data->ioc_inlbuf3, &endp, 0);
-		if (*endp != '\0')
-			GOTO(out_close, rc = -EINVAL);
-
-		if (handle->lgh_hdr->llh_flags & LLOG_F_IS_PLAIN) {
-			rc = llog_cancel_rec(NULL, handle, cookie.lgc_index);
-			GOTO(out_close, rc);
-		} else if (!(handle->lgh_hdr->llh_flags & LLOG_F_IS_CAT)) {
-			GOTO(out_close, rc = -EINVAL);
-		}
-
-		if (data->ioc_inlbuf2 == NULL) /* catalog but no logid */
-			GOTO(out_close, rc = -ENOTTY);
-
-		rc = str2logid(&plain, data->ioc_inlbuf2, data->ioc_inllen2);
-		if (rc)
-			GOTO(out_close, rc);
-		cookie.lgc_lgl = plain;
-		rc = llog_cat_cancel_records(env, handle, 1, &cookie);
-		if (rc)
-			GOTO(out_close, rc);
-		break;
-	}
-	case OBD_IOC_LLOG_REMOVE: {
-		struct llog_logid plain;
-
-		if (handle->lgh_hdr->llh_flags & LLOG_F_IS_PLAIN) {
-			rc = llog_destroy(env, handle);
-			GOTO(out_close, rc);
-		} else if (!(handle->lgh_hdr->llh_flags & LLOG_F_IS_CAT)) {
-			GOTO(out_close, rc = -EINVAL);
-		}
-
-		if (data->ioc_inllen2 > 0) {
-			/* remove indicate log from the catalog */
-			rc = str2logid(&plain, data->ioc_inlbuf2,
-				       data->ioc_inllen2);
-			if (rc)
-				GOTO(out_close, rc);
-			rc = llog_remove_log(env, handle, &plain);
-		} else {
-			/* remove all the log of the catalog */
-			rc = llog_process(env, handle, llog_delete_cb, NULL,
-					  NULL);
-			if (rc)
-				GOTO(out_close, rc);
-		}
-		break;
-	}
-	default:
-		CERROR("%s: Unknown ioctl cmd %#x\n",
-		       ctxt->loc_obd->obd_name, cmd);
-		GOTO(out_close, rc = -ENOTTY);
-	}
-
-out_close:
-	if (handle->lgh_hdr &&
-	    handle->lgh_hdr->llh_flags & LLOG_F_IS_CAT)
-		llog_cat_close(env, handle);
-	else
-		llog_close(env, handle);
-	return rc;
-}
-EXPORT_SYMBOL(llog_ioctl);
-- 
1.7.9.5


^ permalink raw reply related	[flat|nested] 13+ messages in thread

* [PATCH 12/12] staging/lustre/obdclass: remove local_storage.[ch]
  2014-09-05 20:08 [PATCH 00/12] staging/lustre: yet more dead code removal John L. Hammond
                   ` (10 preceding siblings ...)
  2014-09-05 20:08 ` [PATCH 11/12] staging/lustre/obdclass: remove llog_ioctl.c John L. Hammond
@ 2014-09-05 20:08 ` John L. Hammond
  11 siblings, 0 replies; 13+ messages in thread
From: John L. Hammond @ 2014-09-05 20:08 UTC (permalink / raw
  To: greg, andreas.dilger, oleg.drokin; +Cc: linux-kernel, John L. Hammond

From: "John L. Hammond" <john.hammond@intel.com>

Remove the unused files lustre/obdclass/local_storage.[ch].

Signed-off-by: John L. Hammond <john.hammond@intel.com>
---
 drivers/staging/lustre/lustre/obdclass/Makefile    |    2 +-
 .../staging/lustre/lustre/obdclass/local_storage.c |  894 --------------------
 .../staging/lustre/lustre/obdclass/local_storage.h |   91 --
 3 files changed, 1 insertion(+), 986 deletions(-)
 delete mode 100644 drivers/staging/lustre/lustre/obdclass/local_storage.c
 delete mode 100644 drivers/staging/lustre/lustre/obdclass/local_storage.h

diff --git a/drivers/staging/lustre/lustre/obdclass/Makefile b/drivers/staging/lustre/lustre/obdclass/Makefile
index 77fd94c..bf77532 100644
--- a/drivers/staging/lustre/lustre/obdclass/Makefile
+++ b/drivers/staging/lustre/lustre/obdclass/Makefile
@@ -4,6 +4,6 @@ obdclass-y := linux/linux-module.o linux/linux-obdo.o linux/linux-sysctl.o \
 	      llog.o llog_cat.o llog_obd.o llog_swab.o class_obd.o debug.o \
 	      genops.o uuid.o lprocfs_status.o \
 	      lustre_handles.o lustre_peer.o \
-	      local_storage.o statfs_pack.o obdo.o obd_config.o obd_mount.o\
+	      statfs_pack.o obdo.o obd_config.o obd_mount.o \
 	      lu_object.o dt_object.o capa.o cl_object.o   \
 	      cl_page.o cl_lock.o cl_io.o lu_ref.o acl.o
diff --git a/drivers/staging/lustre/lustre/obdclass/local_storage.c b/drivers/staging/lustre/lustre/obdclass/local_storage.c
deleted file mode 100644
index 6e0f6f2..0000000
--- a/drivers/staging/lustre/lustre/obdclass/local_storage.c
+++ /dev/null
@@ -1,894 +0,0 @@
-/*
- * GPL HEADER START
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 only,
- * as published by the Free Software Foundation.
-
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License version 2 for more details.  A copy is
- * included in the COPYING file that accompanied this code.
-
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- *
- * GPL HEADER END
- */
-/*
- * Copyright (c) 2012, Intel Corporation.
- */
-/*
- * lustre/obdclass/local_storage.c
- *
- * Local storage for file/objects with fid generation. Works on top of OSD.
- *
- * Author: Mikhail Pershin <mike.pershin@intel.com>
- */
-
-#define DEBUG_SUBSYSTEM S_CLASS
-
-#include "local_storage.h"
-
-/* all initialized local storages on this node are linked on this */
-static LIST_HEAD(ls_list_head);
-static DEFINE_MUTEX(ls_list_mutex);
-
-static int ls_object_init(const struct lu_env *env, struct lu_object *o,
-			  const struct lu_object_conf *unused)
-{
-	struct ls_device	*ls;
-	struct lu_object	*below;
-	struct lu_device	*under;
-
-	ls = container_of0(o->lo_dev, struct ls_device, ls_top_dev.dd_lu_dev);
-	under = &ls->ls_osd->dd_lu_dev;
-	below = under->ld_ops->ldo_object_alloc(env, o->lo_header, under);
-	if (below == NULL)
-		return -ENOMEM;
-
-	lu_object_add(o, below);
-
-	return 0;
-}
-
-static void ls_object_free(const struct lu_env *env, struct lu_object *o)
-{
-	struct ls_object	*obj = lu2ls_obj(o);
-	struct lu_object_header	*h = o->lo_header;
-
-	dt_object_fini(&obj->ls_obj);
-	lu_object_header_fini(h);
-	OBD_FREE_PTR(obj);
-}
-
-struct lu_object_operations ls_lu_obj_ops = {
-	.loo_object_init  = ls_object_init,
-	.loo_object_free  = ls_object_free,
-};
-
-struct lu_object *ls_object_alloc(const struct lu_env *env,
-				  const struct lu_object_header *_h,
-				  struct lu_device *d)
-{
-	struct lu_object_header	*h;
-	struct ls_object	*o;
-	struct lu_object	*l;
-
-	LASSERT(_h == NULL);
-
-	OBD_ALLOC_PTR(o);
-	if (o != NULL) {
-		l = &o->ls_obj.do_lu;
-		h = &o->ls_header;
-
-		lu_object_header_init(h);
-		dt_object_init(&o->ls_obj, h, d);
-		lu_object_add_top(h, l);
-
-		l->lo_ops = &ls_lu_obj_ops;
-
-		return l;
-	} else {
-		return NULL;
-	}
-}
-
-static struct lu_device_operations ls_lu_dev_ops = {
-	.ldo_object_alloc =	ls_object_alloc
-};
-
-static struct ls_device *__ls_find_dev(struct dt_device *dev)
-{
-	struct ls_device *ls, *ret = NULL;
-
-	list_for_each_entry(ls, &ls_list_head, ls_linkage) {
-		if (ls->ls_osd == dev) {
-			atomic_inc(&ls->ls_refcount);
-			ret = ls;
-			break;
-		}
-	}
-	return ret;
-}
-
-struct ls_device *ls_find_dev(struct dt_device *dev)
-{
-	struct ls_device *ls;
-
-	mutex_lock(&ls_list_mutex);
-	ls = __ls_find_dev(dev);
-	mutex_unlock(&ls_list_mutex);
-
-	return ls;
-}
-
-static struct lu_device_type_operations ls_device_type_ops = {
-	.ldto_start = NULL,
-	.ldto_stop  = NULL,
-};
-
-static struct lu_device_type ls_lu_type = {
-	.ldt_name = "local_storage",
-	.ldt_ops  = &ls_device_type_ops,
-};
-
-struct ls_device *ls_device_get(struct dt_device *dev)
-{
-	struct ls_device *ls;
-
-	mutex_lock(&ls_list_mutex);
-	ls = __ls_find_dev(dev);
-	if (ls)
-		GOTO(out_ls, ls);
-
-	/* not found, then create */
-	OBD_ALLOC_PTR(ls);
-	if (ls == NULL)
-		GOTO(out_ls, ls = ERR_PTR(-ENOMEM));
-
-	atomic_set(&ls->ls_refcount, 1);
-	INIT_LIST_HEAD(&ls->ls_los_list);
-	mutex_init(&ls->ls_los_mutex);
-
-	ls->ls_osd = dev;
-
-	LASSERT(dev->dd_lu_dev.ld_site);
-	lu_device_init(&ls->ls_top_dev.dd_lu_dev, &ls_lu_type);
-	ls->ls_top_dev.dd_lu_dev.ld_ops = &ls_lu_dev_ops;
-	ls->ls_top_dev.dd_lu_dev.ld_site = dev->dd_lu_dev.ld_site;
-
-	/* finally add ls to the list */
-	list_add(&ls->ls_linkage, &ls_list_head);
-out_ls:
-	mutex_unlock(&ls_list_mutex);
-	return ls;
-}
-
-void ls_device_put(const struct lu_env *env, struct ls_device *ls)
-{
-	LASSERT(env);
-	if (!atomic_dec_and_test(&ls->ls_refcount))
-		return;
-
-	mutex_lock(&ls_list_mutex);
-	if (atomic_read(&ls->ls_refcount) == 0) {
-		LASSERT(list_empty(&ls->ls_los_list));
-		list_del(&ls->ls_linkage);
-		lu_site_purge(env, ls->ls_top_dev.dd_lu_dev.ld_site, ~0);
-		lu_device_fini(&ls->ls_top_dev.dd_lu_dev);
-		OBD_FREE_PTR(ls);
-	}
-	mutex_unlock(&ls_list_mutex);
-}
-
-/**
- * local file fid generation
- */
-int local_object_fid_generate(const struct lu_env *env,
-			      struct local_oid_storage *los,
-			      struct lu_fid *fid)
-{
-	LASSERT(los->los_dev);
-	LASSERT(los->los_obj);
-
-	/* take next OID */
-
-	/* to make it unique after reboot we store
-	 * the latest generated fid atomically with
-	 * object creation see local_object_create() */
-
-	mutex_lock(&los->los_id_lock);
-	fid->f_seq = los->los_seq;
-	fid->f_oid = ++los->los_last_oid;
-	fid->f_ver = 0;
-	mutex_unlock(&los->los_id_lock);
-
-	return 0;
-}
-
-int local_object_declare_create(const struct lu_env *env,
-				struct local_oid_storage *los,
-				struct dt_object *o, struct lu_attr *attr,
-				struct dt_object_format *dof,
-				struct thandle *th)
-{
-	struct dt_thread_info	*dti = dt_info(env);
-	int			 rc;
-
-	/* update fid generation file */
-	if (los != NULL) {
-		LASSERT(dt_object_exists(los->los_obj));
-		rc = dt_declare_record_write(env, los->los_obj,
-					     sizeof(struct los_ondisk), 0, th);
-		if (rc)
-			return rc;
-	}
-
-	rc = dt_declare_create(env, o, attr, NULL, dof, th);
-	if (rc)
-		return rc;
-
-	dti->dti_lb.lb_buf = NULL;
-	dti->dti_lb.lb_len = sizeof(dti->dti_lma);
-	rc = dt_declare_xattr_set(env, o, &dti->dti_lb, XATTR_NAME_LMA, 0, th);
-
-	return rc;
-}
-
-int local_object_create(const struct lu_env *env,
-			struct local_oid_storage *los,
-			struct dt_object *o, struct lu_attr *attr,
-			struct dt_object_format *dof, struct thandle *th)
-{
-	struct dt_thread_info	*dti = dt_info(env);
-	__le64			 lastid;
-	int			 rc;
-
-	rc = dt_create(env, o, attr, NULL, dof, th);
-	if (rc)
-		return rc;
-
-	if (los == NULL)
-		return rc;
-
-	LASSERT(los->los_obj);
-	LASSERT(dt_object_exists(los->los_obj));
-
-	/* many threads can be updated this, serialize
-	 * them here to avoid the race where one thread
-	 * takes the value first, but writes it last */
-	mutex_lock(&los->los_id_lock);
-
-	/* update local oid number on disk so that
-	 * we know the last one used after reboot */
-	lastid = cpu_to_le64(los->los_last_oid);
-
-	dti->dti_off = 0;
-	dti->dti_lb.lb_buf = &lastid;
-	dti->dti_lb.lb_len = sizeof(lastid);
-	rc = dt_record_write(env, los->los_obj, &dti->dti_lb, &dti->dti_off,
-			     th);
-	mutex_unlock(&los->los_id_lock);
-
-	return rc;
-}
-
-/*
- * Create local named object (file, directory or index) in parent directory.
- */
-struct dt_object *__local_file_create(const struct lu_env *env,
-				      const struct lu_fid *fid,
-				      struct local_oid_storage *los,
-				      struct ls_device *ls,
-				      struct dt_object *parent,
-				      const char *name, struct lu_attr *attr,
-				      struct dt_object_format *dof)
-{
-	struct dt_thread_info	*dti = dt_info(env);
-	struct dt_object	*dto;
-	struct thandle		*th;
-	int			 rc;
-
-	dto = ls_locate(env, ls, fid);
-	if (unlikely(IS_ERR(dto)))
-		return dto;
-
-	LASSERT(dto != NULL);
-	if (dt_object_exists(dto))
-		GOTO(out, rc = -EEXIST);
-
-	th = dt_trans_create(env, ls->ls_osd);
-	if (IS_ERR(th))
-		GOTO(out, rc = PTR_ERR(th));
-
-	rc = local_object_declare_create(env, los, dto, attr, dof, th);
-	if (rc)
-		GOTO(trans_stop, rc);
-
-	if (dti->dti_dof.dof_type == DFT_DIR) {
-		dt_declare_ref_add(env, dto, th);
-		dt_declare_ref_add(env, parent, th);
-	}
-
-	rc = dt_declare_insert(env, parent, (void *)fid, (void *)name, th);
-	if (rc)
-		GOTO(trans_stop, rc);
-
-	rc = dt_trans_start_local(env, ls->ls_osd, th);
-	if (rc)
-		GOTO(trans_stop, rc);
-
-	dt_write_lock(env, dto, 0);
-	if (dt_object_exists(dto))
-		GOTO(unlock, rc = 0);
-
-	CDEBUG(D_OTHER, "create new object "DFID"\n",
-	       PFID(lu_object_fid(&dto->do_lu)));
-	rc = local_object_create(env, los, dto, attr, dof, th);
-	if (rc)
-		GOTO(unlock, rc);
-	LASSERT(dt_object_exists(dto));
-
-	if (dti->dti_dof.dof_type == DFT_DIR) {
-		if (!dt_try_as_dir(env, dto))
-			GOTO(destroy, rc = -ENOTDIR);
-		/* Add "." and ".." for newly created dir */
-		rc = dt_insert(env, dto, (void *)fid, (void *)".", th,
-			       BYPASS_CAPA, 1);
-		if (rc)
-			GOTO(destroy, rc);
-		dt_ref_add(env, dto, th);
-		rc = dt_insert(env, dto, (void *)lu_object_fid(&parent->do_lu),
-			       (void *)"..", th, BYPASS_CAPA, 1);
-		if (rc)
-			GOTO(destroy, rc);
-	}
-
-	dt_write_lock(env, parent, 0);
-	rc = dt_insert(env, parent, (const struct dt_rec *)fid,
-		       (const struct dt_key *)name, th, BYPASS_CAPA, 1);
-	if (dti->dti_dof.dof_type == DFT_DIR)
-		dt_ref_add(env, parent, th);
-	dt_write_unlock(env, parent);
-	if (rc)
-		GOTO(destroy, rc);
-destroy:
-	if (rc)
-		dt_destroy(env, dto, th);
-unlock:
-	dt_write_unlock(env, dto);
-trans_stop:
-	dt_trans_stop(env, ls->ls_osd, th);
-out:
-	if (rc) {
-		lu_object_put_nocache(env, &dto->do_lu);
-		dto = ERR_PTR(rc);
-	}
-	return dto;
-}
-
-/*
- * Look up and create (if it does not exist) a local named file or directory in
- * parent directory.
- */
-struct dt_object *local_file_find_or_create(const struct lu_env *env,
-					    struct local_oid_storage *los,
-					    struct dt_object *parent,
-					    const char *name, __u32 mode)
-{
-	struct dt_thread_info	*dti = dt_info(env);
-	struct dt_object	*dto;
-	int			 rc;
-
-	LASSERT(parent);
-
-	rc = dt_lookup_dir(env, parent, name, &dti->dti_fid);
-	if (rc == 0)
-		/* name is found, get the object */
-		dto = ls_locate(env, dt2ls_dev(los->los_dev), &dti->dti_fid);
-	else if (rc != -ENOENT)
-		dto = ERR_PTR(rc);
-	else {
-		rc = local_object_fid_generate(env, los, &dti->dti_fid);
-		if (rc < 0) {
-			dto = ERR_PTR(rc);
-		} else {
-			/* create the object */
-			dti->dti_attr.la_valid	= LA_MODE;
-			dti->dti_attr.la_mode	= mode;
-			dti->dti_dof.dof_type	= dt_mode_to_dft(mode & S_IFMT);
-			dto = __local_file_create(env, &dti->dti_fid, los,
-						  dt2ls_dev(los->los_dev),
-						  parent, name, &dti->dti_attr,
-						  &dti->dti_dof);
-		}
-	}
-	return dto;
-}
-EXPORT_SYMBOL(local_file_find_or_create);
-
-struct dt_object *local_file_find_or_create_with_fid(const struct lu_env *env,
-						     struct dt_device *dt,
-						     const struct lu_fid *fid,
-						     struct dt_object *parent,
-						     const char *name,
-						     __u32 mode)
-{
-	struct dt_thread_info	*dti = dt_info(env);
-	struct dt_object	*dto;
-	int			 rc;
-
-	LASSERT(parent);
-
-	rc = dt_lookup_dir(env, parent, name, &dti->dti_fid);
-	if (rc == 0) {
-		dto = dt_locate(env, dt, &dti->dti_fid);
-	} else if (rc != -ENOENT) {
-		dto = ERR_PTR(rc);
-	} else {
-		struct ls_device *ls;
-
-		ls = ls_device_get(dt);
-		if (IS_ERR(ls)) {
-			dto = ERR_CAST(ls);
-		} else {
-			/* create the object */
-			dti->dti_attr.la_valid	= LA_MODE;
-			dti->dti_attr.la_mode	= mode;
-			dti->dti_dof.dof_type	= dt_mode_to_dft(mode & S_IFMT);
-			dto = __local_file_create(env, fid, NULL, ls, parent,
-						  name, &dti->dti_attr,
-						  &dti->dti_dof);
-			/* ls_device_put() will finalize the ls device, we
-			 * have to open the object in other device stack */
-			if (!IS_ERR(dto)) {
-				dti->dti_fid = dto->do_lu.lo_header->loh_fid;
-				lu_object_put_nocache(env, &dto->do_lu);
-				dto = dt_locate(env, dt, &dti->dti_fid);
-			}
-			ls_device_put(env, ls);
-		}
-	}
-	return dto;
-}
-EXPORT_SYMBOL(local_file_find_or_create_with_fid);
-
-/*
- * Look up and create (if it does not exist) a local named index file in parent
- * directory.
- */
-struct dt_object *local_index_find_or_create(const struct lu_env *env,
-					     struct local_oid_storage *los,
-					     struct dt_object *parent,
-					     const char *name, __u32 mode,
-					     const struct dt_index_features *ft)
-{
-	struct dt_thread_info	*dti = dt_info(env);
-	struct dt_object	*dto;
-	int			 rc;
-
-	LASSERT(parent);
-
-	rc = dt_lookup_dir(env, parent, name, &dti->dti_fid);
-	if (rc == 0) {
-		/* name is found, get the object */
-		dto = ls_locate(env, dt2ls_dev(los->los_dev), &dti->dti_fid);
-	} else if (rc != -ENOENT) {
-		dto = ERR_PTR(rc);
-	} else {
-		rc = local_object_fid_generate(env, los, &dti->dti_fid);
-		if (rc < 0) {
-			dto = ERR_PTR(rc);
-		} else {
-			/* create the object */
-			dti->dti_attr.la_valid		= LA_MODE;
-			dti->dti_attr.la_mode		= mode;
-			dti->dti_dof.dof_type		= DFT_INDEX;
-			dti->dti_dof.u.dof_idx.di_feat	= ft;
-			dto = __local_file_create(env, &dti->dti_fid, los,
-						  dt2ls_dev(los->los_dev),
-						  parent, name, &dti->dti_attr,
-						  &dti->dti_dof);
-		}
-	}
-	return dto;
-
-}
-EXPORT_SYMBOL(local_index_find_or_create);
-
-struct dt_object *
-local_index_find_or_create_with_fid(const struct lu_env *env,
-				    struct dt_device *dt,
-				    const struct lu_fid *fid,
-				    struct dt_object *parent,
-				    const char *name, __u32 mode,
-				    const struct dt_index_features *ft)
-{
-	struct dt_thread_info	*dti = dt_info(env);
-	struct dt_object	*dto;
-	int			 rc;
-
-	LASSERT(parent);
-
-	rc = dt_lookup_dir(env, parent, name, &dti->dti_fid);
-	if (rc == 0) {
-		/* name is found, get the object */
-		if (!lu_fid_eq(fid, &dti->dti_fid))
-			dto = ERR_PTR(-EINVAL);
-		else
-			dto = dt_locate(env, dt, fid);
-	} else if (rc != -ENOENT) {
-		dto = ERR_PTR(rc);
-	} else {
-		struct ls_device *ls;
-
-		ls = ls_device_get(dt);
-		if (IS_ERR(ls)) {
-			dto = ERR_CAST(ls);
-		} else {
-			/* create the object */
-			dti->dti_attr.la_valid		= LA_MODE;
-			dti->dti_attr.la_mode		= mode;
-			dti->dti_dof.dof_type		= DFT_INDEX;
-			dti->dti_dof.u.dof_idx.di_feat  = ft;
-			dto = __local_file_create(env, fid, NULL, ls, parent,
-						  name, &dti->dti_attr,
-						  &dti->dti_dof);
-			/* ls_device_put() will finalize the ls device, we
-			 * have to open the object in other device stack */
-			if (!IS_ERR(dto)) {
-				dti->dti_fid = dto->do_lu.lo_header->loh_fid;
-				lu_object_put_nocache(env, &dto->do_lu);
-				dto = dt_locate(env, dt, &dti->dti_fid);
-			}
-			ls_device_put(env, ls);
-		}
-	}
-	return dto;
-}
-EXPORT_SYMBOL(local_index_find_or_create_with_fid);
-
-static int local_object_declare_unlink(const struct lu_env *env,
-				       struct dt_device *dt,
-				       struct dt_object *p,
-				       struct dt_object *c, const char *name,
-				       struct thandle *th)
-{
-	int rc;
-
-	rc = dt_declare_delete(env, p, (const struct dt_key *)name, th);
-	if (rc < 0)
-		return rc;
-
-	rc = dt_declare_ref_del(env, c, th);
-	if (rc < 0)
-		return rc;
-
-	return dt_declare_destroy(env, c, th);
-}
-
-int local_object_unlink(const struct lu_env *env, struct dt_device *dt,
-			struct dt_object *parent, const char *name)
-{
-	struct dt_thread_info	*dti = dt_info(env);
-	struct dt_object	*dto;
-	struct thandle		*th;
-	int			 rc;
-
-	rc = dt_lookup_dir(env, parent, name, &dti->dti_fid);
-	if (rc == -ENOENT)
-		return 0;
-	else if (rc < 0)
-		return rc;
-
-	dto = dt_locate(env, dt, &dti->dti_fid);
-	if (unlikely(IS_ERR(dto)))
-		return PTR_ERR(dto);
-
-	th = dt_trans_create(env, dt);
-	if (IS_ERR(th))
-		GOTO(out, rc = PTR_ERR(th));
-
-	rc = local_object_declare_unlink(env, dt, parent, dto, name, th);
-	if (rc < 0)
-		GOTO(stop, rc);
-
-	rc = dt_trans_start_local(env, dt, th);
-	if (rc < 0)
-		GOTO(stop, rc);
-
-	dt_write_lock(env, dto, 0);
-	rc = dt_delete(env, parent, (struct dt_key *)name, th, BYPASS_CAPA);
-	if (rc < 0)
-		GOTO(unlock, rc);
-
-	rc = dt_ref_del(env, dto, th);
-	if (rc < 0) {
-		rc = dt_insert(env, parent,
-			       (const struct dt_rec *)&dti->dti_fid,
-			       (const struct dt_key *)name, th, BYPASS_CAPA, 1);
-		GOTO(unlock, rc);
-	}
-
-	rc = dt_destroy(env, dto, th);
-unlock:
-	dt_write_unlock(env, dto);
-stop:
-	dt_trans_stop(env, dt, th);
-out:
-	lu_object_put_nocache(env, &dto->do_lu);
-	return rc;
-}
-EXPORT_SYMBOL(local_object_unlink);
-
-struct local_oid_storage *dt_los_find(struct ls_device *ls, __u64 seq)
-{
-	struct local_oid_storage *los, *ret = NULL;
-
-	list_for_each_entry(los, &ls->ls_los_list, los_list) {
-		if (los->los_seq == seq) {
-			atomic_inc(&los->los_refcount);
-			ret = los;
-			break;
-		}
-	}
-	return ret;
-}
-
-void dt_los_put(struct local_oid_storage *los)
-{
-	if (atomic_dec_and_test(&los->los_refcount))
-		/* should never happen, only local_oid_storage_fini should
-		 * drop refcount to zero */
-		LBUG();
-	return;
-}
-
-/* after Lustre 2.3 release there may be old file to store last generated FID
- * If such file exists then we have to read its content
- */
-int lastid_compat_check(const struct lu_env *env, struct dt_device *dev,
-			__u64 lastid_seq, __u32 *first_oid, struct ls_device *ls)
-{
-	struct dt_thread_info	*dti = dt_info(env);
-	struct dt_object	*root = NULL;
-	struct los_ondisk	 losd;
-	struct dt_object	*o = NULL;
-	int			 rc = 0;
-
-	rc = dt_root_get(env, dev, &dti->dti_fid);
-	if (rc)
-		return rc;
-
-	root = ls_locate(env, ls, &dti->dti_fid);
-	if (IS_ERR(root))
-		return PTR_ERR(root);
-
-	/* find old last_id file */
-	snprintf(dti->dti_buf, sizeof(dti->dti_buf), "seq-%#llx-lastid",
-		 lastid_seq);
-	rc = dt_lookup_dir(env, root, dti->dti_buf, &dti->dti_fid);
-	lu_object_put_nocache(env, &root->do_lu);
-	if (rc == -ENOENT) {
-		/* old llog lastid accessed by FID only */
-		if (lastid_seq != FID_SEQ_LLOG)
-			return 0;
-		dti->dti_fid.f_seq = FID_SEQ_LLOG;
-		dti->dti_fid.f_oid = 1;
-		dti->dti_fid.f_ver = 0;
-		o = ls_locate(env, ls, &dti->dti_fid);
-		if (IS_ERR(o))
-			return PTR_ERR(o);
-
-		if (!dt_object_exists(o)) {
-			lu_object_put_nocache(env, &o->do_lu);
-			return 0;
-		}
-		CDEBUG(D_INFO, "Found old llog lastid file\n");
-	} else if (rc < 0) {
-		return rc;
-	} else {
-		CDEBUG(D_INFO, "Found old lastid file for sequence %#llx\n",
-		       lastid_seq);
-		o = ls_locate(env, ls, &dti->dti_fid);
-		if (IS_ERR(o))
-			return PTR_ERR(o);
-	}
-	/* let's read seq-NNNNNN-lastid file value */
-	LASSERT(dt_object_exists(o));
-	dti->dti_off = 0;
-	dti->dti_lb.lb_buf = &losd;
-	dti->dti_lb.lb_len = sizeof(losd);
-	dt_read_lock(env, o, 0);
-	rc = dt_record_read(env, o, &dti->dti_lb, &dti->dti_off);
-	dt_read_unlock(env, o);
-	lu_object_put_nocache(env, &o->do_lu);
-	if (rc == 0 && le32_to_cpu(losd.lso_magic) != LOS_MAGIC) {
-		CERROR("%s: wrong content of seq-%#llx-lastid file, magic %x\n",
-		       o->do_lu.lo_dev->ld_obd->obd_name, lastid_seq,
-		       le32_to_cpu(losd.lso_magic));
-		return -EINVAL;
-	} else if (rc < 0) {
-		CERROR("%s: failed to read seq-%#llx-lastid: rc = %d\n",
-		       o->do_lu.lo_dev->ld_obd->obd_name, lastid_seq, rc);
-		return rc;
-	}
-	*first_oid = le32_to_cpu(losd.lso_next_oid);
-	return rc;
-}
-
-/**
- * Initialize local OID storage for required sequence.
- * That may be needed for services that uses local files and requires
- * dynamic OID allocation for them.
- *
- * Per each sequence we have an object with 'first_fid' identificator
- * containing the counter for OIDs of locally created files with that
- * sequence.
- *
- * It is used now by llog subsystem and MGS for NID tables
- *
- * Function gets first_fid to create counter object.
- * All dynamic fids will be generated with the same sequence and incremented
- * OIDs
- *
- * Returned local_oid_storage is in-memory representation of OID storage
- */
-int local_oid_storage_init(const struct lu_env *env, struct dt_device *dev,
-			   const struct lu_fid *first_fid,
-			   struct local_oid_storage **los)
-{
-	struct dt_thread_info	*dti = dt_info(env);
-	struct ls_device	*ls;
-	u64			 lastid;
-	struct dt_object	*o = NULL;
-	struct thandle		*th;
-	__u32			 first_oid = fid_oid(first_fid);
-	int			 rc = 0;
-
-	ls = ls_device_get(dev);
-	if (IS_ERR(ls))
-		return PTR_ERR(ls);
-
-	mutex_lock(&ls->ls_los_mutex);
-	*los = dt_los_find(ls, fid_seq(first_fid));
-	if (*los != NULL)
-		GOTO(out, rc = 0);
-
-	/* not found, then create */
-	OBD_ALLOC_PTR(*los);
-	if (*los == NULL)
-		GOTO(out, rc = -ENOMEM);
-
-	atomic_set(&(*los)->los_refcount, 1);
-	mutex_init(&(*los)->los_id_lock);
-	(*los)->los_dev = &ls->ls_top_dev;
-	atomic_inc(&ls->ls_refcount);
-	list_add(&(*los)->los_list, &ls->ls_los_list);
-
-	/* Use {seq, 0, 0} to create the LAST_ID file for every
-	 * sequence.  OIDs start at LUSTRE_FID_INIT_OID.
-	 */
-	dti->dti_fid.f_seq = fid_seq(first_fid);
-	dti->dti_fid.f_oid = LUSTRE_FID_LASTID_OID;
-	dti->dti_fid.f_ver = 0;
-	o = ls_locate(env, ls, &dti->dti_fid);
-	if (IS_ERR(o))
-		GOTO(out_los, rc = PTR_ERR(o));
-
-	if (!dt_object_exists(o)) {
-		rc = lastid_compat_check(env, dev, fid_seq(first_fid),
-					 &first_oid, ls);
-		if (rc < 0)
-			GOTO(out_los, rc);
-
-		th = dt_trans_create(env, dev);
-		if (IS_ERR(th))
-			GOTO(out_los, rc = PTR_ERR(th));
-
-		dti->dti_attr.la_valid = LA_MODE | LA_TYPE;
-		dti->dti_attr.la_mode = S_IFREG | S_IRUGO | S_IWUSR;
-		dti->dti_dof.dof_type = dt_mode_to_dft(S_IFREG);
-
-		rc = dt_declare_create(env, o, &dti->dti_attr, NULL,
-				       &dti->dti_dof, th);
-		if (rc)
-			GOTO(out_trans, rc);
-
-		rc = dt_declare_record_write(env, o, sizeof(lastid), 0, th);
-		if (rc)
-			GOTO(out_trans, rc);
-
-		rc = dt_trans_start_local(env, dev, th);
-		if (rc)
-			GOTO(out_trans, rc);
-
-		dt_write_lock(env, o, 0);
-		if (dt_object_exists(o))
-			GOTO(out_lock, rc = 0);
-
-		rc = dt_create(env, o, &dti->dti_attr, NULL, &dti->dti_dof,
-			       th);
-		if (rc)
-			GOTO(out_lock, rc);
-
-		lastid = cpu_to_le64(first_oid);
-
-		dti->dti_off = 0;
-		dti->dti_lb.lb_buf = &lastid;
-		dti->dti_lb.lb_len = sizeof(lastid);
-		rc = dt_record_write(env, o, &dti->dti_lb, &dti->dti_off, th);
-		if (rc)
-			GOTO(out_lock, rc);
-out_lock:
-		dt_write_unlock(env, o);
-out_trans:
-		dt_trans_stop(env, dev, th);
-	} else {
-		dti->dti_off = 0;
-		dti->dti_lb.lb_buf = &lastid;
-		dti->dti_lb.lb_len = sizeof(lastid);
-		dt_read_lock(env, o, 0);
-		rc = dt_record_read(env, o, &dti->dti_lb, &dti->dti_off);
-		dt_read_unlock(env, o);
-		if (rc == 0 && le64_to_cpu(lastid) > OBIF_MAX_OID) {
-			CERROR("%s: bad oid %llu is read from LAST_ID\n",
-			       o->do_lu.lo_dev->ld_obd->obd_name,
-			       le64_to_cpu(lastid));
-			rc = -EINVAL;
-		}
-	}
-out_los:
-	if (rc != 0) {
-		list_del(&(*los)->los_list);
-		atomic_dec(&ls->ls_refcount);
-		OBD_FREE_PTR(*los);
-		*los = NULL;
-		if (o != NULL && !IS_ERR(o))
-			lu_object_put_nocache(env, &o->do_lu);
-	} else {
-		(*los)->los_seq = fid_seq(first_fid);
-		(*los)->los_last_oid = le64_to_cpu(lastid);
-		(*los)->los_obj = o;
-		/* Read value should not be less than initial one
-		 * but possible after upgrade from older fs.
-		 * In this case just switch to the first_oid in memory and
-		 * it will be updated on disk with first object generated */
-		if ((*los)->los_last_oid < first_oid)
-			(*los)->los_last_oid = first_oid;
-	}
-out:
-	mutex_unlock(&ls->ls_los_mutex);
-	ls_device_put(env, ls);
-	return rc;
-}
-EXPORT_SYMBOL(local_oid_storage_init);
-
-void local_oid_storage_fini(const struct lu_env *env,
-			    struct local_oid_storage *los)
-{
-	struct ls_device *ls;
-
-	if (!atomic_dec_and_test(&los->los_refcount))
-		return;
-
-	LASSERT(env);
-	LASSERT(los->los_dev);
-	ls = dt2ls_dev(los->los_dev);
-
-	mutex_lock(&ls->ls_los_mutex);
-	if (atomic_read(&los->los_refcount) == 0) {
-		if (los->los_obj)
-			lu_object_put_nocache(env, &los->los_obj->do_lu);
-		list_del(&los->los_list);
-		OBD_FREE_PTR(los);
-	}
-	mutex_unlock(&ls->ls_los_mutex);
-	ls_device_put(env, ls);
-}
-EXPORT_SYMBOL(local_oid_storage_fini);
diff --git a/drivers/staging/lustre/lustre/obdclass/local_storage.h b/drivers/staging/lustre/lustre/obdclass/local_storage.h
deleted file mode 100644
index 0b9ad33..0000000
--- a/drivers/staging/lustre/lustre/obdclass/local_storage.h
+++ /dev/null
@@ -1,91 +0,0 @@
-/*
- * GPL HEADER START
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 only,
- * as published by the Free Software Foundation.
-
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License version 2 for more details.  A copy is
- * included in the COPYING file that accompanied this code.
-
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- *
- * GPL HEADER END
- */
-/*
- * Copyright (c) 2012, Intel Corporation.
- */
-/*
- * lustre/obdclass/local_storage.c
- *
- * Local storage for file/objects with fid generation. Works on top of OSD.
- *
- * Author: Mikhail Pershin <mike.pershin@intel.com>
- */
-#ifndef __LOCAL_STORAGE_H
-#define __LOCAL_STORAGE_H
-
-#include "../include/dt_object.h"
-#include "../include/obd.h"
-#include "../include/lustre_fid.h"
-#include "../include/lustre_disk.h"
-
-struct ls_device {
-	struct dt_device	 ls_top_dev;
-	/* all initialized ls_devices on this node linked by this */
-	struct list_head		 ls_linkage;
-	/* how many handle's reference this local storage */
-	atomic_t		 ls_refcount;
-	/* underlaying OSD device */
-	struct dt_device	*ls_osd;
-	/* list of all local OID storages */
-	struct list_head		 ls_los_list;
-	struct mutex		 ls_los_mutex;
-};
-
-static inline struct ls_device *dt2ls_dev(struct dt_device *d)
-{
-	return container_of0(d, struct ls_device, ls_top_dev);
-}
-
-struct ls_object {
-	struct lu_object_header	 ls_header;
-	struct dt_object	 ls_obj;
-};
-
-static inline struct ls_object *lu2ls_obj(struct lu_object *o)
-{
-	return container_of0(o, struct ls_object, ls_obj.do_lu);
-}
-
-static inline struct dt_object *ls_locate(const struct lu_env *env,
-					  struct ls_device *ls,
-					  const struct lu_fid *fid)
-{
-	return dt_locate_at(env, ls->ls_osd, fid, &ls->ls_top_dev.dd_lu_dev);
-}
-
-struct ls_device *ls_device_get(struct dt_device *dev);
-void ls_device_put(const struct lu_env *env, struct ls_device *ls);
-struct local_oid_storage *dt_los_find(struct ls_device *ls, __u64 seq);
-void dt_los_put(struct local_oid_storage *los);
-
-/* Lustre 2.3 on-disk structure describing local object OIDs storage
- * the structure to be used with any sequence managed by
- * local object library.
- * Obsoleted since 2.4 but is kept for compatibility reasons,
- * see lastid_compat_check() in obdclass/local_storage.c */
-struct los_ondisk {
-	__u32 lso_magic;
-	__u32 lso_next_oid;
-};
-
-#define LOS_MAGIC	0xdecafbee
-#endif
-- 
1.7.9.5


^ permalink raw reply related	[flat|nested] 13+ messages in thread

end of thread, other threads:[~2014-09-05 20:12 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-09-05 20:08 [PATCH 00/12] staging/lustre: yet more dead code removal John L. Hammond
2014-09-05 20:08 ` [PATCH 01/12] staging/lustre/lov: remove unused OBD methods John L. Hammond
2014-09-05 20:08 ` [PATCH 02/12] staging/lustre/osc: " John L. Hammond
2014-09-05 20:08 ` [PATCH 03/12] staging/lustre/osc: remove obsolete llog handling code John L. Hammond
2014-09-05 20:08 ` [PATCH 04/12] staging/lustre: remove obd_ost.h John L. Hammond
2014-09-05 20:08 ` [PATCH 05/12] staging/lustre/mdc: remove unused OBD methods John L. Hammond
2014-09-05 20:08 ` [PATCH 06/12] staging/lustre/mdc: inline llog methods John L. Hammond
2014-09-05 20:08 ` [PATCH 07/12] staging/lustre/mgc: inline mgc_cancel() John L. Hammond
2014-09-05 20:08 ` [PATCH 08/12] staging/lustre: remove unused OBD methods John L. Hammond
2014-09-05 20:08 ` [PATCH 09/12] staging/lustre/mgc: remove server specific llog handling John L. Hammond
2014-09-05 20:08 ` [PATCH 10/12] staging/lustre/ptlrpc: remove sptlrpc_conf_target_get_rules() John L. Hammond
2014-09-05 20:08 ` [PATCH 11/12] staging/lustre/obdclass: remove llog_ioctl.c John L. Hammond
2014-09-05 20:08 ` [PATCH 12/12] staging/lustre/obdclass: remove local_storage.[ch] John L. Hammond

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.