Commit 7cb15d04 authored by Gregoire Pichon's avatar Gregoire Pichon Committed by Greg Kroah-Hartman
Browse files

staging: lustre: mdc: manage number of modify RPCs in flight



This patch is the main client part of a new feature that supports
multiple modify metadata RPCs in parallel. Its goal is to improve
metadata operations performance of a single client, while maintening
the consistency of MDT reply reconstruction and MDT recovery
mechanisms.

It allows to manage the number of modify RPCs in flight within
the client obd structure and to assign a virtual index (the tag) to
each modify RPC to help server side cleaning of reply data.

The mdc component uses this feature to send multiple modify RPCs
in parallel.

Signed-off-by: default avatarGregoire Pichon <gregoire.pichon@bull.net>
Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-5319
Reviewed-on: http://review.whamcloud.com/14374


Reviewed-by: default avatarAndreas Dilger <andreas.dilger@intel.com>
Reviewed-by: default avatarAlex Zhuravlev <alexey.zhuravlev@intel.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 0ffaa9c8
Loading
Loading
Loading
Loading
+0 −4
Original line number Diff line number Diff line
@@ -112,11 +112,7 @@ static int seq_client_rpc(struct lu_client_seq *seq,

	ptlrpc_at_set_req_timeout(req);

	if (opc != SEQ_ALLOC_SUPER && seq->lcs_type == LUSTRE_SEQ_METADATA)
		mdc_get_rpc_lock(exp->exp_obd->u.cli.cl_rpc_lock, NULL);
	rc = ptlrpc_queue_wait(req);
	if (opc != SEQ_ALLOC_SUPER && seq->lcs_type == LUSTRE_SEQ_METADATA)
		mdc_put_rpc_lock(exp->exp_obd->u.cli.cl_rpc_lock, NULL);
	if (rc)
		goto out_req;

+24 −0
Original line number Diff line number Diff line
@@ -156,6 +156,30 @@ static inline void mdc_put_rpc_lock(struct mdc_rpc_lock *lck,
	mutex_unlock(&lck->rpcl_mutex);
}

static inline void mdc_get_mod_rpc_slot(struct ptlrpc_request *req,
					struct lookup_intent *it)
{
	struct client_obd *cli = &req->rq_import->imp_obd->u.cli;
	u32 opc;
	u16 tag;

	opc = lustre_msg_get_opc(req->rq_reqmsg);
	tag = obd_get_mod_rpc_slot(cli, opc, it);
	lustre_msg_set_tag(req->rq_reqmsg, tag);
}

static inline void mdc_put_mod_rpc_slot(struct ptlrpc_request *req,
					struct lookup_intent *it)
{
	struct client_obd *cli = &req->rq_import->imp_obd->u.cli;
	u32 opc;
	u16 tag;

	opc = lustre_msg_get_opc(req->rq_reqmsg);
	tag = lustre_msg_get_tag(req->rq_reqmsg);
	obd_put_mod_rpc_slot(cli, opc, it, tag);
}

/**
 * Update the maximum possible easize.
 *
+5 −2
Original line number Diff line number Diff line
@@ -263,14 +263,17 @@ struct client_obd {
	wait_queue_head_t	      cl_destroy_waitq;

	struct mdc_rpc_lock     *cl_rpc_lock;
	struct mdc_rpc_lock     *cl_close_lock;

	/* modify rpcs in flight
	 * currently used for metadata only
	 */
	spinlock_t		 cl_mod_rpcs_lock;
	u16			 cl_max_mod_rpcs_in_flight;

	u16			 cl_mod_rpcs_in_flight;
	u16			 cl_close_rpcs_in_flight;
	wait_queue_head_t	 cl_mod_rpcs_waitq;
	unsigned long		*cl_mod_tag_bitmap;
	struct obd_histogram	 cl_mod_rpcs_hist;

	/* mgc datastruct */
	atomic_t	     cl_mgc_refcount;
+6 −0
Original line number Diff line number Diff line
@@ -101,6 +101,12 @@ void obd_put_request_slot(struct client_obd *cli);
__u32 obd_get_max_rpcs_in_flight(struct client_obd *cli);
int obd_set_max_rpcs_in_flight(struct client_obd *cli, __u32 max);
int obd_set_max_mod_rpcs_in_flight(struct client_obd *cli, u16 max);
int obd_mod_rpc_stats_seq_show(struct client_obd *cli, struct seq_file *seq);

u16 obd_get_mod_rpc_slot(struct client_obd *cli, u32 opc,
			 struct lookup_intent *it);
void obd_put_mod_rpc_slot(struct client_obd *cli, u32 opc,
			  struct lookup_intent *it, u16 tag);

struct llog_handle;
struct llog_rec_hdr;
+37 −0
Original line number Diff line number Diff line
@@ -375,6 +375,25 @@ int client_obd_setup(struct obd_device *obddev, struct lustre_cfg *lcfg)
	} else {
		cli->cl_max_rpcs_in_flight = OBD_MAX_RIF_DEFAULT;
	}

	spin_lock_init(&cli->cl_mod_rpcs_lock);
	spin_lock_init(&cli->cl_mod_rpcs_hist.oh_lock);
	cli->cl_max_mod_rpcs_in_flight = 0;
	cli->cl_mod_rpcs_in_flight = 0;
	cli->cl_close_rpcs_in_flight = 0;
	init_waitqueue_head(&cli->cl_mod_rpcs_waitq);
	cli->cl_mod_tag_bitmap = NULL;

	if (connect_op == MDS_CONNECT) {
		cli->cl_max_mod_rpcs_in_flight = cli->cl_max_rpcs_in_flight - 1;
		cli->cl_mod_tag_bitmap = kcalloc(BITS_TO_LONGS(OBD_MAX_RIF_MAX),
						 sizeof(long), GFP_NOFS);
		if (!cli->cl_mod_tag_bitmap) {
			rc = -ENOMEM;
			goto err;
		}
	}

	rc = ldlm_get_ref();
	if (rc) {
		CERROR("ldlm_get_ref failed: %d\n", rc);
@@ -434,12 +453,16 @@ err_import:
err_ldlm:
	ldlm_put_ref();
err:
	kfree(cli->cl_mod_tag_bitmap);
	cli->cl_mod_tag_bitmap = NULL;
	return rc;
}
EXPORT_SYMBOL(client_obd_setup);

