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

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

staging: lustre: lov: remove unused code



Remove:
  the tested but never set flag OBD_STATFS_PTLRPCD,
  the empty file lustre/lov/lovsub_io.c,
  the unused ld_emerg member of struct lov_device,
  the unused struct lov_device_emerg and supporting functions,
  the unused struct lov_lock_link and supporting functions, and
  the unused, get only, or set only members of struct
  lovsub_device, lovsub_lock, lov_sublock_env, lov_thread_info,
  lov_io_sub, lov_io, lov_request, and lov_request_set.
Reduce the scope of several functions from lov_request.c.

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


Reviewed-by: default avatarFrank Zago <fzago@cray.com>
Reviewed-by: default avatarBen Evans <bevans@cray.com>
Reviewed-by: default avatarJames Simmons <uja.ornl@yahoo.com>
Reviewed-by: default avatarOleg Drokin <oleg.drokin@intel.com>
Signed-off-by: default avatarJames Simmons <jsimmons@infradead.org>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent fb04f121
Loading
Loading
Loading
Loading
+1 −8
Original line number Diff line number Diff line
@@ -46,14 +46,7 @@
#define OBD_STATFS_FROM_CACHE   0x0002  /* the statfs callback should not update
					 * obd_osfs_age
					 */
#define OBD_STATFS_PTLRPCD      0x0004  /* requests will be sent via ptlrpcd
					 * instead of a specific set. This
					 * means that we cannot rely on the set
					 * interpret routine to be called.
					 * lov_statfs_fini() must thus be called
					 * by the request interpret routine
					 */
#define OBD_STATFS_FOR_MDT0	0x0008	/* The statfs is only for retrieving
#define OBD_STATFS_FOR_MDT0	0x0004	/* The statfs is only for retrieving
					 * information from MDT0.
					 */

+1 −1
Original line number Diff line number Diff line
@@ -2,4 +2,4 @@ obj-$(CONFIG_LUSTRE_FS) += lov.o
lov-y := lov_obd.o lov_pack.o lov_offset.o lov_merge.o \
	 lov_request.o lov_ea.o lov_dev.o lov_object.o lov_page.o  \
	 lov_lock.o lov_io.o lovsub_dev.o lovsub_object.o lovsub_page.o      \
	 lovsub_lock.o lovsub_io.o lov_pool.o lproc_lov.o
	 lovsub_lock.o lov_pool.o lproc_lov.o
