From 0087ac980cae2ebb652671a8c1b51c628ab7ba3b Mon Sep 17 00:00:00 2001 From: Alex Zhuravlev Date: Sat, 19 Mar 2016 09:28:30 +0300 Subject: [PATCH] LU-7908 osp: fake precreate support to be able to benchmark file creations locally like we have very fast OSTs. Change-Id: Ic5bb0f1c9306fee018da74a38f4ce702bf28d293 Signed-off-by: Alex Zhuravlev Reviewed-on: http://review.whamcloud.com/19083 Tested-by: Jenkins Tested-by: Maloo Reviewed-by: Andreas Dilger Reviewed-by: Nathaniel Clark --- lustre/include/obd_support.h | 1 + lustre/osp/osp_precreate.c | 5 +++++ 2 files changed, 6 insertions(+) diff --git a/lustre/include/obd_support.h b/lustre/include/obd_support.h index 714410d..f089bf3 100644 --- a/lustre/include/obd_support.h +++ b/lustre/include/obd_support.h @@ -615,6 +615,7 @@ extern char obd_jobid_var[]; #define OBD_FAIL_OSP_CHECK_INVALID_REC 0x2100 #define OBD_FAIL_OSP_CHECK_ENOMEM 0x2101 +#define OBD_FAIL_OSP_FAKE_PRECREATE 0x2102 /* Assign references to moved code to reduce code changes */ #define OBD_FAIL_PRECHECK(id) CFS_FAIL_PRECHECK(id) diff --git a/lustre/osp/osp_precreate.c b/lustre/osp/osp_precreate.c index b723731..30f3164 100644 --- a/lustre/osp/osp_precreate.c +++ b/lustre/osp/osp_precreate.c @@ -610,6 +610,9 @@ static int osp_precreate_send(const struct lu_env *env, struct osp_device *d) ptlrpc_request_set_replen(req); + if (OBD_FAIL_CHECK(OBD_FAIL_OSP_FAKE_PRECREATE)) + GOTO(ready, rc = 0); + rc = ptlrpc_queue_wait(req); if (rc) { CERROR("%s: can't precreate: rc = %d\n", d->opd_obd->obd_name, @@ -623,6 +626,8 @@ static int osp_precreate_send(const struct lu_env *env, struct osp_device *d) GOTO(out_req, rc = -EPROTO); ostid_to_fid(fid, &body->oa.o_oi, d->opd_index); + +ready: if (osp_fid_diff(fid, &d->opd_pre_used_fid) <= 0) { CERROR("%s: precreate fid "DFID" < local used fid "DFID ": rc = %d\n", d->opd_obd->obd_name, -- 1.8.3.1