Whamcloud - gitweb
LU-7908 osp: fake precreate support 83/19083/4
authorAlex Zhuravlev <alexey.zhuravlev@intel.com>
Sat, 19 Mar 2016 06:28:30 +0000 (09:28 +0300)
committerOleg Drokin <oleg.drokin@intel.com>
Tue, 14 Jun 2016 03:51:30 +0000 (03:51 +0000)
to be able to benchmark file creations locally like we
have very fast OSTs.

Change-Id: Ic5bb0f1c9306fee018da74a38f4ce702bf28d293
Signed-off-by: Alex Zhuravlev <alexey.zhuravlev@intel.com>
Reviewed-on: http://review.whamcloud.com/19083
Tested-by: Jenkins
Tested-by: Maloo <hpdd-maloo@intel.com>
Reviewed-by: Andreas Dilger <andreas.dilger@intel.com>
Reviewed-by: Nathaniel Clark <nathaniel.l.clark@intel.com>
lustre/include/obd_support.h
lustre/osp/osp_precreate.c

index 714410d..f089bf3 100644 (file)
@@ -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_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)
 
 /* Assign references to moved code to reduce code changes */
 #define OBD_FAIL_PRECHECK(id)                   CFS_FAIL_PRECHECK(id)
index b723731..30f3164 100644 (file)
@@ -610,6 +610,9 @@ static int osp_precreate_send(const struct lu_env *env, struct osp_device *d)
 
        ptlrpc_request_set_replen(req);
 
 
        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,
        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);
                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,
        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,