+0 −90
Original line number Diff line number Diff line
@@ -92,35 +92,6 @@ enum lov_device_flags {
 * Upper half.
 */

/**
 * Resources that are used in memory-cleaning path, and whose allocation
 * cannot fail even when memory is tight. They are preallocated in sufficient
 * quantities in lov_device::ld_emerg[], and access to them is serialized
 * lov_device::ld_mutex.
 */
struct lov_device_emerg {
	/**
	 * Page list used to submit IO when memory is in pressure.
	 */
	struct cl_page_list emrg_page_list;
	/**
	 * sub-io's shared by all threads accessing this device when memory is
	 * too low to allocate sub-io's dynamically.
	 */
	struct cl_io	emrg_subio;
	/**
	 * Environments used by sub-io's in
	 * lov_device_emerg::emrg_subio.
	 */
	struct lu_env      *emrg_env;
	/**
	 * Refchecks for lov_device_emerg::emrg_env.
	 *
	 * \see cl_env_get()
	 */
	u16		 emrg_refcheck;
};

struct lov_device {
	/*
	 * XXX Locking of lov-private data is missing.
@@ -131,14 +102,6 @@ struct lov_device {
	__u32		     ld_target_nr;
	struct lovsub_device    **ld_target;
	__u32		     ld_flags;

	/** Emergency resources used in memory-cleansing paths. */
	struct lov_device_emerg **ld_emrg;
	/**
	 * Serializes access to lov_device::ld_emrg in low-memory
	 * conditions.
	 */
	struct mutex		  ld_mutex;
};

/**
@@ -299,8 +262,6 @@ struct lov_page {

struct lovsub_device {
	struct cl_device   acid_cl;
	struct lov_device *acid_super;
	int		acid_idx;
	struct cl_device  *acid_next;
};

@@ -311,43 +272,11 @@ struct lovsub_object {
	int		     lso_index;
};

/**
 * A link between a top-lock and a sub-lock. Separate data-structure is
 * necessary, because top-locks and sub-locks are in M:N relationship.
 *
 * \todo This can be optimized for a (by far) most frequent case of a single
 * top-lock per sub-lock.
 */
struct lov_lock_link {
	struct lov_lock *lll_super;
	/** An index within parent lock. */
	int	      lll_idx;
	/**
	 * A linkage into per sub-lock list of all corresponding top-locks,
	 * hanging off lovsub_lock::lss_parents.
	 */
	struct list_head       lll_list;
};

/**
 * Lock state at lovsub layer.
 */
struct lovsub_lock {
	struct cl_lock_slice  lss_cl;
	/**
	 * List of top-locks that have given sub-lock as their part. Protected
	 * by cl_lock::cll_guard mutex.
	 */
	struct list_head	    lss_parents;
	/**
	 * Top-lock that initiated current operation on this sub-lock. This is
	 * only set during top-to-bottom lock operations like enqueue, and is
	 * used to optimize state change notification. Protected by
	 * cl_lock::cll_guard mutex.
	 *
	 * \see lovsub_lock_state_one().
	 */
	struct cl_lock       *lss_active;
};

/**
@@ -356,7 +285,6 @@ struct lovsub_lock {
struct lov_sublock_env {
	const struct lu_env *lse_env;
	struct cl_io	*lse_io;
	struct lov_io_sub   *lse_sub;
};

struct lovsub_page {
@@ -366,12 +294,10 @@ struct lovsub_page {
struct lov_thread_info {
	struct cl_object_conf   lti_stripe_conf;
	struct lu_fid	   lti_fid;
	struct cl_lock_descr    lti_ldescr;
	struct ost_lvb	  lti_lvb;
	struct cl_2queue	lti_cl2q;
	struct cl_page_list     lti_plist;
	wait_queue_entry_t	  lti_waiter;
	struct cl_attr          lti_attr;
};

/**
@@ -385,7 +311,6 @@ struct lov_io_sub {
	 * \see cl_env_get()
	 */
	u16			 sub_refcheck;
	u16			 sub_reenter;
	/**
	 * true, iff cl_io_init() was successfully executed against
	 * lov_io_sub::sub_io.
@@ -445,7 +370,6 @@ struct lov_io {
	 */
	u64	    lis_endpos;

	int		lis_mem_frozen;
	int		lis_stripe_count;
	int		lis_active_subios;

@@ -485,8 +409,6 @@ extern struct kmem_cache *lov_session_kmem;
extern struct kmem_cache *lovsub_lock_kmem;
extern struct kmem_cache *lovsub_object_kmem;

extern struct kmem_cache *lov_lock_link_kmem;

int lov_object_init(const struct lu_env *env, struct lu_object *obj,
		    const struct lu_object_conf *conf);
int lovsub_object_init(const struct lu_env *env, struct lu_object *obj,
@@ -508,15 +430,9 @@ int lov_io_init_empty(const struct lu_env *env, struct cl_object *obj,
		      struct cl_io *io);
int lov_io_init_released(const struct lu_env *env, struct cl_object *obj,
			 struct cl_io *io);
void lov_lock_unlink(const struct lu_env *env, struct lov_lock_link *link,
		     struct lovsub_lock *sub);

struct lov_io_sub *lov_sub_get(const struct lu_env *env, struct lov_io *lio,
			       int stripe);
void lov_sub_put(struct lov_io_sub *sub);
int lov_sublock_modify(const struct lu_env *env, struct lov_lock *lov,
		       struct lovsub_lock *sublock,
		       const struct cl_lock_descr *d, int idx);

int lov_page_init(const struct lu_env *env, struct cl_object *ob,
		  struct cl_page *page, pgoff_t index);
@@ -533,12 +449,6 @@ struct lu_object *lovsub_object_alloc(const struct lu_env *env,
				      const struct lu_object_header *hdr,
				      struct lu_device *dev);

struct lov_lock_link *lov_lock_link_find(const struct lu_env *env,
					 struct lov_lock *lck,
					 struct lovsub_lock *sub);
struct lov_io_sub *lov_page_subio(const struct lu_env *env, struct lov_io *lio,
				  const struct cl_page_slice *slice);

struct lov_stripe_md *lov_lsm_addref(struct lov_object *lov);
int lov_page_stripe(const struct cl_page *page);

+0 −85
Original line number Diff line number Diff line
@@ -50,11 +50,6 @@ struct kmem_cache *lov_session_kmem;
struct kmem_cache *lovsub_lock_kmem;
struct kmem_cache *lovsub_object_kmem;

struct kmem_cache *lov_lock_link_kmem;

/** Lock class of lov_device::ld_mutex. */
static struct lock_class_key cl_lov_device_mutex_class;

struct lu_kmem_descr lov_caches[] = {
	{
		.ckd_cache = &lov_lock_kmem,
@@ -86,11 +81,6 @@ struct lu_kmem_descr lov_caches[] = {
		.ckd_name  = "lovsub_object_kmem",
		.ckd_size  = sizeof(struct lovsub_object)
	},
	{
		.ckd_cache = &lov_lock_link_kmem,
		.ckd_name  = "lov_lock_link_kmem",
		.ckd_size  = sizeof(struct lov_lock_link)
	},
	{
		.ckd_cache = NULL
	}
@@ -204,8 +194,6 @@ static int lov_device_init(const struct lu_env *env, struct lu_device *d,
			break;
		}
		lsd = cl2lovsub_dev(cl);
		lsd->acid_idx = i;
		lsd->acid_super = ld;
		ld->ld_target[i] = lsd;
	}

@@ -217,34 +205,13 @@ static int lov_device_init(const struct lu_env *env, struct lu_device *d,
	return rc;
}

static void lov_emerg_free(struct lov_device_emerg **emrg, int nr)
{
	int i;

	for (i = 0; i < nr; ++i) {
		struct lov_device_emerg *em;

		em = emrg[i];
		if (em) {
			LASSERT(em->emrg_page_list.pl_nr == 0);
			if (em->emrg_env)
				cl_env_put(em->emrg_env, &em->emrg_refcheck);
			kfree(em);
		}
	}
	kfree(emrg);
}

static struct lu_device *lov_device_free(const struct lu_env *env,
					 struct lu_device *d)
{
	struct lov_device *ld = lu2lov_dev(d);
	const int	  nr = ld->ld_target_nr;

	cl_device_fini(lu2cl_dev(d));
	kfree(ld->ld_target);
	if (ld->ld_emrg)
		lov_emerg_free(ld->ld_emrg, nr);
	kfree(ld);
	return NULL;
}
@@ -260,41 +227,6 @@ static void lov_cl_del_target(const struct lu_env *env, struct lu_device *dev,
	}
}

static struct lov_device_emerg **lov_emerg_alloc(int nr)
{
	struct lov_device_emerg **emerg;
	int i;
	int result;

	emerg = kcalloc(nr, sizeof(emerg[0]), GFP_NOFS);
	if (!emerg)
		return ERR_PTR(-ENOMEM);
	for (result = i = 0; i < nr && result == 0; i++) {
		struct lov_device_emerg *em;

		em = kzalloc(sizeof(*em), GFP_NOFS);
		if (em) {
			emerg[i] = em;
			cl_page_list_init(&em->emrg_page_list);
			em->emrg_env = cl_env_alloc(&em->emrg_refcheck,
						    LCT_REMEMBER | LCT_NOREF);
			if (!IS_ERR(em->emrg_env)) {
				em->emrg_env->le_ctx.lc_cookie = 0x2;
			} else {
				result = PTR_ERR(em->emrg_env);
				em->emrg_env = NULL;
			}
		} else {
			result = -ENOMEM;
		}
	}
	if (result != 0) {
		lov_emerg_free(emerg, nr);
		emerg = ERR_PTR(result);
	}
	return emerg;
}

static int lov_expand_targets(const struct lu_env *env, struct lov_device *dev)
{
	int   result;
@@ -306,29 +238,17 @@ static int lov_expand_targets(const struct lu_env *env, struct lov_device *dev)
	sub_size = dev->ld_target_nr;
	if (sub_size < tgt_size) {
		struct lovsub_device    **newd;
		struct lov_device_emerg **emerg;
		const size_t	      sz   = sizeof(newd[0]);

		emerg = lov_emerg_alloc(tgt_size);
		if (IS_ERR(emerg))
			return PTR_ERR(emerg);

		newd = kcalloc(tgt_size, sz, GFP_NOFS);
		if (newd) {
			mutex_lock(&dev->ld_mutex);
			if (sub_size > 0) {
				memcpy(newd, dev->ld_target, sub_size * sz);
				kfree(dev->ld_target);
			}
			dev->ld_target    = newd;
			dev->ld_target_nr = tgt_size;

			if (dev->ld_emrg)
				lov_emerg_free(dev->ld_emrg, sub_size);
			dev->ld_emrg = emerg;
			mutex_unlock(&dev->ld_mutex);
		} else {
			lov_emerg_free(emerg, tgt_size);
			result = -ENOMEM;
		}
	}
@@ -362,8 +282,6 @@ static int lov_cl_add_target(const struct lu_env *env, struct lu_device *dev,
				   tgt->ltd_obd->obd_lu_dev);
		if (!IS_ERR(cl)) {
			lsd = cl2lovsub_dev(cl);
			lsd->acid_idx = index;
			lsd->acid_super = ld;
			ld->ld_target[index] = lsd;
		} else {
			CERROR("add failed (%d), deleting %s\n", rc,
@@ -428,9 +346,6 @@ static struct lu_device *lov_device_alloc(const struct lu_env *env,
	d = lov2lu_dev(ld);
	d->ld_ops	= &lov_lu_ops;

	mutex_init(&ld->ld_mutex);
	lockdep_set_class(&ld->ld_mutex, &cl_lov_device_mutex_class);

	/* setup the LOV OBD */
	obd = class_name2obd(lustre_cfg_string(cfg, 0));
	LASSERT(obd);
+0 −27
Original line number Diff line number Diff line
@@ -161,42 +161,21 @@ struct lov_request {
	struct list_head	       rq_link;

	int		      rq_idx;	/* index in lov->tgts array */
	int		      rq_stripe;     /* stripe number */
	int		      rq_complete;
	int		      rq_rc;

	u32		      rq_oabufs;
	u32		      rq_pgaidx;
};

struct lov_request_set {
	struct obd_info			*set_oi;
	atomic_t			set_refcount;
	struct obd_export		*set_exp;
	/* XXX: There is @set_exp already, however obd_statfs gets obd_device
	 * only.
	 */
	struct obd_device		*set_obd;
	int				set_count;
	atomic_t			set_completes;
	atomic_t			set_success;
	atomic_t			set_finish_checked;
	struct list_head			set_list;
	wait_queue_head_t			set_waitq;
};

extern struct kmem_cache *lov_oinfo_slab;

extern struct lu_kmem_descr lov_caches[];

void lov_finish_set(struct lov_request_set *set);

static inline void lov_put_reqset(struct lov_request_set *set)
{
	if (atomic_dec_and_test(&set->set_refcount))
		lov_finish_set(set);
}

#define lov_uuid2str(lv, index) \
	(char *)((lv)->lov_tgts[index]->ltd_uuid.uuid)

@@ -217,15 +196,9 @@ pgoff_t lov_stripe_pgoff(struct lov_stripe_md *lsm, pgoff_t stripe_index,
			 int stripe);

/* lov_request.c */
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);
int lov_prep_statfs_set(struct obd_device *obd, struct obd_info *oinfo,
			struct lov_request_set **reqset);
int lov_fini_statfs(struct obd_device *obd, struct obd_statfs *osfs,
		    int success);
int lov_fini_statfs_set(struct lov_request_set *set);
int lov_statfs_interpret(struct ptlrpc_request_set *rqset, void *data, int rc);

/* lov_obd.c */
void lov_stripe_lock(struct lov_stripe_md *md);
Loading