int client_obd_cleanup(struct obd_device *obddev)
{
	struct client_obd *cli = &obddev->u.cli;

	ldlm_namespace_free_post(obddev->obd_namespace);
	obddev->obd_namespace = NULL;

@@ -447,6 +470,10 @@ int client_obd_cleanup(struct obd_device *obddev)
	LASSERT(!obddev->u.cli.cl_import);

	ldlm_put_ref();

	kfree(cli->cl_mod_tag_bitmap);
	cli->cl_mod_tag_bitmap = NULL;

	return 0;
}
EXPORT_SYMBOL(client_obd_cleanup);
@@ -461,6 +488,7 @@ int client_connect_import(const struct lu_env *env,
	struct obd_import       *imp    = cli->cl_import;
	struct obd_connect_data *ocd;
	struct lustre_handle    conn    = { 0 };
	bool is_mdc = false;
	int		     rc;

	*exp = NULL;
@@ -487,6 +515,10 @@ int client_connect_import(const struct lu_env *env,
	ocd = &imp->imp_connect_data;
	if (data) {
		*ocd = *data;
		is_mdc = !strncmp(imp->imp_obd->obd_type->typ_name,
				  LUSTRE_MDC_NAME, 3);
		if (is_mdc)
			data->ocd_connect_flags |= OBD_CONNECT_MULTIMODRPCS;
		imp->imp_connect_flags_orig = data->ocd_connect_flags;
	}

@@ -502,6 +534,11 @@ int client_connect_import(const struct lu_env *env,
			 ocd->ocd_connect_flags, "old %#llx, new %#llx\n",
			 data->ocd_connect_flags, ocd->ocd_connect_flags);
		data->ocd_connect_flags = ocd->ocd_connect_flags;
		/* clear the flag as it was not set and is not known
		 * by upper layers
		 */
		if (is_mdc)
			data->ocd_connect_flags &= ~OBD_CONNECT_MULTIMODRPCS;
	}

	ptlrpc_pinger_add_import(imp);
Loading