From 6d185ec7e0c91daf5903f8d9e03e1d5b163b7fbb Mon Sep 17 00:00:00 2001 From: Alex Zhuravlev Date: Sun, 30 Sep 2012 00:38:18 +0400 Subject: [PATCH 1/1] LU-1303 fld: verify support for range lookups if the underlying storage does not support range lookups, then FLD disables any mappings with server index different from 0, thus disabling DNE and FID-on-OST features. Signed-off-by: Alex Zhuravlev Change-Id: Id93b01385acfafde024dff33557656afdcd1e4b3 Reviewed-on: http://review.whamcloud.com/4133 Reviewed-by: Mike Pershin Tested-by: Hudson Reviewed-by: Andreas Dilger Tested-by: Maloo --- lustre/fld/fld_handler.c | 5 +++++ lustre/fld/fld_index.c | 47 +++++++++++++++++++++++++++++++++++++++++---- lustre/include/lustre_fld.h | 5 +++++ 3 files changed, 53 insertions(+), 4 deletions(-) diff --git a/lustre/fld/fld_handler.c b/lustre/fld/fld_handler.c index 9f3f1ef..1d28b218 100644 --- a/lustre/fld/fld_handler.c +++ b/lustre/fld/fld_handler.c @@ -117,6 +117,11 @@ int fld_declare_server_create(struct lu_server_fld *fld, ENTRY; + if (fld->lsf_no_range_lookup) { + /* Stub for underlying FS which can't lookup ranges */ + return 0; + } + /* for ldiskfs OSD it's enough to declare operation with any ops * with DMU we'll probably need to specify exact key/value */ rc = dt_obj->do_index_ops->dio_declare_delete(env, dt_obj, NULL, th); diff --git a/lustre/fld/fld_index.c b/lustre/fld/fld_index.c index 2c3ebe8..e4c4169 100644 --- a/lustre/fld/fld_index.c +++ b/lustre/fld/fld_index.c @@ -72,7 +72,7 @@ static const struct lu_seq_range IGIF_FLD_RANGE = { }; const struct dt_index_features fld_index_features = { - .dif_flags = DT_IND_UPDATE, + .dif_flags = DT_IND_UPDATE | DT_IND_RANGE, .dif_keysize_min = sizeof(seqno_t), .dif_keysize_max = sizeof(seqno_t), .dif_recsize_min = sizeof(struct lu_seq_range), @@ -149,6 +149,11 @@ int fld_declare_index_create(struct lu_server_fld *fld, ENTRY; + if (fld->lsf_no_range_lookup) { + /* Stub for underlying FS which can't lookup ranges */ + return 0; + } + start = range->lsr_start; LASSERT(range_is_sane(range)); @@ -180,6 +185,17 @@ int fld_index_create(struct lu_server_fld *fld, ENTRY; + if (fld->lsf_no_range_lookup) { + /* Stub for underlying FS which can't lookup ranges */ + if (range->lsr_index != 0) { + CERROR("%s: FLD backend does not support range" + "lookups, so DNE and FIDs-on-OST are not" + "supported in this configuration\n", + fld->lsf_name); + return -EINVAL; + } + } + start = range->lsr_start; LASSERT(range_is_sane(range)); @@ -248,6 +264,17 @@ int fld_index_lookup(struct lu_server_fld *fld, ENTRY; + if (fld->lsf_no_range_lookup) { + /* Stub for underlying FS which can't lookup ranges */ + range->lsr_start = 0; + range->lsr_end = ~0; + range->lsr_index = 0; + range->lsr_flags = LU_SEQ_RANGE_MDT; + + range_cpu_to_be(range, range); + return 0; + } + info = lu_context_key_get(&env->le_ctx, &fld_thread_key); fld_rec = &info->fti_rec; @@ -322,9 +349,21 @@ int fld_index_init(struct lu_server_fld *fld, lu_object_put(env, &dt_obj->do_lu); fld->lsf_obj = NULL; } - } else - CERROR("%s: File \"%s\" is not an index!\n", - fld->lsf_name, fld_index_name); + } else if (rc == -ERANGE) { + CWARN("%s: File \"%s\" doesn't support range lookup, " + "using stub. DNE and FIDs on OST will not work " + "with this backend\n", + fld->lsf_name, fld_index_name); + + LASSERT(dt_obj->do_index_ops == NULL); + fld->lsf_no_range_lookup = 1; + rc = 0; + } else { + CERROR("%s: File \"%s\" is not index, rc %d!\n", + fld->lsf_name, fld_index_name, rc); + lu_object_put(env, &fld->lsf_obj->do_lu); + fld->lsf_obj = NULL; + } } else { diff --git a/lustre/include/lustre_fld.h b/lustre/include/lustre_fld.h index 0279814..836ecfd 100644 --- a/lustre/include/lustre_fld.h +++ b/lustre/include/lustre_fld.h @@ -97,6 +97,11 @@ struct lu_server_fld { /** * Fld service name in form "fld-srv-lustre-MDTXXX" */ char lsf_name[80]; + + /** + * Backend does not support range lookups, + * indexes other that 0 will be prohibited */ + int lsf_no_range_lookup; }; struct lu_client_fld { -- 1.8.3.1